addMesh and MultRes, etal "LODs", also 'skinned meshes' oddity
by BrokeAss Games · in Torque 3D Professional · 08/05/2010 (5:23 pm) · 10 replies
If I use the stock SDK 'gideon' player shape[seemingly with MultiRes LOD's], and attempt to ::addMesh a piece of geometry from another DTS file; which happens to share the same rig as 'gideon', I don't see the added mesh rendering.
I can dump the shape and see the Object and Detail number attached to the hierarchy, but not 'see/render' it ingame at this time with this latest build. This example was a simple sphere geometry object, weighted entirely to the 'Bip01 Head' node and an attempt to use ::addMesh to bring in a new piece of geometry to an existing DTS file. Then...
I took and exported a nonMultiRes "gideon" DTS shape, with only 2 'skinned' meshes in the hierarchy, 'head' and 'body'. Now, when I use this DTS shape in my ::onLoad--addMesh, I get the target mesh 'added' to my hierarchy, but now any original mesh in the 'addedTo' DTS file[gideon] is now missing from runtime Rendering!!?? Also, I see that this new mesh has been added to hierarchy at the root of the chainl[Bip01 Pelvis]...when I use ::%this.setObjectNode...I'm getting it correctly parented in a dump, but not a runTime Rendering...it still appears at the Bip01 Pelvis node location.
I'm still checking...to see if 'skinned' mesh Objects get added...Earlier beta 1 version, I was not able to 'addMesh' a 'skinned' mesh, only 'rigid' mesh Objects.
Here's my working function for the adding of meshes:
"gideonNewHead.dts" consists of the stock SDK 'gideon' rig with a geoSphere weighted to Bip01 Head node exported as DTS shape.
Here's the DMP output from all this mesh adding...:
...notice how the "myNewHead" Object is indeed parented to the Bip01 Head node...but inside the engine, I get a missing 'gideon' body and head mesh, and rendering of my new sphere geometry, in the incorrect location...
Since I'd recently been working with the addMesh functionality...I thought I'd look at it quickly with the new build and this is my observations with stock player object, 'gideonDTS'.
I can dump the shape and see the Object and Detail number attached to the hierarchy, but not 'see/render' it ingame at this time with this latest build. This example was a simple sphere geometry object, weighted entirely to the 'Bip01 Head' node and an attempt to use ::addMesh to bring in a new piece of geometry to an existing DTS file. Then...
I took and exported a nonMultiRes "gideon" DTS shape, with only 2 'skinned' meshes in the hierarchy, 'head' and 'body'. Now, when I use this DTS shape in my ::onLoad--addMesh, I get the target mesh 'added' to my hierarchy, but now any original mesh in the 'addedTo' DTS file[gideon] is now missing from runtime Rendering!!?? Also, I see that this new mesh has been added to hierarchy at the root of the chainl[Bip01 Pelvis]...when I use ::%this.setObjectNode...I'm getting it correctly parented in a dump, but not a runTime Rendering...it still appears at the Bip01 Pelvis node location.
I'm still checking...to see if 'skinned' mesh Objects get added...Earlier beta 1 version, I was not able to 'addMesh' a 'skinned' mesh, only 'rigid' mesh Objects.
Here's my working function for the adding of meshes:
function GideonReduxDts::onLoad(%this)
{
//%this.addMesh("myNewHead2", "./BoomBot.dts", "mesh_head3");
%this.addMesh("myNewHead2", "./gideonNewHead.dts", "newHead0");
%this.setObjectNode( "myNewHead2", "Bip01 Head" ); // Have to do this if 'rigid' mesh, NOT if 'skinned' mesh
%this.dumpShape();
}"gideonNewHead.dts" consists of the stock SDK 'gideon' rig with a geoSphere weighted to Bip01 Head node exported as DTS shape.
Here's the DMP output from all this mesh adding...:
Subtrees:
Subtree 0
Bip01 Pelvis
Bip01 Spine
Bip01 Spine1
Bip01 Spine2
Bip01 Neck
Bip01 Head --> Object myNewHead with following details: 2
Eye
Bip01 L Clavicle
Bip01 L UpperArm...notice how the "myNewHead" Object is indeed parented to the Bip01 Head node...but inside the engine, I get a missing 'gideon' body and head mesh, and rendering of my new sphere geometry, in the incorrect location...
Since I'd recently been working with the addMesh functionality...I thought I'd look at it quickly with the new build and this is my observations with stock player object, 'gideonDTS'.
About the author
http://www.youtube.com/user/BrokeAssGames
#2
In theory, I would think, as long as the mesh is weighted to the same 'nodes'...it should be added, weighted and at the proper transform/position. However; I was not able to 'add' any mesh object that was 'skinned' in beta1, just 'rigid' mesh objects, which the 'newHead' geometry is...so, things seem 'goofy' with addMesh and LOD's, and 'Skinned' meshes, would think they were an 'Object' as well?? Perhaps not.
08/05/2010 (6:13 pm)
It does add the 'newHead' Object to 'gideon' at the Scene Root...Bip01 Pelvis as default. I then use 'setObjectNode' to get it parented correctly, since it did not follow the weighting to Bip01 Head I'd set up for the new sphere head object....this function 'seems' to work, as I read the Hierarchy and it's located properly...it's in rendering inside the engine...where the 'setObjectNode' doesn't seem to be working??In theory, I would think, as long as the mesh is weighted to the same 'nodes'...it should be added, weighted and at the proper transform/position. However; I was not able to 'add' any mesh object that was 'skinned' in beta1, just 'rigid' mesh objects, which the 'newHead' geometry is...so, things seem 'goofy' with addMesh and LOD's, and 'Skinned' meshes, would think they were an 'Object' as well?? Perhaps not.
#3
Good job, Chris!! Still not certain if 'skinned' meshes get added....earlier observations said, 'no'.
08/05/2010 (6:34 pm)
Ah yes....I see now, was the LOD's.....changed my 'newHead' object to be same Detail level as rest of 'gideon' meshes...and it renders at proper location as well!.....Good job, Chris!! Still not certain if 'skinned' meshes get added....earlier observations said, 'no'.
#4
Manoel, you are quite right and it's as I 'theorized' that with my 'skinned' mesh and it's vertex assignments. I didn't need to manually
Super, Duper, Chris! This opens up many possibilities for the engine! ;), should/could be worked into the Shape Editor....;)??!!
Ah, it is...under the auspice of Import shape into button.....
08/06/2010 (2:06 pm)
Have been looking into 'skinned' mesh addMesh calling....results are looking quite fantastic!Manoel, you are quite right and it's as I 'theorized' that with my 'skinned' mesh and it's vertex assignments. I didn't need to manually
%this.setNodefor the OBJECT in question, the vertex assignments 'seem' to have located the mesh in the proper location[where created in modeling application and exporatation]. However; rigid meshes acted differently and needed some heavyHanded nudging...perhaps exposing a Member Field for offset? orientation? as well.
Super, Duper, Chris! This opens up many possibilities for the engine! ;), should/could be worked into the Shape Editor....;)??!!
Ah, it is...under the auspice of Import shape into button.....
#6
Odd, I can get meshes from one of two figures 'injected' into the other, but not from the other figure into the original figure...may be the DTS files? Good error reporting on Nodes not in file but in Imported Skin mesh....now, if the Editor could check for missing nodes and add as needed, ;)!!! Like a DSQ; if node ain't there, Skin ain't arriving...but, if I 'addNode' the missing node, Skin mesh Imports...very coolio. A full check of all nodes before the Process 'bails' and errors out, might be very helpful for a debug. I had to go back several times[addNode] and see which node was the latest 'not present' in file...tedious, oh well.
Also, noticing a hard seam when importing meshes, as if their smoothing data is lost with import. I have many geometry groups which are smoothed in the original DTS shape...when they're imported...all groupings are intact, but their normals at the seams get borked.
08/08/2010 (10:27 am)
I was having some difficulties getting the 'Imported' geometry to render in the Shape Editor GUI. I can manually script geometry in and get it rendering at runTime, but when I Import via the GUI, I get the data in the Hierarchy, just not rendering; I'll recheck documents on use...thanks a lot, Chris, working pretty good as function calls, having some trouble with the GUI, buttons, etal to get the geometry rendering...?Odd, I can get meshes from one of two figures 'injected' into the other, but not from the other figure into the original figure...may be the DTS files? Good error reporting on Nodes not in file but in Imported Skin mesh....now, if the Editor could check for missing nodes and add as needed, ;)!!! Like a DSQ; if node ain't there, Skin ain't arriving...but, if I 'addNode' the missing node, Skin mesh Imports...very coolio. A full check of all nodes before the Process 'bails' and errors out, might be very helpful for a debug. I had to go back several times[addNode] and see which node was the latest 'not present' in file...tedious, oh well.
Also, noticing a hard seam when importing meshes, as if their smoothing data is lost with import. I have many geometry groups which are smoothed in the original DTS shape...when they're imported...all groupings are intact, but their normals at the seams get borked.
#7
I take GideonDTS into the ShapeEditor. I then Import a Skin Mesh[newHead0]. I see the object inside the Detail Tab Detail level, I also see a red bounding box appear; but no rendering of the geometry. I had to save the script with the UI, then reload the DTS shape, then the new geometry renders/appears.
What I noticed is the Save function[to external .CS file] is leaving a space between the geometry 'name' and it's 'detail' number....and this is not how the CHM has the function described, with NO space between geometry 'name' and 'detail' number...?? Make any difference? Curious about the white space...and pathing. I see the 'Saved' .CS file has the 'path' as a string, but with no 'pointer' as to where to start, unlike the CHM file which has a 'hard' path...'/', or '~', or '.' starting the string?
Oh, BTW; any sequences I had loaded via Constructor, after addMesh, seems to have deleted them from the list...when I select the shape in the Mission and enter the Shape Editor.
Another BTW; I have existing Nshape.cs files which I am working from...which have some onLoad goodies besides the 'addMesh' buttons I worked in the GUI. When I 'Save', I totally overwrite the file, losing any work I'd done. Is there a way to warn? or allow appending of the existing .CS file, if the shape is open in the Editor?
08/08/2010 (2:19 pm)
Yes, Chris, I've observed this:I take GideonDTS into the ShapeEditor. I then Import a Skin Mesh[newHead0]. I see the object inside the Detail Tab Detail level, I also see a red bounding box appear; but no rendering of the geometry. I had to save the script with the UI, then reload the DTS shape, then the new geometry renders/appears.
What I noticed is the Save function[to external .CS file] is leaving a space between the geometry 'name' and it's 'detail' number....and this is not how the CHM has the function described, with NO space between geometry 'name' and 'detail' number...?? Make any difference? Curious about the white space...and pathing. I see the 'Saved' .CS file has the 'path' as a string, but with no 'pointer' as to where to start, unlike the CHM file which has a 'hard' path...'/', or '~', or '.' starting the string?
Oh, BTW; any sequences I had loaded via Constructor, after addMesh, seems to have deleted them from the list...when I select the shape in the Mission and enter the Shape Editor.
Another BTW; I have existing Nshape.cs files which I am working from...which have some onLoad goodies besides the 'addMesh' buttons I worked in the GUI. When I 'Save', I totally overwrite the file, losing any work I'd done. Is there a way to warn? or allow appending of the existing .CS file, if the shape is open in the Editor?
#8
08/11/2010 (12:31 am)
Now that you have a better understanding of the way this works, is there still any "bugs" or is it only feature requests?
#9
08/11/2010 (5:38 am)
Hi Rex - I've extracted the following issues/questions from your comments:- Imported geometry not rendering in Shape Editor
- Request better error reporting about missing nodes when importing a skinned mesh. For example, list all missing nodes before failing rather than just the first one.
- Odd normals at seams of imported meshes.
- Shape Editor saved TSShapeConstructor scripts have a space between the mesh name and the detail size.
- Missing sequences in Shape Editor
- Saving in Shape Editor overwrites existing TSShapeConstructor changes.
This was a bug in the Shape Editor (not updating the TSShapeInstance with the new materials required by the imported geometry). Fixed in beta3.
Sounds reasonable. Will try to get this into beta 3.
Do the normals look ok if you load the models individually? Could this just be a COLLADA export problem?
This is normal, and just more clearly separates the two. It also prevents problems if the mesh name had a number at the end of it.
Not sure what is going on there. Haven't been able to reproduce it.
The Shape Editor replaces the contents of the onLoad function with all TSShapeConstructor commands previously invoked that modified the shape. So saving should retain any changes you had entered manually, though they may be modified (commands may be collapsed, replaced etc). Comments and other script logic (for loops, if/else etc) will not be retained => just a straight list of commands.
#10
1. Great! Yes, definitely not rendering with 'Import'.
2. Super! I think it's good to iterate thru a list completely before bailing out on the 'first' error in list. We did this for DSQTweaker; writes an entire report for the 'process', then notifies of missing nodes, etc...
4. ?? Hm.......I'll keep an eye on this one, not entirely sure...
5. Yah, this was very odd...I do have my sequences in the array and they 'should' load...but seems if I take a 'loaded' DTS shape, leave the Shape Editor to World Editor, then return; I lose my list of sequences from the array?? Another 'keep an eye on' for this one.
6. Ah...had some parts commented out...and they didn't save, I get it now...thanks!
#3: I'll have to go back and check the 'original' DTS shape with respect to normals at group seams/edges....NOT COLLADA at all. Pure MS3D export to DTS shape for my 'inject-able' geometry. Pretty sure they're smooth as a DTS shape. It's with the process of 'importing'/segmented the model for the Scene, that the seam normals go wonky; as if you unwelded the seam....and 'kinda' makes sense...I"ll try to get some images together, but seem to have lost access to our FTP site for uploads...?!
Looking very good so far, Chris! ::addMesh is so cool!
@Matt F: A few bugs...a few features. Shape Editor is amazing! Can't wait to see version Beta3....this version was many steps beyond Beta1! To see weighted mesh arrive in the Scene, bound to nodes and not losing much[normals at seams] data......WOWie ZOWie: let's see Unity do that....[hoping to not put foot to mouth]
08/11/2010 (10:58 am)
Sorry for the 'bad' Bug reporting...my first in T3D. 1. Great! Yes, definitely not rendering with 'Import'.
2. Super! I think it's good to iterate thru a list completely before bailing out on the 'first' error in list. We did this for DSQTweaker; writes an entire report for the 'process', then notifies of missing nodes, etc...
4. ?? Hm.......I'll keep an eye on this one, not entirely sure...
5. Yah, this was very odd...I do have my sequences in the array and they 'should' load...but seems if I take a 'loaded' DTS shape, leave the Shape Editor to World Editor, then return; I lose my list of sequences from the array?? Another 'keep an eye on' for this one.
6. Ah...had some parts commented out...and they didn't save, I get it now...thanks!
#3: I'll have to go back and check the 'original' DTS shape with respect to normals at group seams/edges....NOT COLLADA at all. Pure MS3D export to DTS shape for my 'inject-able' geometry. Pretty sure they're smooth as a DTS shape. It's with the process of 'importing'/segmented the model for the Scene, that the seam normals go wonky; as if you unwelded the seam....and 'kinda' makes sense...I"ll try to get some images together, but seem to have lost access to our FTP site for uploads...?!
Looking very good so far, Chris! ::addMesh is so cool!
@Matt F: A few bugs...a few features. Shape Editor is amazing! Can't wait to see version Beta3....this version was many steps beyond Beta1! To see weighted mesh arrive in the Scene, bound to nodes and not losing much[normals at seams] data......WOWie ZOWie: let's see Unity do that....[hoping to not put foot to mouth]
Associate Manoel Neto
Default Studio Name