Torque3D/Templates/BaseGame/game/data/shaderCache/d653a08573e79020_P.hlsl
2019-03-07 16:23:41 -06:00

52 lines
1.2 KiB
HLSL

//*****************************************************************************
// Torque -- HLSL procedural shader
//*****************************************************************************
// Dependencies:
#include "core/rendering/shaders/torque.hlsl"
// Features:
// Vert Position
// Eye Space Depth (Out)
// Visibility
struct ConnectData
{
float4 vpos : SV_Position;
float4 wsEyeVec : TEXCOORD0;
};
struct Fragout
{
float4 col : SV_Target0;
};
//-----------------------------------------------------------------------------
// Main
//-----------------------------------------------------------------------------
Fragout main( ConnectData IN,
uniform float3 vEye : register(C1),
uniform float4 oneOverFarplane : register(C2),
uniform float visibility : register(C0)
)
{
Fragout OUT;
// Vert Position
// Eye Space Depth (Out)
#ifndef CUBE_SHADOW_MAP
float eyeSpaceDepth = dot(vEye, (IN.wsEyeVec.xyz / IN.wsEyeVec.w));
#else
float eyeSpaceDepth = length( IN.wsEyeVec.xyz / IN.wsEyeVec.w ) * oneOverFarplane.x;
#endif
OUT.col = float4(eyeSpaceDepth.rrr,1);
// Visibility
fizzle( IN.vpos.xy, visibility );
return OUT;
}