mattvfx Posted December 9, 2013 Share Posted December 9, 2013 is there any way of doing a rayswitch in pbr? there is a thread that contains some examples of rayswitch but only works with raytrace thank you in advance Quote Link to comment Share on other sites More sharing options...
dennis.albus Posted November 28, 2014 Share Posted November 28, 2014 I know I am quite late to the party, but I just had to deal with this problem myself and luckily found a solution . It works for both PBR and Raytracing (when using the pbrlighting nodes or compute lighting).It uses some undocumented ray labels that you can import into your shader. Those can be found in pbrlighting.vfl. Always worthwhile to skim through those source files and discover something new. $HFS/houdini/vex/Surface/pbrlighting.vfl (line 227-237) if (trace(hitP, hitI, hitTime, "SID", path_sid, "angle", filter_angle, "ray:length", hitLength, "Cf", hitLight, "Ce", hitEmission, "send:diffuselevel", dlevel, "send:reflectlevel", rlevel, "send:refractlevel", tlevel, "send:volumelevel", vlevel, "send:pathstate", pathstate)) rayswitch.hip 1 Quote Link to comment Share on other sites More sharing options...
dennis.albus Posted November 28, 2014 Share Posted November 28, 2014 (edited) This version works even better. This code is used to switch between the different labels: int pathstate; string label; rayimport("pathstate", pathstate); label = bouncelabel(pathstate); if (getraylevel() == 0) { ray = 0;} // primary visibility else if (label == "reflect") { ray = 1;} else if (label == "refract") { ray = 2;} else if (label == "diffuse") { ray = 3;} rayswitch_improved.hip Edited November 28, 2014 by dennis.albus 5 Quote Link to comment Share on other sites More sharing options...
glassman3d Posted July 8, 2015 Share Posted July 8, 2015 amazing thanks! been trying to get refracted IDs working for ages in pbr Quote Link to comment Share on other sites More sharing options...
tricecold Posted August 3, 2015 Share Posted August 3, 2015 hi there; not so related maybe but I have a question. I have a single object with a ramp lets say as Cd attribute, black to white. its a glass object and has two spheres behind it red and green. Would it be possible to tell to shader to rfract and relect white areas for object 1 only and black areas for object 2. 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.