|
|
|
|
|
|
//------------------------------------------------------------------------------------- |
|
|
|
|
|
|
|
HLSLPROGRAM |
|
|
|
|
|
|
|
|
|
|
|
#pragma target 4.5 |
|
|
|
#pragma only_renderers d3d11 ps4 xboxone vulkan metal switch |
|
|
|
//#pragma enable_d3d11_debug_symbols |
|
|
|
|
|
|
//------------------------------------------------------------------------------------- |
|
|
|
// End Defines |
|
|
|
//------------------------------------------------------------------------------------- |
|
|
|
|
|
|
|
|
|
|
|
#include "HDRP/ShaderVariables.hlsl" |
|
|
|
#ifdef DEBUG_DISPLAY |
|
|
|
#include "HDRP/Debug/DebugDisplay.hlsl" |
|
|
|
|
|
|
|
|
|
|
// TODO: positionSS is SV_Position, graph input expects screenPosition to be 0..1 across the active viewport (?) |
|
|
|
$SurfaceDescriptionInputs.screenPosition: output.screenPosition = input.positionSS; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$SurfaceDescriptionInputs.vertexColor: output.vertexColor = input.color; |
|
|
|
|
|
|
|
return output; |
|
|
|
|
|
|
|
|
|
|
builtinData.opacity = surfaceDescription.Alpha; |
|
|
|
builtinData.bakeDiffuseLighting = SampleBakedGI(fragInputs.positionWS, bentNormalWS, fragInputs.texCoord1, fragInputs.texCoord2); // see GetBuiltinData() |
|
|
|
|
|
|
|
|
|
|
|
// It is safe to call this function here as surfaceData have been filled |
|
|
|
// We want to know if we must enable transmission on GI for SSS material, if the material have no SSS, this code will be remove by the compiler. |
|
|
|
BSDFData bsdfData = ConvertSurfaceDataToBSDFData(surfaceData); |
|
|
|
|
|
|
builtinData.bakeDiffuseLighting += SampleBakedGI(fragInputs.positionWS, -fragInputs.worldToTangent[2], fragInputs.texCoord1, fragInputs.texCoord2) * bsdfData.transmittance; |
|
|
|
} |
|
|
|
|
|
|
|
builtinData.emissiveIntensity = 1.0f; |
|
|
|
$SurfaceDescription.Emission: builtinData.emissiveColor = surfaceDescription.Emission; |
|
|
|
builtinData.velocity = float2(0.0, 0.0); |
|
|
|
#ifdef SHADOWS_SHADOWMASK |
|
|
|
|
|
|
//------------------------------------------------------------------------------------- |
|
|
|
|
|
|
|
ENDHLSL |
|
|
|
} |
|
|
|
} |