nmn Posted October 6, 2009 Share Posted October 6, 2009 Hi everyone, hope you're all doing well, I have a small question about transparency, in fact the thing is that i want to have an object that becomes more opaque the more it has thickness, in fact i tried to do it using the "ray hit" vex node to drive the transparency but without success ... and here comes a second question into my mind, if i use the ray hit for example and i have a refraction and reflection depths set to a certain number how will it behave, i mean how many times will it be called, when will it be called and how do i know what is its input at an instant t Thank you for your help Regards Quote Link to comment Share on other sites More sharing options...
Serg Posted October 10, 2009 Share Posted October 10, 2009 Hi everyone, hope you're all doing well, I have a small question about transparency, in fact the thing is that i want to have an object that becomes more opaque the more it has thickness, in fact i tried to do it using the "ray hit" vex node to drive the transparency but without success ... and here comes a second question into my mind, if i use the ray hit for example and i have a refraction and reflection depths set to a certain number how will it behave, i mean how many times will it be called, when will it be called and how do i know what is its input at an instant t Thank you for your help Regards You were on the right track with the ray hit node. Remember that RayHit will only return a value if the distance to the geometry you are testing against is <= to the length of the vector connected to the "dir" input. You need to multiply the "T" output from the "fresnel" node with a float value (your Max Distance) before plugging into the RayHit's "dir"... so that you may control the maximum distance the RayHit will test for... Then you need to turn the "dist" output into something useful. What I normally do is use a FitRange to remap the value to the 0 to 1 range (just plug your Max Distance into source max). Then multiply this by the opacity parm, or plug into Kt or whatever. You Max Distance parameter will simply control how far you can see through the surface. But, I'm assuming you just want to learn to use the rayhit, because the "Trace" node already deals with thickness attenuation. Just go to the "Interior Color" tab and increase the Attenuation Density and color. Hope this helps S Quote Link to comment Share on other sites More sharing options...
nmn Posted October 13, 2009 Author Share Posted October 13, 2009 You were on the right track with the ray hit node. Remember that RayHit will only return a value if the distance to the geometry you are testing against is <= to the length of the vector connected to the "dir" input. You need to multiply the "T" output from the "fresnel" node with a float value (your Max Distance) before plugging into the RayHit's "dir"... so that you may control the maximum distance the RayHit will test for... Then you need to turn the "dist" output into something useful. What I normally do is use a FitRange to remap the value to the 0 to 1 range (just plug your Max Distance into source max). Then multiply this by the opacity parm, or plug into Kt or whatever. You Max Distance parameter will simply control how far you can see through the surface. But, I'm assuming you just want to learn to use the rayhit, because the "Trace" node already deals with thickness attenuation. Just go to the "Interior Color" tab and increase the Attenuation Density and color. Hope this helps S thank you Serg for this detailed explanation, I will try your suggestions and play with it as soon as i have a little bit of time, i tried the attenuation in the trace node, and i feel we have to really go to high values to begin seeing some result, or am i doing something wrong ? and what about the number of calculations from my first post ? Thanks again regards Quote Link to comment Share on other sites More sharing options...
Serg Posted October 14, 2009 Share Posted October 14, 2009 i tried the attenuation in the trace node, and i feel we have to really go to high values to begin seeing some result, or am i doing something wrong ? and what about the number of calculations from my first post ? Your not doing anything thing wrong re the attenuatuation. It's just one of those things that would work better it it weren't physically correct. I find it much easier to specify a distance where the internal fog becomes completely opaque, and a power function so we can play with the falloff curve. The problem with using the rayhit is that it will be horribly inefficient, compared to calculating it for free in the Gather function that the "trace" node uses (requires a bit of vex coding to achieve the functionality above). And you will need to deal with aliasing by multi-sampling it in a For-Loop or using the Raytrace Renderer. That's not to say you shouldn't use it. I got away with using it (for reflection occlusion and depth stuff) for ages... until I learned to get to grips with the gather loop in code and a wee bit of VEX in general. Re the question about how many times it will be sampled. It will run every time a ray hits it regardless of the ray depth. It behaves no differently than a constant color for example. Afaik cheers S Quote Link to comment Share on other sites More sharing options...
nmn Posted October 14, 2009 Author Share Posted October 14, 2009 Thank you for this very useful explanation Serg Cheers Quote Link to comment Share on other sites More sharing options...
DaJuice Posted October 14, 2009 Share Posted October 14, 2009 Have you had a look at this thread too nmn? Quote Link to comment Share on other sites More sharing options...
nmn Posted October 17, 2009 Author Share Posted October 17, 2009 Thanks for pointing that out DaJuice, it helped in clearing out some things for me about the gather function (Y) Cheers Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.