Posted By: jumpman
Depth Shader with Alpha transparency information - 09/04/17 05:48
Hello, Im using the depth.fx file to generate a depth map for my scene, to be used for post processing.
Is there a shader I can apply to the camera/.fx that also takes into account entity alpha maps? I use a shader that cuts off alpha information as well as PASS_SOLID which looks nice. But I want a depth shader that takes this into account, not just polygons.
What can I add to this shader to make it account for alpha transparency?
Is there a shader I can apply to the camera/.fx that also takes into account entity alpha maps? I use a shader that cuts off alpha information as well as PASS_SOLID which looks nice. But I want a depth shader that takes this into account, not just polygons.
What can I add to this shader to make it account for alpha transparency?
Code:
//////////////////////////////////////////////////// // Depth rendering shader // Copyright (c) 2007 Conitec. All rights reserved. //////////////////////////////////////////////////// // Application fed data: const float4x4 matWorldViewProj; //////////----------------------- //////////------------------ void DepthVS (in float4 InPos : POSITION, out float4 OutPos : POSITION, out float OutDepth: TEXCOORD0) { // Output the transformed position OutPos = mul(InPos,matWorldViewProj); // Output the scene depth OutDepth = (OutPos.z)*.002; // OutDepth = OutPos.z; //OutDepth -= OutDepth; } float4 DepthPS( in float InDepth: TEXCOORD0 ) : COLOR0 { // Output the scene depth to a R32 floating point texture // return float4( InDepth, 0.0, 0.0, 1.0 ); return float4(InDepth, 0.0, 0.0, 1.0 ); } technique DepthTechnique { pass p0 { Lighting = False; VertexShader = compile vs_2_0 DepthVS(); PixelShader = compile ps_2_0 DepthPS(); } }