PDA

View Full Version : Detect Raytrace depth


Saturn
July 3rd, 2005, 12:10
hi everyone.

i got a question avout raytrace depth. Is there anyway to detect when a ray reach this limit ?
MR return black ( miFlase in fact ) or environement when there is no intersection when a ray reach reflection/refraction limit, the idea is to replace the black by a color chosen by a user.

bart
July 4th, 2005, 00:26
The state has two variables reflection_level and refraction_level.

In the online doc for mental ray, it is in

Using and Writing Shaders>State Variables>Rays

bart
July 4th, 2005, 00:44
And in Using and Writing Shaders>State Variables>Options,

you will see reflection_depth, refraction_depth, and trace_depth.

So for example, you typically access trace_depth by

state->options->trace_depth

ctrl_studio
July 7th, 2005, 22:17
the idea is to replace the black by a color chosen by a user.
could you not just see if the reflection function
returns false and do something there?

mi_trace_reflection(&ref, state, &mydir)? *output = ref: *output = mycol;

or with limits...

state->reflection_level > limit? *output = mycol: mi_trace_reflection...


max