e4s-sdk/gamedata/shaders/d3d11/fluid_raydata_back.ps.hlsl
2026-06-17 23:06:51 +03:00

13 lines
No EOL
588 B
HLSL

#include "fluid_common_render.hlsli"
void main(PS_INPUT_RAYDATA_BACK input, out float4 output : SV_Target)
{
float sceneZ = sceneDepthTex.SampleLevel(samLinearClamp, float2(input.pos.x / RTWidth, input.pos.y / RTHeight), 0).x;
sceneZ = DepthUnpack.x * rcp(sceneZ - DepthUnpack.y);
// This value will only remain if no fragments get blended on top in the next pass (front-faces)
// which would happen if the front faces of the box get clipped by the near plane of the camera
output.xyz = NEARCLIPPED_PIXEL_RAYPOS;
output.w = min(input.depth, sceneZ);
}