Jump to content

Vray Procedural


Recommended Posts

Hi There,

I have been trying to figure out how to access information about objects containing procedurals.

I am able to find the name of the object with:

pObjHandle = VRAY_PointCluster::queryObject(pObjName);

objName = VRAY_PointCluster::queryObjectName(pObjHandle);

objRootName = VRAY_PointCluster::queryRootName();

Geometry samples work as well:

int geoSamples = queryGeometrySamples(pObjHandle);

cout << "\nGEO SAMPLES:" << geoSamples;

However when I go to do something like this mantra crashes:

pObj_geo = queryGeometry(pObjHandle, geoSamples);

cout << "\nNUM POINTS:" << pObj_geo->points().entries();

Are there any examples out there about how to access information about geometry

in a scene? I am looking to get at anything that a gdp would provide a sop.

It says that Mantra uses a subclass of the GU_Detail so I have a feeling that not all

the same info is available...?

Any help would be great ...

Thanks,

Phillip

Link to comment
Share on other sites

Hi There,

I have been trying to figure out how to access information about objects containing procedurals.

I am able to find the name of the object with:

pObjHandle = VRAY_PointCluster::queryObject(pObjName);

objName = VRAY_PointCluster::queryObjectName(pObjHandle);

objRootName = VRAY_PointCluster::queryRootName();

Geometry samples work as well:

int geoSamples = queryGeometrySamples(pObjHandle);

cout << "\nGEO SAMPLES:" << geoSamples;

However when I go to do something like this mantra crashes:

pObj_geo = queryGeometry(pObjHandle, geoSamples);

cout << "\nNUM POINTS:" << pObj_geo->points().entries();

Are there any examples out there about how to access information about geometry

in a scene? I am looking to get at anything that a gdp would provide a sop.

It says that Mantra uses a subclass of the GU_Detail so I have a feeling that not all

the same info is available...?

Any help would be great ...

Thanks,

Phillip

There might be a couple of reasons that queryGeometry might return a null pointer... Perhaps you might want to check before dereferencing :-)

I believe you can get a null ptr back if

a) You are querying a null object (transform space)

b-) The handle is invalid

c) No geometry was defined for the object

d) The object is bound to a procedural (rather than geometry)

I think there are probably other cases.

Link to comment
Share on other sites

I believe my handle is valid, since I am able to print the name of the obj.

Also, I have tried querying both the obj that has the procedural attached,

as well as a separate geo node that contains geometry.

Is there an example of using:

const GU_Detail *queryGeometry(void *object_handle, int sample);

Link to comment
Share on other sites

I believe my handle is valid, since I am able to print the name of the obj.

Also, I have tried querying both the obj that has the procedural attached,

as well as a separate geo node that contains geometry.

Is there an example of using:

const GU_Detail *queryGeometry(void *object_handle, int sample);

I've thrown one together pretty quickly.

This duplicates the source geometry specified on the procedural arguments, but then transforms the geomety to the bounding box specified on the procedural.

It's pretty dirt simple, but it seems to work for me.

You should see the green triangle as the source object and the red triangle which was duplicated by the procedural. You'll probably also see some debug stuff that I left in :-)

SimpleDup.tar.gz

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...