Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Go Back   mental images Forum > mental ray > mental ray - Shaders > mr Shaders - Advanced

Reply
 
Thread Tools Display Modes
  #1  
Old June 7th, 2010, 18:29
davegreenwood davegreenwood is offline
mi Dev Forum User
 
Join Date: Jun 2008
Posts: 20
Default mi_trace_probe detect self only

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.
Reply With Quote
  #2  
Old June 9th, 2010, 09:22
steve steve is offline
Super Moderator
 
Join Date: Jan 2009
Location: Berlin/Germany
Posts: 178
Default

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.
Reply With Quote
  #3  
Old June 9th, 2010, 10:33
davegreenwood davegreenwood is offline
mi Dev Forum User
 
Join Date: Jun 2008
Posts: 20
Default

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.
Reply With Quote
  #4  
Old July 9th, 2010, 16:05
steve steve is offline
Super Moderator
 
Join Date: Jan 2009
Location: Berlin/Germany
Posts: 178
Default

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.
Reply With Quote
  #5  
Old July 9th, 2010, 16:38
davegreenwood davegreenwood is offline
mi Dev Forum User
 
Join Date: Jun 2008
Posts: 20
Default

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.
Reply With Quote
  #6  
Old July 17th, 2010, 20:59
maxt maxt is offline
mi Dev Forum User
 
Join Date: Nov 2008
Posts: 54
Default

I think you strategy will fail anyway when you have other parts of your mesh 'occluding' the surface..
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT +1. The time now is 06:38.