Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- float3 PS_Gbuffer(float4 pos : SV_POSITION, float2 uv : TEXCOORD) : SV_TARGET {
- float z = ReShade::GetLinearizedDepth(uv);
- float dx = BUFFER_RCP_WIDTH;
- float dy = BUFFER_RCP_HEIGHT;
- float dzdx = (ReShade::GetLinearizedDepth(uv + float2(dx, 0.0)) - ReShade::GetLinearizedDepth(uv + float2(-dx, 0.0))) / (2.0 * dx);
- float dzdy = (ReShade::GetLinearizedDepth(uv + float2(0.0, dy)) - ReShade::GetLinearizedDepth(uv + float2(0.0, -dy))) / (2.0 * dy);
- float3 d = float3(dzdx, -dzdy, z);
- float3 n = normalize(d);
- return n;
- /*float3 lightDirection = float3(1.0, -2.0, 3.0);
- float shading = 0.5 + 0.5 * dot(n, normalize(lightDirection));
- return shading;*/
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement