PDA

View Full Version : RayShade() Help



shadersrjj
12-23-2004, 11:11 AM
I have been trying to use rayshade() and have a few questions if anyone
can help:

1..Do you just pass a blank LWShaderAccess? i.e.:

LWShaderAccess mysa;
len = rayShade( pp , dir, mysa );

2..Can anyone think of a way to "tag" a ray so that you know its a recusive
call. I know you can use bounce but I need to know that was my shader that
fired this ray.

3..Is rayshade the only way to find out if a ray hit the object currently being
shaded or another object. Is there anyone way to determine this with raycast?

Many Thanks
RJJ

Lynx3d
12-27-2004, 07:12 AM
1..Do you just pass a blank LWShaderAccess? i.e.:

LWShaderAccess mysa;
len = rayShade( pp , dir, mysa );
Not quite, the SDK says: "A pointer to an empty ShaderAccess structure that will be filled in by the function."
That means you have to call

LWShaderAccess mysa;
len = rayShade( pp , dir, &mysa );

or

LWShaderAccess *mysa = malloc( sizeof(LWShaderAccess) );
len = rayShade( pp , dir, mysa );


2..Can anyone think of a way to "tag" a ray so that you know its a recusive
call. I know you can use bounce but I need to know that was my shader that
fired this ray.
Very good question, and i have no idea as i never used it. :D
Don't think there is. It's not very clear to me what rayshade does anyway, on the one hand it says it only evaluates surface parameters, that would mean no recursive raytracing happens, but then again a shader may use raytracing...Perhaps check if shaders that request raytracing functions get called at all when you rayshade a spot.


3..Is rayshade the only way to find out if a ray hit the object currently being
shaded or another object. Is there anyone way to determine this with raycast?
definitely looks like it.