Digital Art Zone

 
     
DzVertexMesh and geografting
Posted: 10 October 2012 07:44 AM   [ Ignore ]
Power Member
Avatar
RankRankRank
Total Posts:  1143
Joined  2009-10-27

I’d like to add support to geografted figures but I am unable to understand how to get the DzVertexMesh for the combined figure.
I used to get the vertex mesh for a standard figure like this:

myVertexMesh = qobject_cast<DzVertexMesh*>(myFigure->getObject()->getCachedGeom());

However, that wouldn’t work on a geografted figure because it reads only the base figure geometry.
I’ve been taking a look also at the dzgraftingfigureshape.h header (BTW, no documentation about this class is available yet), but I couldn’t understand if there are some functions that would actually return the combined vertex mesh, facet mesh, selection map etc.

Any chance of getting some help, or maybe a working example? Thanks

 Signature 

Blog
FB
YT
Pinterest

Profile
 
 
Posted: 11 October 2012 10:42 AM   [ Ignore ]   [ # 1 ]
Member
Rank
Total Posts:  62
Joined  2004-12-26

The call you are using will give you the current geografted state of the mesh in the general case, it is the call we use to draw/render the graft, but there a couple exceptions.  There are a few tools in studio (ie Polygon Selection Tool, Weight Map Tool, etc) that effectively shut grafting off.  While these are active nothing is grafted in the scene.

On DzShape there is also the functions “getAssemblyGeometry()” and “getModifiableAssemblyGeom()”.  When grafting is on these meshes will give you the grafted “Assembled” mesh, though both are in unmodified state.  When dealing with a shape that is grafted remember to use the “Assembly” material functions instead of the plain material functions.  These “Assembly” material functions can be used all the time as they will fall back to the standard ones when no grafting is occurring.

Profile
 
 
Posted: 11 October 2012 10:59 AM   [ Ignore ]   [ # 2 ]
Power Member
Avatar
RankRankRank
Total Posts:  1143
Joined  2009-10-27

Thanks ketthrove, I tried using:

myVertexMesh = qobject_cast<DzVertexMesh*>(figureShape->getModifiableAssemblyGeom(false)));

, but the result is the same, only Genesis get loaded. I checked also the myVertexMesh->getNumVertices() and infact the number of vertices, regardless it’s a geografting, still shows the same number of the Genesis count.

 Signature 

Blog
FB
YT
Pinterest

Profile
 
 
Posted: 11 October 2012 11:35 AM   [ Ignore ]   [ # 3 ]
Member
Rank
Total Posts:  62
Joined  2004-12-26

I selected an un-grafted Genesis with the universal transform selection tool root and ran this script:

var node Scene.getPrimarySelection();
var 
obj node.getObject();
var 
geom obj.getCachedGeom();
print( 
"Vertices:" geom.getNumVertices() );
print( 
"Faces:" +geom.getNumFacets() ); 

It prints:

Vertices:76283
Faces
:75488 

I then added a graft to Genesis( Cat Tail from Catgirl Genesis on the store) and ran the script and it gives:

Vertices:78341
Faces
:77520 

The cache has the graft in it.

Profile
 
 
Posted: 12 October 2012 08:23 AM   [ Ignore ]   [ # 4 ]
Power Member
Avatar
RankRankRank
Total Posts:  1143
Joined  2009-10-27

Thanks for the example. It turned out that I had a forceCacheUpdate instruction that caused the mesh to reset to the base figure, and so all the geometry information for grafted parts was not accounted.

Now the vertices and facets count match what is expected when some grafted parts are applied to the figure.

However, it seems like getSelectionMap() is able only to collect groups for the base figure: grafted parts are not in the list. And obviously the node children for the base figure won’t include the grafted parts either.

So what is the approach to follow? I mean, do I have to collect information for the base figure, and then do the same for each individual grafted part (which are basically figures themselves) ?

Or there is a way to scan the primary selection and get all the facegroups that belong to it, grafted and not grafted?

Thanks

 Signature 

Blog
FB
YT
Pinterest

Profile
 
 
Posted: 12 October 2012 08:47 AM   [ Ignore ]   [ # 5 ]
Member
Rank
Total Posts:  62
Joined  2004-12-26

If you are just trying to get the face groups they are on the facet mesh.  If you need to not what face group goes to which node that’s more tricky.  I guess it depends what you need the nodes for.  If your just trying to find out what’s hidden visible I’d recommend that you use the facet flags on the mesh with the DZ_HIDDEN_FACE_BIT flag to see if they are visible.

Profile
 
 
Posted: 13 October 2012 03:01 PM   [ Ignore ]   [ # 6 ]
Power Member
Avatar
RankRankRank
Total Posts:  1143
Joined  2009-10-27

Thank you very much: I got rid of the DzSelectionMap and worked directly on the facet groups, and now it seems like geograted figures are working with LAMH.

Image Attachments
Screen_Shot_2012-10-13_at_10.47_.58_PM_.jpg
 Signature 

Blog
FB
YT
Pinterest

Profile