Original Post
I'm trying to replicate this really interesting rendering technique: ">
Basically what i'm trying to do is; render a 2D sprite with a depthmap, making it "2.5D" or pseudo-3D.
I'm using XNA and its built in SpriteBatch, but with a custom pixel shader. Here's a simplified version of my shader:
Any help will be very appreciated!
Basically what i'm trying to do is; render a 2D sprite with a depthmap, making it "2.5D" or pseudo-3D.
I'm using XNA and its built in SpriteBatch, but with a custom pixel shader. Here's a simplified version of my shader:
sampler TextureSampler : register(s0); sampler DepthSampler : register(s1); void PS(in float2 UV : TEXCOORD0, inout float4 Color : COLOR0, out float Depth : DEPTH) { Color.rgb = tex2D(TextureSampler, UV); Depth = tex2D(DepthSampler, UV).r; // here the depth of each pixel is set (?) } technique SpriteBatch { pass { PixelShader = compile ps_2_0 PS(); } }Could this way of setting the depth value of each pixel do the trick? If so, how? I've tried fiddling around with DepthBufferWriteEnable settings, but i can't get it to work. I'm not entirely sure how the depth buffer works thou...Any help will be very appreciated!