Accessing bump maps, specular maps, etc


I'm making an export plugin and I want to access the various textures (bump, specular, etc), as I understand it I need to use DzDefaultMaterial::getBumpMap and such.

In pseudo code (with error checking removed for brievity) I have something like this:

int numNodes = dzScene->getNumSelectedNodes();for( int i = 0 ; i < numNodes ; ++i ){	DzVertexMesh* pVtxMesh = dzScene->getNode( i )->getObject()->getCachedGeom(); //using getCachedGeom here because I'm making an alembic-like exporter, I need transformed vertices, not T-pose	DzFacetMesh* pMesh = qobject_cast<DzFacetMesh*>(pVtxMesh);	ExportMesh( pMesh );	DzShape* pShape = dzScene->getNode( i )->getObject()->getShape( 0 );	int numMaterials = pShape->getNumMaterials();		for( int j = 0 ; j < numMaterials ; ++j )	{		DzMaterial* pMtl = pShape->getMaterial( j );		DzTexture* pAlbedoMap = pMtl->getColorMap(); //This one works fine !				if( pAlbedoMap )			//Do stuff with albedo map		DzDefaultMaterial* pDfltMtl = qobject_cast<DzDefaultMaterial*>(pMtl); //Always return NULL :(		if( !pDfltMtl )			continue;		DzTexture* pBumpMap = pDfltMtl->getBumpMap();		if( pBumpMap )			//Do stuff with bump map	}}

Either I can't get a (non-null) DzDefaultMaterial, either I get one (by accessing sub-materials through DzMaterial::getMaterial(0) for exemple) but then DzDefaultMaterial::getBump return NULL.

Note: for my tests, I'm using vanilla "genesis8 basic female", which DOES use bump maps.

I'm new to Daz SDK, but quite frankly, I find it quite confusing (for example why is there a hierarchy of materials accessible with DzMaterial::getMaterial(int which) ? ) and very much lacking in term of documentation.

Can you please point me in the right direction ?!




  • shoei321shoei321 Posts: 113
    edited April 2018

    I would assume your cast to DzDefaultMaterial returns null because the material simply isn't one.   I believe that DzDefaultMaterial is really only included as a reference implementation of DzMaterial, and in most cases actual materials don't inherit from it. 

    You can enumerate the properties of the base DzMaterial with the pseudo-code below -- among these properties I'm sure you'll find what you're looking for.   Many classes in the SDK extend DzElement, which provides among other things the ability to assign a set of DzProperty objects

    for (int i = 0; i < mat->getNumProperties(); i++) {
        DzProperty* prop = mat->getProperty(i);
       qDebug() << "prop " << i << " " << prop->getName();
        // Cast prop to DzFloatProperty, DzImageProperty, etc


    Post edited by shoei321 on
Sign In or Register to comment.