PDA

View Full Version : Accessing source subdiv/ccmesh geometry



vmonahov
July 2nd, 2008, 18:58
Let's suppose I have ccmesh object and
I want to create a copy of it with modified vertex positions.

Knowing it's name, I would do something like this
to access it's geometric data.


//
// Get object
//
char object_name[32] = "|pTorus1|pTorusShape1";

miTag my_obj_tag = mi_api_name_lookup(object_name);

void *my_obj_data = mi_db_access(my_obj_tag);

miObject *object = (miObject *) my_obj_data;

miObject_type type = object -> type;

mi_db_unpin(my_obj_tag);
//

//
// Access geom data
//
if ( type == miOBJECT_SUBDIVSURFS ) {

miSubdivsurf_list subdiv_list = (object -> geo).subdivsurf_list;

} else if ( type == miOBJECT_POLYGONS ) {
}


miSubdivsurf_list is defined in geoshader.h this way:


typedef struct miSubdivsurf_list {
miGeoIndex no_subdivsurfs;
miTag subdivsurfs;
} miSubdivsurf_list;


As I understand from similar miPolygon_list and miFace_list decalarations,
"miTag subdivsurfs" here should be an array of miSubdivsurf,
but miSubdivsurf is missing in geoshader.h

So, how should I access subdiv geometry data in this case?

bart
July 4th, 2008, 18:01
The subdiv surface internal details are not completely exposed in regular mental ray because mental images sells separately a modeling component application called mental matter. It specializes in manipulation of subdiv surfaces. It is intended as component to a 3D modeling application, and is typically sold to integrators of mental ray.

So, the subdiv surfaces and ccmesh interfaces in mental ray are exposed only to the extent of the 'rendering' functionality, like passing surface description into the mental ray database, attaching approximations and texture coordinates, performing and retrieving tessellations.

What exactly are you trying to do?

For example, since most ccmeshes start out as polygonal objects, you could feed a polygonal object in, and create a ccmesh out of that using mi_api_ccmesh_* functions. I just noticed that these functions are not in the index, but they are in the manual in the Geometric Objects section of the Geometry Shader API.

Also, maybe mi_geoshader_tesselate() could be useful for you.