View Full Version : Mental Ray : acquiring child attributes
06 June 2005, 07:46 AM
Hi everyone ,
what i would like to do is to query teh attribute of a child object's shader, for example : i want to shhot a reflection ray and acquire the Opacity of reflected object instead of its color .
I think i shiould use the mi_call_shader function instead of mi_call_material , but does anyone knows how to access the child shader parameters ?
Thank you very much
06 June 2005, 01:12 PM
the color you get from the hit obj
is the result of evaluating the material
on the other end of the ray. the opacity
is not for what I know a property in the
state that you can query; when you get
the color of your obj the opacity is 'embeded',
the color you get will be the result of calculating
also the opacity if something in the called
shader is set to do this.
if you find the way there's an approach where
the opacity is something like a property and
can be queried with specialized functions. this
should work only in rasterizer mode, where the
opacity is composed with the color for the current
shaded point. the functions are mi_opacity_set
and mi_opacity_get. until the next point the
opacity will be separeted from the color output
and querable with the mi_opacity_get function.
not last you could also call the shadow shader
of the hit obj to get a way to your opacity.
to the question, -how to access the child shader
parameters ? ehehe... big effort. you can't
use any of the mi_eval as they works only for the
current shaded point. you should get the tag of
the hit mat, and begin traversing the scene
database until you find the shader you need.
there source it as a miFunction and go through
its members to get what you need. take care
that parameters can't be invoked by name and
you'll need to access the parameter block, and
know where your parameter is by looking at the
param_size and at the ghost offset.
06 June 2005, 11:09 AM
opacity was just an example. I thought it was a lot easier in mray to query any kind of attribute going down in the state hierarchy , just setting state to child and shooting a mi_call_shader with your custom parameter's name ( something like re renderMan \attribute\ call ) but i see it is much more complex. Anyway i will try to apply the solution you suggest me at the end of your reply , as soon as i understand it :).
06 June 2005, 11:09 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.