|
|
|
|
|
|
[Range(0.0f, 1.0f)] |
|
|
|
public float specularGlobalDimmer = 1.0f; |
|
|
|
|
|
|
|
public enum TileDebug : int |
|
|
|
public enum TileClusterDebug : int |
|
|
|
{ |
|
|
|
None, |
|
|
|
Tile, |
|
|
|
Cluster, |
|
|
|
FeatureVariants |
|
|
|
}; |
|
|
|
|
|
|
|
public enum TileClusterCategoryDebug : int |
|
|
|
None = 0, Punctual = 1, Area = 2, AreaAndPunctual = 3, Environment = 4, EnvironmentAndPunctual = 5, EnvironmentAndArea = 6, EnvironmentAndAreaAndPunctual = 7, |
|
|
|
FeatureVariants = 8 |
|
|
|
}; //TODO: we should probably make this checkboxes
|
|
|
|
Punctual = 1, |
|
|
|
Area = 2, |
|
|
|
AreaAndPunctual = 3, |
|
|
|
Environment = 4, |
|
|
|
EnvironmentAndPunctual = 5, |
|
|
|
EnvironmentAndArea = 6, |
|
|
|
EnvironmentAndAreaAndPunctual = 7 |
|
|
|
}; |
|
|
|
|
|
|
|
public TileSettings() |
|
|
|
{ |
|
|
|
|
|
|
public void RenderLightingDebug(HDCamera hdCamera, CommandBuffer cmd, RenderTargetIdentifier colorBuffer, DebugDisplaySettings debugDisplaySettings, bool renderOpaque) |
|
|
|
{ |
|
|
|
LightingDebugSettings lightingDebug = debugDisplaySettings.lightingDebugSettings; |
|
|
|
if (lightingDebug.tileDebugByCategory == TileSettings.TileDebug.None) |
|
|
|
return; |
|
|
|
if (lightingDebug.tileClusterDebug == TileSettings.TileClusterDebug.None || |
|
|
|
renderOpaque && lightingDebug.tileClusterDebug == TileSettings.TileClusterDebug.Cluster || // Cluster if for transparent
|
|
|
|
!renderOpaque && lightingDebug.tileClusterDebug == TileSettings.TileClusterDebug.Tile) // Tile is for opaque
|
|
|
|
return ; |
|
|
|
using (new ProfilingSample(cmd, "Tiled Lighting Debug", HDRenderPipeline.GetSampler(CustomSamplerId.TPTiledLightingDebug))) |
|
|
|
using (new ProfilingSample(cmd, "Tiled/cluster Lighting Debug", HDRenderPipeline.GetSampler(CustomSamplerId.TPTiledLightingDebug))) |
|
|
|
bool bUseClusteredForDeferred = !renderOpaque; |
|
|
|
|
|
|
|
int w = hdCamera.camera.pixelWidth; |
|
|
|
int h = hdCamera.camera.pixelHeight; |
|
|
|
int numTilesX = (w + 15) / 16; |
|
|
|
|
|
|
Vector2 mousePixelCoord = Input.mousePosition; |
|
|
|
#if UNITY_EDITOR
|
|
|
|
#if UNITY_EDITOR
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
if (lightingDebug.tileDebugByCategory == TileSettings.TileDebug.FeatureVariants) |
|
|
|
if (lightingDebug.tileClusterDebug == TileSettings.TileClusterDebug.FeatureVariants) |
|
|
|
m_DebugViewTilesMaterial.SetInt(HDShaderIDs._ViewTilesFlags, (int)lightingDebug.tileDebugByCategory); |
|
|
|
m_DebugViewTilesMaterial.SetInt(HDShaderIDs._ViewTilesFlags, (int)lightingDebug.tileClusterDebugByCategory); |
|
|
|
m_DebugViewTilesMaterial.EnableKeyword(bUseClusteredForDeferred ? "USE_CLUSTERED_LIGHTLIST" : "USE_FPTL_LIGHTLIST"); |
|
|
|
m_DebugViewTilesMaterial.DisableKeyword(!bUseClusteredForDeferred ? "USE_CLUSTERED_LIGHTLIST" : "USE_FPTL_LIGHTLIST"); |
|
|
|
m_DebugViewTilesMaterial.EnableKeyword("USE_FPTL_LIGHTLIST"); |
|
|
|
m_DebugViewTilesMaterial.DisableKeyword("USE_CLUSTERED_LIGHTLIST"); |
|
|
|
m_DebugViewTilesMaterial.DisableKeyword("SHOW_LIGHT_CATEGORIES"); |
|
|
|
m_DebugViewTilesMaterial.EnableKeyword("SHOW_FEATURE_VARIANTS"); |
|
|
|
cmd.SetRenderTarget(colorBuffer); |
|
|
|
|
|
|
else if (lightingDebug.tileDebugByCategory != TileSettings.TileDebug.None) |
|
|
|
else // tile or cluster
|
|
|
|
bool bUseClusteredForDeferred = lightingDebug.tileClusterDebug == TileSettings.TileClusterDebug.Cluster; |
|
|
|
|
|
|
|
m_DebugViewTilesMaterial.SetInt(HDShaderIDs._ViewTilesFlags, (int)lightingDebug.tileDebugByCategory); |
|
|
|
m_DebugViewTilesMaterial.SetInt(HDShaderIDs._ViewTilesFlags, (int)lightingDebug.tileClusterDebugByCategory); |
|
|
|
m_DebugViewTilesMaterial.SetVector(HDShaderIDs._MousePixelCoord, mousePixelCoord); |
|
|
|
m_DebugViewTilesMaterial.EnableKeyword(bUseClusteredForDeferred ? "USE_CLUSTERED_LIGHTLIST" : "USE_FPTL_LIGHTLIST"); |
|
|
|
m_DebugViewTilesMaterial.DisableKeyword(!bUseClusteredForDeferred ? "USE_CLUSTERED_LIGHTLIST" : "USE_FPTL_LIGHTLIST"); |
|
|
|