PDA

View Full Version : 3DS Max, DirectX Material, and depth maps


ObsidianPC
01-27-2009, 05:54 PM
Hi all,

I've been trying to write a post-effect shader that applies fog to the 3dS Max window over other objects rendered.

I can make a post effect show up fine, and I've been able to sample the image that the scene has already rendered. I can't seem to get a Depth Map though - I set up a sampler for it and it seems to be always filled with black.

Has anyone managed to sample the scene depth buffer from HLSL yet?


Alex

kees
01-27-2009, 06:24 PM
Do you have a second technique in each shader for each object that outputs the pixel depth for that objects pixels?

Or what is your approach?

ObsidianPC
01-28-2009, 10:12 PM
First, I am trying to get a depth-based post- effect (just fog, for starters) to affect the entire scene.

Currently I'm trying to do 1 shader as a post effect, with just the default materials from Max applied to the actual objects. I saw that post_output.fx can grab the rendered scene as an image and work with it. I was hoping it could also grab the scene's depth buffer.

I couldn't get that to work. I tried modifying the post_output.fx demo effect to output the depth, but I always get black.

Now I am toying with having shaders applied to each object that output depth, and a post-effect to use it later, but I don't know how to make the output depth texture shared between the different material instances and the post-effect.

I can post my hax0red version of post_output.fx if it helps. I'd appreciate anything that might point me in the right direction.

CGTalk Moderation
01-28-2009, 10:12 PM
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.