![]() |
|
|
#1
|
|||
|
|||
|
Hi all, I'm working on a shader to display surface curvature. I'm constructing a sphere of points and casting probe rays similar to an AO shader, but in my case I only want to hit the object the shader is applied to. Here's the shader in action:
![]() The problem is when another object is in the scene and it's within the sample range. I get intersections on other objects I don't want: ![]() Is there a way I can get my shader to ignore all other objects in the scene, without manually turning visibility off in the host app(maya in this case)? I've tried including only samples when the object tag matches, but that just ignores them of course, and leaves me with black areas. Thanks for any suggestions. Dave. |
|
#2
|
|||
|
|||
|
You should use some identifier on your object that you can check on the object returned by trace_probe. For example, attach a specific 'label' (integer) to your object.
|
|
#3
|
|||
|
|||
|
Hi Steve,
yes I have tried something like that, and I can exclude sample rays based on object. The problem is if the sample ray does hit another object then that ray 'stops' and I don't get any sampling on my primary object. I thought about mi_trace_continue but I'm not too sure on it's use, and anyway I'd still have to check on each sample probe and then continue if I hit another object. This could get very time consuming with a lot of samples. What I'm really after, if it's possible, is to just ignore all other objects in the scene. Thanks Dave. |
|
#4
|
|||
|
|||
|
The usual way of excluding certain objects from being hit by ray tracing effects is to flag them accordingly. For example, you would turn off 'cast reflection' and 'cast refraction' on the 'other' objects, so that they are not considered for these type of trace calls. Note, that for mi_trace_probe calls basically all trace flags need to be turned off.
|
|
#5
|
|||
|
|||
|
Thanks for getting back Steve.
I'm guessing it's not possible to turn off those trace flags with my material shader... I think my strategy is to detect when I hit a second object, and 'march' my probe ray towards the primary object until it is clear of the second object and carry on as normal from there. Cheers Dave. |
|
#6
|
|||
|
|||
|
I think you strategy will fail anyway when you have other parts of your mesh 'occluding' the surface..
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
|
All times are GMT +1. The time now is 06:38. |