carstenkolve Posted September 18, 2009 Share Posted September 18, 2009 Hi, I'm quite new to Mantra shading, so please forgive me if this is sort of obvious. I'd like to plug together a shader that renders geo based on a custom attribute rather than the actual order when tracing from the eye. Imagine having 3 planes on top of each other, each having an attribute that indicates the order, whatever has the highest order does get rendered. I want to use this to correct minor penetrations of geo that I can't resolve on the sop level. So my thought was to use a "gather loop" to trace from surface "P" along "I" until I hit the next surface, get the order attr on the hit point and then decide what to do with it, if its used, use all the parameters at that P to shade the initial P. Maybe even doing a nested gather loop to gather until there is nothing more to gather (stepping through the micro poly stack). All surfaces are fully opaque and I'm using raytracing. Now in theory this sounds fine (at least to me) - but I'm having a but of a problem building it in a shading network. I don't get any information back at all. - What am I missing? Is it something fundamentally wrong, or just some setting I forgot to make? I've attached a demo scene to illustrate my shader... it is simplified and should just retrieve the color of the first underlying geo. Cheers! Carsten sortingShader_001.hip Quote Link to comment Share on other sites More sharing options...
carstenkolve Posted September 21, 2009 Author Share Posted September 21, 2009 Heya, a bit of progress and a new problem :-) Turns out the gather loop seemed to trace right through all of my geo and hence I'd always get the background image and not the last hit surface. So I modified the shader with a conditional part that checks if we are actually hitting geometry or not. This works fine, however I do get this nasty black line where the surfaces are close. Modifying the bias on the rayhit does have an effect on the problem, but it only changes the appearance of the artifact. Is there a better way of checking the if my rays do hit the surface? Cheers, Carsten sortingShader_002.hip Quote Link to comment Share on other sites More sharing options...
carstenkolve Posted September 21, 2009 Author Share Posted September 21, 2009 Ok - sorted than one out as well. T'was simply a matter of setting the bias on the gather loop the same than for the rayhit... Now on to the actual functionality... Quote Link to comment Share on other sites More sharing options...
carstenkolve Posted September 28, 2009 Author Share Posted September 28, 2009 ok, just a small update with a few results...here a screenshot of the shader doing its thing, some static scales on a snake (well, tube) first rendered without the shader clearly showing all the penetrations, then the result with the shader applied - it brings the sample to the front based on an "order" attribute and makes the penetrations dissapear you can light it with a custom illuminance loop - haven't looked into shadows, motionblur etc, yet a thing I've learned is that hooking up loops with lots of variables is a pain, should have a look into writing the vex code instead sortingShaderExample_001.hip 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.