Hi Guys,
I'm having a problem with my soft particles.
They look great and nice and "soft" and blend into the floor/geometry but since they use the depthbuffer to determine how soft/faded they are then they vanish if you go too far away and are more faint the further you are away.
This looks a bit weird if you look at a misty graveyard from the distance its "spooky mist" free and when you get closer to it is covered in the stuff.
Hopefully someone has a fix for my shader.
PixelShaderOutput output;
output.Color = tex2D(texSampler, input.UV);
//sample depth from depth map
//map the clip space coords (input.Position) to texture space
float2 depthTex = input.Pos.xy / input.Pos.w;
depthTex.y = -depthTex.y;
depthTex.xy = depthTex.xy / 2 + 0.5;
float depthFromMap = tex2D(DepthMapSampler, depthTex).r;
float depthOfPixel = input.Depth.x; //input.Depth.y;
// this makes the particle soft or not
float scale = 20.0f;
float4 fade=saturate(((depthFromMap-depthOfPixel))*scale);
output.Color.rbga *= fade;
return output;
}
Thanks