Shader "Hidden/HDRenderPipeline/PreIntegratedFGD" { SubShader { Pass { ZTest Always Cull Off ZWrite Off HLSLPROGRAM #pragma vertex Vert #pragma fragment Frag #pragma target 4.5 #pragma only_renderers d3d11 ps4 xboxone vulkan metal #include "ShaderLibrary/Common.hlsl" #include "ShaderLibrary/ImageBasedLighting.hlsl" #include "../../../ShaderVariables.hlsl" struct Attributes { uint vertexID : SV_VertexID; }; struct Varyings { float4 positionCS : SV_POSITION; float2 texCoord : TEXCOORD0; }; Varyings Vert(Attributes input) { Varyings output; output.positionCS = GetFullScreenTriangleVertexPosition(input.vertexID); output.texCoord = GetFullScreenTriangleTexCoord(input.vertexID); return output; } float4 Frag(Varyings input) : SV_Target { // These coordinate sampling must match the decoding in GetPreIntegratedDFG in lit.hlsl, i.e here we use perceptualRoughness, must be the same in shader float NdotV = input.texCoord.x; float perceptualRoughness = input.texCoord.y; float3 V = float3(sqrt(1 - NdotV * NdotV), 0, NdotV); float3 N = float3(0.0, 0.0, 1.0); // Pre integrate GGX with smithJoint visibility as well as DisneyDiffuse float4 preFGD = IntegrateGGXAndDisneyFGD(V, N, PerceptualRoughnessToRoughness(perceptualRoughness)); return float4(preFGD.xyz, 1.0); } ENDHLSL } } Fallback Off }