namespace UnityEngine.Experimental.Rendering.HDPipeline
{
class ShadowSetup : IDisposable
{
// shadow related stuff
return true ;
}
public bool GetDirectionalLightData ( CommandBuffer cmd , ShadowSettings shadowSettings , GPULightType gpuLightType , VisibleLight light , HDAdditionalLightData additionalData , AdditionalShadowData additionalShadowData , int lightIndex )
public bool GetDirectionalLightData ( CommandBuffer cmd , ShadowSettings shadowSettings , GPULightType gpuLightType , VisibleLight light , HDAdditionalLightData additionalData , AdditionalShadowData additionalShadowData , int lightIndex , DebugDisplaySettings debugDisplaySettings )
{
var directionalLightData = new DirectionalLightData ( ) ;
return false ;
// Discard light if disabled in debug display settings
if ( ! debugDisplaySettings . lightingDebugSettings . showDirectionalLight )
return false ;
directionalLightData . lightLayers = additionalData . GetLightLayers ( ) ;
public bool GetLightData ( CommandBuffer cmd , ShadowSettings shadowSettings , Camera camera , GPULightType gpuLightType ,
VisibleLight light , HDAdditionalLightData additionalLightData , AdditionalShadowData additionalshadowData ,
int lightIndex , ref Vector3 lightDimensions )
int lightIndex , ref Vector3 lightDimensions , DebugDisplaySettings debugDisplaySettings )
{
var lightData = new LightData ( ) ;
bool applyRangeAttenuation = additionalLightData . applyRangeAttenuation & & ( gpuLightType ! = GPULightType . ProjectorBox ) ;
// Discard light if disabled in debug display settings
if ( lightData . lightType . IsAreaLight ( ) )
{
if ( ! debugDisplaySettings . lightingDebugSettings . showAreaLight )
return false ;
}
else
{
if ( ! debugDisplaySettings . lightingDebugSettings . showPunctualLight )
return false ;
}
// In the shader we do range remapping: (x - start) / (end - start) = (dist^2 * rangeAttenuationScale + rangeAttenuationBias)
if ( applyRangeAttenuation )
{
}
}
public bool GetEnvLightData ( CommandBuffer cmd , Camera camera , ProbeWrapper probe )
public bool GetEnvLightData ( CommandBuffer cmd , Camera camera , ProbeWrapper probe , DebugDisplaySettings debugDisplaySettings )
return false ;
// Discard probe if disabled in debug menu
if ( ! debugDisplaySettings . lightingDebugSettings . showReflectionProbe )
return false ;
var capturePosition = Vector3 . zero ;
// Return true if BakedShadowMask are enabled
public bool PrepareLightsForGPU ( CommandBuffer cmd , HDCamera hdCamera , ShadowSettings shadowSettings , CullResults cullResults ,
ReflectionProbeCullResults reflectionProbeCullResults , DensityVolumeList densityVolumes )
ReflectionProbeCullResults reflectionProbeCullResults , DensityVolumeList densityVolumes , DebugDisplaySettings debugDisplaySettings )
{
using ( new ProfilingSample ( cmd , "Prepare Lights For GPU" ) )
{
// Directional rendering side, it is separated as it is always visible so no volume to handle here
if ( gpuLightType = = GPULightType . Directional )
{
if ( GetDirectionalLightData ( cmd , shadowSettings , gpuLightType , light , additionalLightData , additionalShadowData , lightIndex ) )
if ( GetDirectionalLightData ( cmd , shadowSettings , gpuLightType , light , additionalLightData , additionalShadowData , lightIndex , debugDisplaySettings ) )
{
directionalLightcount + + ;
Vector3 lightDimensions = new Vector3 ( ) ; // X = length or width, Y = height, Z = range (depth)
// Punctual, area, projector lights - the rendering side.
if ( GetLightData ( cmd , shadowSettings , camera , gpuLightType , light , additionalLightData , additionalShadowData , lightIndex , ref lightDimensions ) )
if ( GetLightData ( cmd , shadowSettings , camera , gpuLightType , light , additionalLightData , additionalShadowData , lightIndex , ref lightDimensions , debugDisplaySettings ) )
{
switch ( lightCategory )
{
var probeWrapper = ProbeWrapper . Wrap ( probe , planarProbe ) ;
if ( GetEnvLightData ( cmd , camera , probeWrapper ) )
if ( GetEnvLightData ( cmd , camera , probeWrapper , debugDisplaySettings ) )
{
GetEnvLightVolumeDataAndBound ( probeWrapper , lightVolumeType , worldToView ) ;
if ( stereoEnabled )