#if SHADERPASS != SHADERPASS_DISTORTION #error SHADERPASS_is_not_correctly_define #endif #include "VertMesh.hlsl" PackedVaryingsType Vert(AttributesMesh inputMesh) { VaryingsType varyingsType; varyingsType.vmesh = VertMesh(inputMesh); return PackVaryingsType(varyingsType); } #ifdef TESSELLATION_ON PackedVaryingsToPS VertTesselation(VaryingsToDS input) { VaryingsToPS output; output.vmesh = VertMeshTesselation(input.vmesh); return PackVaryingsToPS(output); } #include "TessellationShare.hlsl" #endif // TESSELLATION_ON float4 Frag(PackedVaryingsToPS packedInput) : SV_Target { FragInputs input = UnpackVaryingsMeshToFragInputs(packedInput.vmesh); // input.positionSS is SV_Position PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw); UpdatePositionInput(input.positionSS.z, input.positionSS.w, input.positionWS, posInput); float3 V = GetWorldSpaceNormalizeViewDir(input.positionWS); // Perform alpha testing + get distortion SurfaceData surfaceData; BuiltinData builtinData; GetSurfaceAndBuiltinData(input, V, posInput, surfaceData, builtinData); float4 outBuffer; // Mark this pixel as eligible as source for distortion EncodeDistortion(builtinData.distortion, builtinData.distortionBlur, true, outBuffer); return outBuffer; }