View Full Version : secondary depth shader

04 April 2006, 01:12 AM
hey all!
wrote a little mental ray shader tonight, after finally getting an idea for a shader. the basic idea is to get a depth map for reflections, so you hook it into a surface, like a shiny floor or something, and it renders the depthmap after it reflects onto that surface, so itīs like "secondary depth" or something, to use in compositing, for blurry reflections and stuff like that. probably thereīs already a standard way to do this, or a shader already, but now youīve got another one! :)

download (

donīt laugh at my screenshots, theyīre for illustration, not for a cg award :P

the shader applied to a simple plane

should work on any geometry, like this deformed grid

take a peek and tell me if you find any nasty bugs or have any suggestions

04 April 2006, 08:07 AM
but, you are missing a maya script file in the zip? cant see it in maya..thus cant create it?

04 April 2006, 09:01 AM

04 April 2006, 09:46 AM
on my system it's available from Assign New Material directly, and in the Hypershader in Create -> mental ray Materials, so i didnīt make any script for it, sorry.
iīll be closing this thread in a little while though, since this shader seems to be redundant.


04 April 2006, 09:51 AM
puppet's shaders are nice but they come in 1 pack, i would rather use yours to get that exact pass than have 2 mil nodes installed that i dont even need.
with all do respect puppet, thanks for the shaders but 1 pack is.. a bit annoying.

oh and i see it, you are right. no need for the script, i didnt spot it the first time due to..too many useless shaders in there all the p_ ones :P.

04 April 2006, 10:15 AM
to Gal:

If you don't need other shaders just comment it in mi file, it's not problem.
Single pack is better than have millions of dll and mi files installed :)

04 April 2006, 11:07 AM
i personally prefer simple shaders that do one thing, instead of one universal shader to solve it all, so iīm happy you find it useful.

because of stupidity i didnīt check transparency of objects, iīll fix it tonight and put up a new version.


04 April 2006, 06:22 PM
perhaps I'm mistaken here, but don't reflection and refraction happen at the surface of the object doing it? e.g. if I'm looking at a drop of water with other leaves out of focus in the background, the leaves refracted through the drop will typically be in focus. Wouldn't you get some strange effects by calculating the reflection into the depth?
Insight appreciated.



04 April 2006, 05:17 AM

04 April 2006, 07:18 AM
i wanted the secondary depth map to fake blurry reflections like the one in the floor here

[not my image, just a google image example]

thatīs about what i expect you could fake without too much hassle

hope that clarifies the intention of the shader!


CGTalk Moderation
04 April 2006, 07:18 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.