浏览代码

Merge branch 'master' of https://github.com/Unity-Technologies/ScriptableRenderLoop into Branch_SkySettingsVolume

# Conflicts:
#	ScriptableRenderPipeline/HDRenderPipeline/Editor/HDRenderPipelineMenuItems.cs
#	ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipeline.cs
#	ScriptableRenderPipeline/HDRenderPipeline/Lighting/LightLoop/LightLoop.cs
#	ScriptableRenderPipeline/HDRenderPipeline/Sky/AtmosphericScattering/AtmosphericScattering.cs
#	ScriptableRenderPipeline/HDRenderPipeline/Sky/SkyManager.cs
/main
Julien Ignace 7 年前
当前提交
c02d593d
共有 90 个文件被更改,包括 1552 次插入878 次删除
  1. 14
      ImageTemplates/LightweightPipeline/Scenes/001_SimpleCube.unity.png.meta
  2. 14
      ImageTemplates/LightweightPipeline/Scenes/002_Camera_Clip.unity.png.meta
  3. 14
      ImageTemplates/LightweightPipeline/Scenes/003_Camera_Ortho.unity.png.meta
  4. 14
      ImageTemplates/LightweightPipeline/Scenes/004_Camera_TargetTexture.unity.png.meta
  5. 14
      ImageTemplates/LightweightPipeline/Scenes/005_LitBakedEmission.unity.png.meta
  6. 14
      ImageTemplates/LightweightPipeline/Scenes/006_LitShaderLightProbes.unity.png.meta
  7. 14
      ImageTemplates/LightweightPipeline/Scenes/008_LitShaderReflection.unity.png.meta
  8. 14
      ImageTemplates/LightweightPipeline/Scenes/009_LightweightShading.unity.png.meta
  9. 14
      ImageTemplates/LightweightPipeline/Scenes/010_MultiplePointLights.unity.png.meta
  10. 14
      ImageTemplates/LightweightPipeline/Scenes/011_UnlitSprites.unity.png.meta
  11. 14
      ImageTemplates/LightweightPipeline/Scenes/012_PBS_EnvironmentBRDF_Spheres.unity.png.meta
  12. 14
      ImageTemplates/LightweightPipeline/Scenes/017_Lighting_Scene_DirectionalBaked.unity.png.meta
  13. 14
      ImageTemplates/LightweightPipeline/Scenes/019_Lighting_Scene_PointLights.unity.png.meta
  14. 14
      ImageTemplates/LightweightPipeline/Scenes/020_Lighting_BasicDirectional.unity.png.meta
  15. 14
      ImageTemplates/LightweightPipeline/Scenes/021_Lighting_BasicPoint.unity.png.meta
  16. 14
      ImageTemplates/LightweightPipeline/Scenes/022_Lighting_BasicSpot.unity.png.meta
  17. 14
      ImageTemplates/LightweightPipeline/Scenes/024_Shader_PBRvalidation_Specular.unity.png.meta
  18. 14
      ImageTemplates/LightweightPipeline/Scenes/025_Shader_PBRvalidation_Metallic.unity.png.meta
  19. 14
      ImageTemplates/LightweightPipeline/Scenes/026_Shader_PBRscene.unity.png.meta
  20. 14
      ImageTemplates/LightweightPipeline/Scenes/029_Particles.unity.png.meta
  21. 14
      ImageTemplates/LightweightPipeline/Scenes/031_Shader_GlossyEnvironmentSky.unity.png.meta
  22. 14
      ImageTemplates/LightweightPipeline/Scenes/032_Shader_GlossyEnvironmentColor.unity.png.meta
  23. 14
      ImageTemplates/LightweightPipeline/Scenes/033_Shader_HighlightsEnvironmentGradientSH.unity.png.meta
  24. 14
      ImageTemplates/LightweightPipeline/Scenes/034_Shader_HighlightsEnvironmentGradientBaked.unity.png.meta
  25. 12
      ImageTemplates/LightweightPipeline/Scenes/035_Shader_TerrainShaders.unity.png.meta
  26. 14
      ImageTemplates/LightweightPipeline/Scenes/037_Particles.unity.png.meta
  27. 14
      ImageTemplates/LightweightPipeline/Scenes/038_Lighting_DirectionalCookie.unity.png.meta
  28. 14
      ImageTemplates/LightweightPipeline/Scenes/039_Lighting_SpotCookie.unity.png.meta
  29. 14
      ImageTemplates/LightweightPipeline/Scenes/041_Lighting_BasicArea.unity.png.meta
  30. 106
      SampleScenes/HDTest/HDRenderLoopTest.unity
  31. 4
      ScriptableRenderPipeline/Core/ShaderLibrary/API/D3D11.hlsl
  32. 4
      ScriptableRenderPipeline/Core/ShaderLibrary/API/Metal.hlsl
  33. 5
      ScriptableRenderPipeline/Core/ShaderLibrary/API/PSSL.hlsl
  34. 5
      ScriptableRenderPipeline/Core/ShaderLibrary/API/Vulkan.hlsl
  35. 5
      ScriptableRenderPipeline/Core/ShaderLibrary/API/XBoxOne.hlsl
  36. 57
      ScriptableRenderPipeline/Core/ShaderLibrary/Common.hlsl
  37. 5
      ScriptableRenderPipeline/Core/ShaderLibrary/ImageBasedLighting.hlsl
  38. 25
      ScriptableRenderPipeline/Core/ShaderLibrary/Packing.hlsl
  39. 23
      ScriptableRenderPipeline/Core/ShaderLibrary/Random.hlsl
  40. 2
      ScriptableRenderPipeline/Core/ShaderLibrary/Sampling/Hammersley.hlsl
  41. 40
      ScriptableRenderPipeline/Core/Volume/VolumeManager.cs
  42. 13
      ScriptableRenderPipeline/Core/Volume/VolumeStack.cs
  43. 79
      ScriptableRenderPipeline/HDRenderPipeline/Camera/HDAdditionalCameraData.cs
  44. 14
      ScriptableRenderPipeline/HDRenderPipeline/Camera/HDCamera.cs
  45. 12
      ScriptableRenderPipeline/HDRenderPipeline/Debug/DebugDisplay.cs
  46. 5
      ScriptableRenderPipeline/HDRenderPipeline/Debug/LightingDebug.cs
  47. 36
      ScriptableRenderPipeline/HDRenderPipeline/Editor/HDRenderPipelineInspector.Styles.cs
  48. 206
      ScriptableRenderPipeline/HDRenderPipeline/Editor/HDRenderPipelineInspector.cs
  49. 2
      ScriptableRenderPipeline/HDRenderPipeline/Editor/HDRenderPipelineMenuItems.cs
  50. 10
      ScriptableRenderPipeline/HDRenderPipeline/Editor/Lighting/HDLightEditor.Styles.cs
  51. 20
      ScriptableRenderPipeline/HDRenderPipeline/Editor/Lighting/HDLightEditor.cs
  52. 2
      ScriptableRenderPipeline/HDRenderPipeline/Editor/Material/Lit/LitUI.cs
  53. 228
      ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipeline.cs
  54. 58
      ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipelineAsset.asset
  55. 40
      ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipelineAsset.cs
  56. 8
      ScriptableRenderPipeline/HDRenderPipeline/Lighting/HDAdditionalLightData.cs
  57. 6
      ScriptableRenderPipeline/HDRenderPipeline/Lighting/HDLightEditorUtilities.cs
  58. 10
      ScriptableRenderPipeline/HDRenderPipeline/Lighting/LightDefinition.cs
  59. 236
      ScriptableRenderPipeline/HDRenderPipeline/Lighting/LightLoop/LightLoop.cs
  60. 2
      ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.cs
  61. 4
      ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.hlsl
  62. 26
      ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.shader
  63. 8
      ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LitDataIndividualLayer.hlsl
  64. 1
      ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LitProperties.hlsl
  65. 32
      ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LitTessellation.shader
  66. 2
      ScriptableRenderPipeline/HDRenderPipeline/Material/RenderPipelineMaterial.cs
  67. 30
      ScriptableRenderPipeline/HDRenderPipeline/Material/SubsurfaceScattering/SubsurfaceScatteringManager.cs
  68. 2
      ScriptableRenderPipeline/HDRenderPipeline/ShaderPass/VaryingMesh.hlsl
  69. 6
      ScriptableRenderPipeline/HDRenderPipeline/Sky/AtmosphericScattering/AtmosphericScattering.cs
  70. 52
      ScriptableRenderPipeline/HDRenderPipeline/Sky/SkyManager.cs
  71. 4
      Tests/GraphicsTests/RenderPipeline/HDRenderPipeline/Scenes/1xxx_Materials/1210_Lit_BentNormal.unity
  72. 2
      Tests/GraphicsTests/RenderPipeline/HDRenderPipeline/Scenes/2xxx_Lighting/2001_Dynamic_Directional.unity
  73. 8
      Tests/GraphicsTests/RenderPipeline/HDRenderPipeline/Scenes/2xxx_Lighting/2002_Dynamic_Mix.unity
  74. 54
      Tests/GraphicsTests/RenderPipeline/HDRenderPipeline/Scenes/2xxx_Lighting/2003_Light_Parameters.unity
  75. 26
      ScriptableRenderPipeline/HDRenderPipeline/Lighting/LightLoop/GlobalLightLoopSettings.cs
  76. 11
      ScriptableRenderPipeline/HDRenderPipeline/Lighting/LightLoop/GlobalLightLoopSettings.cs.meta
  77. 82
      ScriptableRenderPipeline/HDRenderPipeline/Lighting/LightLoop/LightLoopSettings.cs
  78. 11
      ScriptableRenderPipeline/HDRenderPipeline/Lighting/LightLoop/LightLoopSettings.cs.meta
  79. 8
      ScriptableRenderPipeline/HDRenderPipeline/RenderPipeline.meta
  80. 242
      ScriptableRenderPipeline/HDRenderPipeline/RenderPipeline/FrameSettings.cs
  81. 36
      ScriptableRenderPipeline/HDRenderPipeline/RenderPipeline/RenderPipelineSettings.cs
  82. 11
      ScriptableRenderPipeline/HDRenderPipeline/RenderPipeline/RenderPipelineSettings.cs.meta
  83. 11
      ScriptableRenderPipeline/HDRenderPipeline/Debug/RenderingDebug.cs.meta
  84. 18
      ScriptableRenderPipeline/HDRenderPipeline/Debug/RenderingDebug.cs
  85. 14
      ScriptableRenderPipeline/HDRenderPipeline/FrameSettings.cs
  86. 38
      ScriptableRenderPipeline/HDRenderPipeline/GlobalSettings.cs
  87. 11
      ScriptableRenderPipeline/HDRenderPipeline/GlobalSettings.cs.meta
  88. 8
      Tests/GraphicsTests/RenderPipeline/HDRenderPipeline/Scenes/2xxx_Lighting/2201_Env_SurfaceReactions.meta
  89. 0
      /ScriptableRenderPipeline/HDRenderPipeline/RenderPipeline/FrameSettings.cs.meta

14
ImageTemplates/LightweightPipeline/Scenes/001_SimpleCube.unity.png.meta


fileFormatVersion: 2
guid: 7e23cd043b6f7fd4c8d769ff68ba3133
timeCreated: 1504172393
licenseType: Pro
serializedVersion: 4
serializedVersion: 5
mipmaps:
mipMapMode: 0
enableMipMap: 1

spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
- buildTarget: DefaultTexturePlatform
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1

sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
userData:
assetBundleName:

14
ImageTemplates/LightweightPipeline/Scenes/002_Camera_Clip.unity.png.meta


fileFormatVersion: 2
guid: f9468710e8a19304e89c5bd97160be1d
timeCreated: 1504173062
licenseType: Pro
serializedVersion: 4
serializedVersion: 5
mipmaps:
mipMapMode: 0
enableMipMap: 1

spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
- buildTarget: DefaultTexturePlatform
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1

sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
userData:
assetBundleName:

14
ImageTemplates/LightweightPipeline/Scenes/003_Camera_Ortho.unity.png.meta


fileFormatVersion: 2
guid: 7a64bc3cfa1be7348a754d8da0fe1bc1
timeCreated: 1504172391
licenseType: Pro
serializedVersion: 4
serializedVersion: 5
mipmaps:
mipMapMode: 0
enableMipMap: 1

spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
- buildTarget: DefaultTexturePlatform
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1

sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
userData:
assetBundleName:

14
ImageTemplates/LightweightPipeline/Scenes/004_Camera_TargetTexture.unity.png.meta


fileFormatVersion: 2
guid: cc45b92de85edce419c7ed394f0c6b34
timeCreated: 1504172802
licenseType: Pro
serializedVersion: 4
serializedVersion: 5
mipmaps:
mipMapMode: 0
enableMipMap: 1

spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
- buildTarget: DefaultTexturePlatform
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1

sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
userData:
assetBundleName:

14
ImageTemplates/LightweightPipeline/Scenes/005_LitBakedEmission.unity.png.meta


fileFormatVersion: 2
guid: f8a5ea9c8121c5b45826dc4c99918223
timeCreated: 1509370030
licenseType: Pro
serializedVersion: 4
serializedVersion: 5
mipmaps:
mipMapMode: 0
enableMipMap: 1

spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
- buildTarget: DefaultTexturePlatform
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1

sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
userData:
assetBundleName:

14
ImageTemplates/LightweightPipeline/Scenes/006_LitShaderLightProbes.unity.png.meta


fileFormatVersion: 2
guid: f803aab2456d7844fbd67d66f4c1afe8
timeCreated: 1509370329
licenseType: Pro
serializedVersion: 4
serializedVersion: 5
mipmaps:
mipMapMode: 0
enableMipMap: 1

spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
- buildTarget: DefaultTexturePlatform
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1

sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
userData:
assetBundleName:

14
ImageTemplates/LightweightPipeline/Scenes/008_LitShaderReflection.unity.png.meta


fileFormatVersion: 2
guid: 8bb8d310b00e0f241aa92faf71d6e5c4
timeCreated: 1504172401
licenseType: Pro
serializedVersion: 4
serializedVersion: 5
mipmaps:
mipMapMode: 0
enableMipMap: 1

spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
- buildTarget: DefaultTexturePlatform
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1

sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
userData:
assetBundleName:

14
ImageTemplates/LightweightPipeline/Scenes/009_LightweightShading.unity.png.meta


fileFormatVersion: 2
guid: 8e5dae4599b40de4980b27f4d7c1c9a4
timeCreated: 1504172523
licenseType: Pro
serializedVersion: 4
serializedVersion: 5
mipmaps:
mipMapMode: 0
enableMipMap: 1

spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
- buildTarget: DefaultTexturePlatform
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1

sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
userData:
assetBundleName:

14
ImageTemplates/LightweightPipeline/Scenes/010_MultiplePointLights.unity.png.meta


fileFormatVersion: 2
guid: 8bafdd2cc4f2daf43a03035e0956f4ea
timeCreated: 1504172400
licenseType: Pro
serializedVersion: 4
serializedVersion: 5
mipmaps:
mipMapMode: 0
enableMipMap: 1

spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
- buildTarget: DefaultTexturePlatform
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1

sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
userData:
assetBundleName:

14
ImageTemplates/LightweightPipeline/Scenes/011_UnlitSprites.unity.png.meta


fileFormatVersion: 2
guid: 9d26904c548e53b4a94898b392504e83
timeCreated: 1504172662
licenseType: Pro
serializedVersion: 4
serializedVersion: 5
mipmaps:
mipMapMode: 0
enableMipMap: 1

spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
- buildTarget: DefaultTexturePlatform
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1

sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
userData:
assetBundleName:

14
ImageTemplates/LightweightPipeline/Scenes/012_PBS_EnvironmentBRDF_Spheres.unity.png.meta


fileFormatVersion: 2
guid: ade17cbb471220b4e8506d098386ba80
timeCreated: 1504172680
licenseType: Pro
serializedVersion: 4
serializedVersion: 5
mipmaps:
mipMapMode: 0
enableMipMap: 1

spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
- buildTarget: DefaultTexturePlatform
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1

sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
userData:
assetBundleName:

14
ImageTemplates/LightweightPipeline/Scenes/017_Lighting_Scene_DirectionalBaked.unity.png.meta


fileFormatVersion: 2
guid: f3f8d7546ae584b0896abf1f19c39f27
timeCreated: 1504695588
licenseType: Pro
serializedVersion: 4
serializedVersion: 5
mipmaps:
mipMapMode: 0
enableMipMap: 1

spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
- buildTarget: DefaultTexturePlatform
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1

sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
userData:
assetBundleName:

14
ImageTemplates/LightweightPipeline/Scenes/019_Lighting_Scene_PointLights.unity.png.meta


fileFormatVersion: 2
guid: 17ad6947534f84588abd730750168c53
timeCreated: 1509374529
licenseType: Pro
serializedVersion: 4
serializedVersion: 5
mipmaps:
mipMapMode: 0
enableMipMap: 1

spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
- buildTarget: DefaultTexturePlatform
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1

sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
userData:
assetBundleName:

14
ImageTemplates/LightweightPipeline/Scenes/020_Lighting_BasicDirectional.unity.png.meta


fileFormatVersion: 2
guid: f35e6ac088306462689e3cf836d16645
timeCreated: 1504695588
licenseType: Pro
serializedVersion: 4
serializedVersion: 5
mipmaps:
mipMapMode: 0
enableMipMap: 1

spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
- buildTarget: DefaultTexturePlatform
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1

sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
userData:
assetBundleName:

14
ImageTemplates/LightweightPipeline/Scenes/021_Lighting_BasicPoint.unity.png.meta


fileFormatVersion: 2
guid: b1cbd0fafb352425d9fb4868426fb32f
timeCreated: 1504695588
licenseType: Pro
serializedVersion: 4
serializedVersion: 5
mipmaps:
mipMapMode: 0
enableMipMap: 1

spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
- buildTarget: DefaultTexturePlatform
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1

sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
userData:
assetBundleName:

14
ImageTemplates/LightweightPipeline/Scenes/022_Lighting_BasicSpot.unity.png.meta


fileFormatVersion: 2
guid: 31da632adbdc94e65b26e104e07b4753
timeCreated: 1504695587
licenseType: Pro
serializedVersion: 4
serializedVersion: 5
mipmaps:
mipMapMode: 0
enableMipMap: 1

spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
- buildTarget: DefaultTexturePlatform
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1

sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
userData:
assetBundleName:

14
ImageTemplates/LightweightPipeline/Scenes/024_Shader_PBRvalidation_Specular.unity.png.meta


fileFormatVersion: 2
guid: e53c46d8dc8fc4ccb9f888fc092465cb
timeCreated: 1505133248
licenseType: Pro
serializedVersion: 4
serializedVersion: 5
mipmaps:
mipMapMode: 0
enableMipMap: 1

spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
- buildTarget: DefaultTexturePlatform
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1

sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
userData:
assetBundleName:

14
ImageTemplates/LightweightPipeline/Scenes/025_Shader_PBRvalidation_Metallic.unity.png.meta


fileFormatVersion: 2
guid: 02b78090e1d1e4337ba61625ba48e440
timeCreated: 1505133248
licenseType: Pro
serializedVersion: 4
serializedVersion: 5
mipmaps:
mipMapMode: 0
enableMipMap: 1

spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
- buildTarget: DefaultTexturePlatform
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1

sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
userData:
assetBundleName:

14
ImageTemplates/LightweightPipeline/Scenes/026_Shader_PBRscene.unity.png.meta


fileFormatVersion: 2
guid: bf08da8c044d748a6b54f9ad754b2773
timeCreated: 1509377198
licenseType: Pro
serializedVersion: 4
serializedVersion: 5
mipmaps:
mipMapMode: 0
enableMipMap: 1

spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
- buildTarget: DefaultTexturePlatform
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1

sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
userData:
assetBundleName:

14
ImageTemplates/LightweightPipeline/Scenes/029_Particles.unity.png.meta


fileFormatVersion: 2
guid: 813c9c6f5718c4e1abb1e00021916fc6
timeCreated: 1509462613
licenseType: Pro
serializedVersion: 4
serializedVersion: 5
mipmaps:
mipMapMode: 0
enableMipMap: 1

spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
- buildTarget: DefaultTexturePlatform
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1

sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
userData:
assetBundleName:

14
ImageTemplates/LightweightPipeline/Scenes/031_Shader_GlossyEnvironmentSky.unity.png.meta


fileFormatVersion: 2
guid: b5968afe1768e844b81c1604bdffe661
timeCreated: 1505990945
licenseType: Pro
serializedVersion: 4
serializedVersion: 5
mipmaps:
mipMapMode: 0
enableMipMap: 1

spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
- buildTarget: DefaultTexturePlatform
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1

sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
userData:
assetBundleName:

14
ImageTemplates/LightweightPipeline/Scenes/032_Shader_GlossyEnvironmentColor.unity.png.meta


fileFormatVersion: 2
guid: a44007c254e4515418cab78450123a40
timeCreated: 1505990945
licenseType: Pro
serializedVersion: 4
serializedVersion: 5
mipmaps:
mipMapMode: 0
enableMipMap: 1

spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
- buildTarget: DefaultTexturePlatform
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1

sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
userData:
assetBundleName:

14
ImageTemplates/LightweightPipeline/Scenes/033_Shader_HighlightsEnvironmentGradientSH.unity.png.meta


fileFormatVersion: 2
guid: 6f166e43fbe89034895eed4a6664dd26
timeCreated: 1505990945
licenseType: Pro
serializedVersion: 4
serializedVersion: 5
mipmaps:
mipMapMode: 0
enableMipMap: 1

spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
- buildTarget: DefaultTexturePlatform
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1

sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
userData:
assetBundleName:

14
ImageTemplates/LightweightPipeline/Scenes/034_Shader_HighlightsEnvironmentGradientBaked.unity.png.meta


fileFormatVersion: 2
guid: f22dc108233286f4b8318720c0b010a7
timeCreated: 1505990945
licenseType: Pro
serializedVersion: 4
serializedVersion: 5
mipmaps:
mipMapMode: 0
enableMipMap: 1

spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
- buildTarget: DefaultTexturePlatform
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1

sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
userData:
assetBundleName:

12
ImageTemplates/LightweightPipeline/Scenes/035_Shader_TerrainShaders.unity.png.meta


TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 4
serializedVersion: 5
mipmaps:
mipMapMode: 0
enableMipMap: 1

spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
- buildTarget: DefaultTexturePlatform
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1

sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
userData:
assetBundleName:

14
ImageTemplates/LightweightPipeline/Scenes/037_Particles.unity.png.meta


fileFormatVersion: 2
guid: abd85e7a3517d4760a2c9aaabd9b6bb3
timeCreated: 1509465840
licenseType: Pro
serializedVersion: 4
serializedVersion: 5
mipmaps:
mipMapMode: 0
enableMipMap: 1

spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
- buildTarget: DefaultTexturePlatform
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1

sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
userData:
assetBundleName:

14
ImageTemplates/LightweightPipeline/Scenes/038_Lighting_DirectionalCookie.unity.png.meta


fileFormatVersion: 2
guid: 929b8b587a82d4f7aa8f6b52c47b158a
timeCreated: 1509381709
licenseType: Pro
serializedVersion: 4
serializedVersion: 5
mipmaps:
mipMapMode: 0
enableMipMap: 1

spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
- buildTarget: DefaultTexturePlatform
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1

sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
userData:
assetBundleName:

14
ImageTemplates/LightweightPipeline/Scenes/039_Lighting_SpotCookie.unity.png.meta


fileFormatVersion: 2
guid: 8a1d76f28ab9045f4a09ea0c2d5a475b
timeCreated: 1509381709
licenseType: Pro
serializedVersion: 4
serializedVersion: 5
mipmaps:
mipMapMode: 0
enableMipMap: 1

spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
- buildTarget: DefaultTexturePlatform
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1

sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
userData:
assetBundleName:

14
ImageTemplates/LightweightPipeline/Scenes/041_Lighting_BasicArea.unity.png.meta


fileFormatVersion: 2
guid: b22c72d285ea240a8aeae478bb8febea
timeCreated: 1509705572
licenseType: Pro
serializedVersion: 4
serializedVersion: 5
mipmaps:
mipMapMode: 0
enableMipMap: 1

spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
- buildTarget: DefaultTexturePlatform
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1

sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
userData:
assetBundleName:

106
SampleScenes/HDTest/HDRenderLoopTest.unity


--- !u!104 &2
RenderSettings:
m_ObjectHideFlags: 0
serializedVersion: 8
serializedVersion: 9
m_Fog: 0
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
m_FogMode: 3

m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 0}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0

m_PVRFilteringAtrousPositionSigmaDirect: 0.5
m_PVRFilteringAtrousPositionSigmaIndirect: 2
m_PVRFilteringAtrousPositionSigmaAO: 1
m_ShowResolutionOverlay: 1
m_UseShadowmask: 1
m_UseShadowmask: 0
--- !u!196 &4
NavMeshSettings:
serializedVersion: 2

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 2
spotLightShape: 0
shapeLength: 16
shapeWidth: 0
shapeWidth: 16
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

m_IsActive: 1
--- !u!114 &827169274
MonoBehaviour:
m_ObjectHideFlags: 0
m_ObjectHideFlags: 2
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 827169273}

affectSpecular: 1
lightTypeExtent: 1
spotLightShape: 0
shapeLength: 16
shapeWidth: 2
shapeWidth: 16
shapeHeight: 2
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

m_GameObject: {fileID: 827169273}
m_Enabled: 1
serializedVersion: 8
m_Type: 1
m_Type: 2
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_Intensity: 1
m_Range: 12

serializedVersion: 2
m_Bits: 4294967295
m_Lightmapping: 4
m_AreaSize: {x: 1, y: 1}
m_AreaSize: {x: 16, y: 2}
m_BounceIntensity: 1
m_ColorTemperature: 6570
m_UseColorTemperature: 0

m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0}
--- !u!114 &827169277
MonoBehaviour:
m_ObjectHideFlags: 0
m_ObjectHideFlags: 2
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 827169273}

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 1
shapeLength: 4
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 1
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

m_IsActive: 1
--- !u!114 &1640077384
MonoBehaviour:
m_ObjectHideFlags: 0
m_ObjectHideFlags: 2
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1640077383}

affectSpecular: 1
lightTypeExtent: 1
spotLightShape: 0
shapeLength: 4
shapeWidth: 2
shapeWidth: 4
shapeHeight: 2
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

serializedVersion: 2
m_Bits: 4294967295
m_Lightmapping: 4
m_AreaSize: {x: 1, y: 1}
m_AreaSize: {x: 4, y: 2}
m_BounceIntensity: 1
m_ColorTemperature: 6570
m_UseColorTemperature: 0

m_LocalEulerAnglesHint: {x: 0, y: 180, z: 90.00001}
--- !u!114 &1640077387
MonoBehaviour:
m_ObjectHideFlags: 0
m_ObjectHideFlags: 2
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1640077383}

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 2
shapeLength: 4
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

4
ScriptableRenderPipeline/Core/ShaderLibrary/API/D3D11.hlsl


#define UNITY_UV_STARTS_AT_TOP 1
#define UNITY_REVERSED_Z 1
#define UNITY_NEAR_CLIP_VALUE (1.0)
// This value will not go through any matrix projection convertion
// This value will not go through any matrix projection conversion
#define FRONT_FACE_SEMATIC SV_IsFrontFace
#define FRONT_FACE_SEMANTIC SV_IsFrontFace
#define FRONT_FACE_TYPE bool
#define IS_FRONT_VFACE(VAL, FRONT, BACK) ((VAL) ? (FRONT) : (BACK))

4
ScriptableRenderPipeline/Core/ShaderLibrary/API/Metal.hlsl


#define UNITY_UV_STARTS_AT_TOP 1
#define UNITY_REVERSED_Z 1
#define UNITY_NEAR_CLIP_VALUE (1.0)
// This value will not go through any matrix projection convertion
// This value will not go through any matrix projection conversion
#define FRONT_FACE_SEMATIC SV_IsFrontFace
#define FRONT_FACE_SEMANTIC SV_IsFrontFace
#define FRONT_FACE_TYPE bool
#define IS_FRONT_VFACE(VAL, FRONT, BACK) ((VAL) ? (FRONT) : (BACK))

5
ScriptableRenderPipeline/Core/ShaderLibrary/API/PSSL.hlsl


// This file assume SHADER_API_D3D11 is defined
#define INTRINSIC_BITFIELD_EXTRACT
#define BitFieldExtract __v_bfe_u32
#define INTRINSIC_BITFIELD_EXTRACT_SIGN_EXTEND
#define BitFieldExtractSignExtend __v_bfe_i32
#define INTRINSIC_WAVEREADFIRSTLANE
#define WaveReadFirstLane ReadFirstLane
#define INTRINSIC_MAD24

#define UNITY_NEAR_CLIP_VALUE (1.0)
// This value will not go through any matrix projection convertion
#define UNITY_RAW_FAR_CLIP_VALUE (0.0)
#define FRONT_FACE_SEMATIC SV_IsFrontFace
#define FRONT_FACE_SEMANTIC SV_IsFrontFace
#define FRONT_FACE_TYPE bool
#define IS_FRONT_VFACE(VAL, FRONT, BACK) ((VAL) ? (FRONT) : (BACK))

5
ScriptableRenderPipeline/Core/ShaderLibrary/API/Vulkan.hlsl


// This file assume SHADER_API_VULKAN is defined
// TODO: This is a straight copy from D3D11.hlsl. Go through all this stuff and adjust where needed.
// This value will not go through any matrix projection convertion
// This value will not go through any matrix projection conversion
#define FRONT_FACE_SEMATIC SV_IsFrontFace
#define FRONT_FACE_SEMANTIC SV_IsFrontFace
#define FRONT_FACE_TYPE bool
#define IS_FRONT_VFACE(VAL, FRONT, BACK) ((VAL) ? (FRONT) : (BACK))

5
ScriptableRenderPipeline/Core/ShaderLibrary/API/XBoxOne.hlsl


// This file assume SHADER_API_D3D11 is defined
// TODO: This is a straight copy from D3D11.hlsl. Go through all this stuff and adjust where needed.
// This value will not go through any matrix projection convertion
// This value will not go through any matrix projection conversion
#define FRONT_FACE_SEMATIC SV_IsFrontFace
#define FRONT_FACE_SEMANTIC SV_IsFrontFace
#define FRONT_FACE_TYPE bool
#define IS_FRONT_VFACE(VAL, FRONT, BACK) ((VAL) ? (FRONT) : (BACK))

57
ScriptableRenderPipeline/Core/ShaderLibrary/Common.hlsl


// Unsigned integer bit field extraction.
// Note that the intrinsic itself generates a vector instruction.
// Wrap this function with WaveReadFirstLane() to get scalar output.
uint BitFieldExtract(uint data, uint numBits, uint offset)
uint BitFieldExtract(uint data, uint offset, uint numBits)
uint mask = UINT_MAX >> (32u - numBits);
uint mask = (1u << numBits) - 1u;
#ifndef INTRINSIC_BITFIELD_EXTRACT_SIGN_EXTEND
// Integer bit field extraction with sign extension.
// Note that the intrinsic itself generates a vector instruction.
// Wrap this function with WaveReadFirstLane() to get scalar output.
int BitFieldExtractSignExtend(int data, uint offset, uint numBits)
{
int shifted = data >> offset; // Sign-extending (arithmetic) shift
int signBit = shifted & (1u << (numBits - 1u));
uint mask = (1u << numBits) - 1u;
return -signBit | (shifted & mask); // Use 2-complement for negation to replicate the sign bit
}
#endif // INTRINSIC_BITFIELD_EXTRACT_SIGN_EXTEND
return BitFieldExtract(data, 1u, offset) != 0;
return BitFieldExtract(data, offset, 1u) != 0;
}
void SetBit(inout uint data, uint offset)

return (x < 1.0) ? poly : HALF_PI - poly;
}
#if (SHADER_TARGET >= 45)
uint FastLog2(uint x)
{
return firstbithigh(x) - 1u;
}
#endif
// 4 VGPR, 16 FR (12 FR, 1 QR), 2 scalar
// input [-infinity, infinity] and output [-PI/2, PI/2]
float FastATan(float x)

}
// Same as smoothstep except it assume 0, 1 interval for x
float Smoothstep01(float x)
{
return x * x * (3.0 - (2.0 * x));
}
static const float3x3 k_identity3x3 = {1.0, 0.0, 0.0,
0.0, 1.0, 0.0,
0.0, 0.0, 1.0};
static const float4x4 k_identity4x4 = {1.0, 0.0, 0.0, 0.0,
0.0, 1.0, 0.0, 0.0,
0.0, 0.0, 1.0, 0.0,
0.0, 0.0, 0.0, 1.0};
// Using pow often result to a warning like this
// "pow(f, e) will not work for negative f, use abs(f) or conditionally handle negative values if you expect them"
// PositivePow remove this warning when you know the value is positive and avoid inf/NAN.

float3 Orthonormalize(float3 tangent, float3 normal)
{
return normalize(tangent - dot(tangent, normal) * normal);
}
// Same as smoothstep except it assume 0, 1 interval for x
float Smoothstep01(float x)
{
return x * x * (3.0 - (2.0 * x));
}
// ----------------------------------------------------------------------------

// ----------------------------------------------------------------------------
// Space transformations
// ----------------------------------------------------------------------------
static const float3x3 k_identity3x3 = {1, 0, 0,
0, 1, 0,
0, 0, 1};
static const float4x4 k_identity4x4 = {1, 0, 0, 0,
0, 1, 0, 0,
0, 0, 1, 0,
0, 0, 0, 1};
// Use case examples:
// (position = positionCS) => (clipSpaceTransform = use default)

5
ScriptableRenderPipeline/Core/ShaderLibrary/ImageBasedLighting.hlsl


if (usePrecomputedSamples)
{
// Performance warning: using a texture LUT will generate a vector load,
// which increases both the VGPR pressure and the workload of the
// texture unit. A better solution here is to load from a Constant, Raw
// or Structured buffer, or perhaps even declare all the constants in an
// HLSL header to allow the compiler to inline everything.
float3 localL = LOAD_TEXTURE2D(ggxIblSamples, uint2(i, index)).xyz;
L = mul(localL, localToWorld);

25
ScriptableRenderPipeline/Core/ShaderLibrary/Packing.hlsl


// Packs an integer stored using at most 'numBits' into a [0..1] float.
float PackInt(uint i, uint numBits)
{
uint maxInt = UINT_MAX >> (32u - numBits);
uint maxInt = (1u << numBits) - 1u;
return saturate(i * rcp(maxInt));
}

uint maxInt = UINT_MAX >> (32u - numBits);
uint maxInt = (1u << numBits) - 1u;
return (uint)(f * maxInt + 0.5); // Round instead of truncating
}

// Packs 8 lowermost bits of a [0..65535] integer into a [0..1] float.
float PackShortLo(uint i)
{
uint lo = BitFieldExtract(i, 8u, 0u);
uint lo = BitFieldExtract(i, 0u, 8u);
return PackInt(lo, 8);
}

//-----------------------------------------------------------------------------
// src must be between 0.0 and 1.0
uint PackFloatToUInt(float src, uint numBits, uint offset)
uint PackFloatToUInt(float src, uint offset, uint numBits)
float UnpackUIntToFloat(uint src, uint numBits, uint offset)
float UnpackUIntToFloat(uint src, uint offset, uint numBits)
uint maxInt = UINT_MAX >> (32u - numBits);
return float(BitFieldExtract(src, numBits, offset)) * rcp(maxInt);
uint maxInt = (1u << numBits) - 1u;
return float(BitFieldExtract(src, offset, numBits)) * rcp(maxInt);
return (PackFloatToUInt(rgba.x, 10, 0) | PackFloatToUInt(rgba.y, 10, 10) | PackFloatToUInt(rgba.z, 10, 20) | PackFloatToUInt(rgba.w, 2, 30));
return (PackFloatToUInt(rgba.x, 0, 10) |
PackFloatToUInt(rgba.y, 10, 10) |
PackFloatToUInt(rgba.z, 20, 10) |
PackFloatToUInt(rgba.w, 30, 2));
ouput.x = UnpackUIntToFloat(rgba, 10, 0);
ouput.x = UnpackUIntToFloat(rgba, 0, 10);
ouput.z = UnpackUIntToFloat(rgba, 10, 20);
ouput.w = UnpackUIntToFloat(rgba, 2, 30);
ouput.z = UnpackUIntToFloat(rgba, 20, 10);
ouput.w = UnpackUIntToFloat(rgba, 30, 2);
return ouput;
}

23
ScriptableRenderPipeline/Core/ShaderLibrary/Random.hlsl


return JenkinsHash(v.x ^ JenkinsHash(v.y) ^ JenkinsHash(v.z) ^ JenkinsHash(v.w));
}
// Construct a float with half-open range [0:1] using low 23 bits.
// Construct a float with half-open range [0, 1) using low 23 bits.
float ConstructFloat(uint m) {
const uint ieeeMantissa = 0x007FFFFFu; // Binary FP32 mantissa bitmask
const uint ieeeOne = 0x3F800000u; // 1.0 in FP32 IEEE
float ConstructFloat(int m) {
const int ieeeMantissa = 0x007FFFFF; // Binary FP32 mantissa bitmask
const int ieeeOne = 0x3F800000; // 1.0 in FP32 IEEE
m &= ieeeMantissa; // Keep only mantissa bits (fractional part)
m |= ieeeOne; // Add fractional part to 1.0
m &= ieeeMantissa; // Keep only mantissa bits (fractional part)
m |= ieeeOne; // Add fractional part to 1.0
float f = asfloat(m); // Range [1, 2)
return f - 1; // Range [0, 1)
}
float f = asfloat(m); // Range [1:2]
return f - 1; // Range [0:1]
float ConstructFloat(uint m)
{
return ConstructFloat(asint(m));
// Pseudo-random value in half-open range [0:1]. The distribution is reasonably uniform.
// Pseudo-random value in half-open range [0, 1). The distribution is reasonably uniform.
// Ref: https://stackoverflow.com/a/17479300
float GenerateHashedRandomFloat(uint x)
{

2
ScriptableRenderPipeline/Core/ShaderLibrary/Sampling/Hammersley.hlsl


// Ref: http://holger.dammertz.org/stuff/notes_HammersleyOnHemisphere.html
uint ReverseBits32(uint bits)
{
#if 1 // Shader model 5
#if (SHADER_TARGET >= 45)
return reversebits(bits);
#else
bits = (bits << 16) | (bits >> 16);

40
ScriptableRenderPipeline/Core/Volume/VolumeManager.cs


stack = CreateStack();
}
public VolumeStack CreateStack()
{
var stack = new VolumeStack();
stack.Reload(baseComponentTypes);
return stack;
}
m_ComponentsDefaultState.Clear();
// Grab all the component types we can find
baseComponentTypes = CoreUtils.GetAllAssemblyTypes()
.Where(t => t.IsSubclassOf(typeof(VolumeComponent)) && !t.IsAbstract);

var inst = (VolumeComponent)ScriptableObject.CreateInstance(type);
m_ComponentsDefaultState.Add(inst);
}
}
public VolumeStack CreateStack()
{
return new VolumeStack(baseComponentTypes);
}
public void Register(Volume volume, int layer)

ReloadBaseTypes();
}
[Conditional("UNITY_EDITOR")]
public void CheckStack(VolumeStack stack)
{
// The editor doesn't reload the domain when exiting play mode but still kills every
// object created while in play mode, like stacks' component states
var components = stack.components;
if (components == null)
{
stack.Reload(baseComponentTypes);
return;
}
foreach (var kvp in components)
{
if (kvp.Key == null || kvp.Value == null)
{
stack.Reload(baseComponentTypes);
return;
}
}
}
// Update the global state - should be called once per frame per transform/layer mask combo
// in the update loop before rendering
public void Update(Transform trigger, LayerMask layerMask)

// Update a specific stack - can be used to manage your own stack and store it for later use
public void Update(VolumeStack stack, Transform trigger, LayerMask layerMask)
{
Assert.IsNotNull(stack);
CheckStack(stack);
// Start by resetting the global state to default values
ReplaceData(stack, m_ComponentsDefaultState);

13
ScriptableRenderPipeline/Core/Volume/VolumeStack.cs


public sealed class VolumeStack : IDisposable
{
// Holds the state of _all_ component types you can possibly add on volumes
public readonly Dictionary<Type, VolumeComponent> components;
public Dictionary<Type, VolumeComponent> components;
internal VolumeStack()
{
}
internal VolumeStack(IEnumerable<Type> baseTypes)
internal void Reload(IEnumerable<Type> baseTypes)
components = new Dictionary<Type, VolumeComponent>();
if (components == null)
components = new Dictionary<Type, VolumeComponent>();
else
components.Clear();
foreach (var type in baseTypes)
{

79
ScriptableRenderPipeline/HDRenderPipeline/Camera/HDAdditionalCameraData.cs


namespace UnityEngine.Experimental.Rendering.HDPipeline
{
// This struct allow to add specialized path in HDRenderPipeline (can be use to render mini map or planar reflection etc...)
public enum RenderingPathHDRP { Default, Unlit };
public RenderingPathHDRP renderingPath;
// This struct allow to add specialized path in HDRenderPipeline (can be use to render mini map or planar reflection etc...)
// A rendering path is the list of rendering pass that will be executed at runtime and depends on the associated FrameSettings
// Default is the default rendering path define by the HDRendeRPipelineAsset FrameSettings.
// Custom allow users to define the FrameSettigns for this path
// Then enum can contain either preset of FrameSettings or hard coded path
// Unlit below is a hard coded path (a path that can't be implemented only with FrameSettings)
public enum RenderingPath
{
Default,
Custom, // Fine grained
Unlit // Hard coded path
};
public RenderingPath renderingPath;
// To be able to turn on/off FrameSettings properties at runtime for debugging purpose without affecting the original one
// we create a runtime copy (m_ActiveFrameSettings that is used, and any parametrization is done on serialized frameSettings)
public FrameSettings serializedFrameSettings = new FrameSettings(); // Serialize frameSettings
// Not serialized, not visible
FrameSettings m_FrameSettings = new FrameSettings();
public FrameSettings GetFrameSettings()
{
return m_FrameSettings;
}
bool isRegisterDebug = false;
string m_CameraRegisterName;
void RegisterDebug()
{
if (!isRegisterDebug)
{
FrameSettings.RegisterDebug(m_camera.name, GetFrameSettings());
m_CameraRegisterName = m_camera.name;
isRegisterDebug = true;
}
}
void UnRegisterDebug()
{
if (isRegisterDebug)
{
FrameSettings.UnRegisterDebug(m_CameraRegisterName);
isRegisterDebug = false;
}
}
// When LDR, unity render in 8bitSRGB, then do a final shader with sRGB conversion
// When LDR, unity render in 8bitSRGB, then do a final shader with sRGB conversion
serializedFrameSettings.CopyTo(m_FrameSettings);
RegisterDebug();
}
void Update()
{
#if UNITY_EDITOR
if (m_camera.name != m_CameraRegisterName)
{
UnRegisterDebug();
RegisterDebug();
}
#endif
}
void OnValidate()
{
// Modification of frameSettings in the inspector will call OnValidate().
// We do a copy of the settings to those effectively used
serializedFrameSettings.CopyTo(m_FrameSettings);
}
void OnDisable()
{
UnRegisterDebug();
}
}
}

14
ScriptableRenderPipeline/HDRenderPipeline/Camera/HDCamera.cs


// avoid one-frame jumps/hiccups with temporal effects (motion blur, TAA...)
public bool isFirstFrame { get; private set; }
public bool useForwardOnly { get; private set; }
public bool stereoEnabled { get; private set; }
public Vector4 invProjParam
{
// Ref: An Efficient Depth Linearization Method for Oblique View Frustums, Eq. 6.

Reset();
}
public void Update(PostProcessLayer postProcessLayer, GlobalRenderingSettings globalRenderingSettings, bool stereoActive)
public void Update(PostProcessLayer postProcessLayer)
{
// If TAA is enabled projMatrix will hold a jittered projection matrix. The original,
// non-jittered projection matrix can be accessed via nonJitteredProjMatrix.

frustumPlaneEquations[5] = new Vector4(-camera.transform.forward.x, -camera.transform.forward.y, -camera.transform.forward.z, Vector3.Dot(camera.transform.forward, relPos) + camera.farClipPlane);
m_LastFrameActive = Time.frameCount;
stereoEnabled = stereoActive && (camera.stereoTargetEye == StereoTargetEyeMask.Both);
useForwardOnly = globalRenderingSettings.ShouldUseForwardRenderingOnly() || stereoEnabled;
}
public void Reset()

stereoEnabled = false;
useForwardOnly = false;
public static HDCamera Get(Camera camera, PostProcessLayer postProcessLayer, GlobalRenderingSettings globalRenderingSettings, bool stereoActive)
public static HDCamera Get(Camera camera, PostProcessLayer postProcessLayer)
{
HDCamera hdcam;

s_Cameras.Add(camera, hdcam);
}
hdcam.Update(postProcessLayer, globalRenderingSettings, stereoActive);
hdcam.Update(postProcessLayer);
return hdcam;
}

12
ScriptableRenderPipeline/HDRenderPipeline/Debug/DebugDisplay.cs


public MaterialDebugSettings materialDebugSettings = new MaterialDebugSettings();
public LightingDebugSettings lightingDebugSettings = new LightingDebugSettings();
public RenderingDebugSettings renderingDebugSettings = new RenderingDebugSettings();
public static GUIContent[] lightingFullScreenDebugStrings = null;
public static int[] lightingFullScreenDebugValues = null;

DebugMenuManager.instance.AddDebugItem<Attributes.DebugViewProperties>("Material", "Properties", () => materialDebugSettings.debugViewProperties, (value) => SetDebugViewProperties((Attributes.DebugViewProperties)value));
DebugMenuManager.instance.AddDebugItem<int>("Material", "GBuffer",() => materialDebugSettings.debugViewGBuffer, (value) => SetDebugViewGBuffer((int)value), DebugItemFlag.None, new DebugItemHandlerIntEnum(MaterialDebugSettings.debugViewMaterialGBufferStrings, MaterialDebugSettings.debugViewMaterialGBufferValues));
DebugMenuManager.instance.AddDebugItem<LightingDebugPanel, bool>(kEnableShadowDebug, () => lightingDebugSettings.enableShadows, (value) => lightingDebugSettings.enableShadows = (bool)value);
DebugMenuManager.instance.AddDebugItem<LightingDebugPanel, ShadowMapDebugMode>(kShadowDebugMode, () => lightingDebugSettings.shadowDebugMode, (value) => lightingDebugSettings.shadowDebugMode = (ShadowMapDebugMode)value);
DebugMenuManager.instance.AddDebugItem<LightingDebugPanel, bool>(kShadowSelectionDebug, () => lightingDebugSettings.shadowDebugUseSelection, (value) => lightingDebugSettings.shadowDebugUseSelection = (bool)value, DebugItemFlag.EditorOnly);
DebugMenuManager.instance.AddDebugItem<LightingDebugPanel, uint>(kShadowMapIndexDebug, () => lightingDebugSettings.shadowMapIndex, (value) => lightingDebugSettings.shadowMapIndex = (uint)value, DebugItemFlag.None, new DebugItemHandlerShadowIndex(1));

DebugMenuManager.instance.AddDebugItem<LightingDebugPanel, Color>(kDebugLightingAlbedo, () => lightingDebugSettings.debugLightingAlbedo, (value) => lightingDebugSettings.debugLightingAlbedo = (Color)value);
DebugMenuManager.instance.AddDebugItem<bool>("Lighting", kDisplaySkyReflectionDebug, () => lightingDebugSettings.displaySkyReflection, (value) => lightingDebugSettings.displaySkyReflection = (bool)value);
DebugMenuManager.instance.AddDebugItem<LightingDebugPanel, float>(kSkyReflectionMipmapDebug, () => lightingDebugSettings.skyReflectionMipmap, (value) => lightingDebugSettings.skyReflectionMipmap = (float)value, DebugItemFlag.None, new DebugItemHandlerFloatMinMax(0.0f, 1.0f));
DebugMenuManager.instance.AddDebugItem<LightingDebugPanel, LightLoopSettings.TileClusterDebug>(kTileClusterDebug,() => lightingDebugSettings.tileClusterDebug, (value) => lightingDebugSettings.tileClusterDebug = (LightLoopSettings.TileClusterDebug)value);
DebugMenuManager.instance.AddDebugItem<LightingDebugPanel, LightLoopSettings.TileClusterCategoryDebug>(kTileClusterCategoryDebug,() => lightingDebugSettings.tileClusterDebugByCategory, (value) => lightingDebugSettings.tileClusterDebugByCategory = (LightLoopSettings.TileClusterCategoryDebug)value);
DebugMenuManager.instance.AddDebugItem<LightingDebugPanel, LightLoop.TileClusterDebug>(kTileClusterDebug,() => lightingDebugSettings.tileClusterDebug, (value) => lightingDebugSettings.tileClusterDebug = (LightLoop.TileClusterDebug)value);
DebugMenuManager.instance.AddDebugItem<LightingDebugPanel, LightLoop.TileClusterCategoryDebug>(kTileClusterCategoryDebug,() => lightingDebugSettings.tileClusterDebugByCategory, (value) => lightingDebugSettings.tileClusterDebugByCategory = (LightLoop.TileClusterCategoryDebug)value);
DebugMenuManager.instance.AddDebugItem<bool>("Rendering", "Display Opaque",() => renderingDebugSettings.displayOpaqueObjects, (value) => renderingDebugSettings.displayOpaqueObjects = (bool)value);
DebugMenuManager.instance.AddDebugItem<bool>("Rendering", "Display Transparency",() => renderingDebugSettings.displayTransparentObjects, (value) => renderingDebugSettings.displayTransparentObjects = (bool)value);
DebugMenuManager.instance.AddDebugItem<bool>("Rendering", "Enable Atmospheric Scattering",() => renderingDebugSettings.enableAtmosphericScattering, (value) => renderingDebugSettings.enableAtmosphericScattering = (bool)value);
DebugMenuManager.instance.AddDebugItem<bool>("Rendering", "Enable Distortion",() => renderingDebugSettings.enableDistortion, (value) => renderingDebugSettings.enableDistortion = (bool)value);
DebugMenuManager.instance.AddDebugItem<bool>("Rendering", "Enable Subsurface Scattering",() => renderingDebugSettings.enableSSSAndTransmission, (value) => renderingDebugSettings.enableSSSAndTransmission = (bool)value);
DebugMenuManager.instance.AddDebugItem<bool>("Rendering", "Allow Stereo Rendering",() => renderingDebugSettings.allowStereo, (value) => renderingDebugSettings.allowStereo = (bool)value);
DebugMenuManager.instance.AddDebugItem<int>("Rendering", kFullScreenDebugMode, () => (int)fullScreenDebugMode, (value) => fullScreenDebugMode = (FullScreenDebugMode)value, DebugItemFlag.None, new DebugItemHandlerIntEnum(DebugDisplaySettings.renderingFullScreenDebugStrings, DebugDisplaySettings.renderingFullScreenDebugValues));
}

5
ScriptableRenderPipeline/HDRenderPipeline/Debug/LightingDebug.cs


}
public DebugLightingMode debugLightingMode = DebugLightingMode.None;
public bool enableShadows = true;
public ShadowMapDebugMode shadowDebugMode = ShadowMapDebugMode.None;
public bool shadowDebugUseSelection = false;
public uint shadowMapIndex = 0;

public bool displaySkyReflection = false;
public float skyReflectionMipmap = 0.0f;
public LightLoopSettings.TileClusterDebug tileClusterDebug = LightLoopSettings.TileClusterDebug.None;
public LightLoopSettings.TileClusterCategoryDebug tileClusterDebugByCategory = LightLoopSettings.TileClusterCategoryDebug.Punctual;
public LightLoop.TileClusterDebug tileClusterDebug = LightLoop.TileClusterDebug.None;
public LightLoop.TileClusterCategoryDebug tileClusterDebugByCategory = LightLoop.TileClusterCategoryDebug.Punctual;
public void OnValidate()
{

36
ScriptableRenderPipeline/HDRenderPipeline/Editor/HDRenderPipelineInspector.Styles.cs


{
public sealed partial class HDRenderPipelineInspector
{
// TODO: missing tooltips
sealed class Styles
{
public readonly GUIContent defaults = new GUIContent("Defaults");

public readonly GUIContent settingsLabel = new GUIContent("Settings");
// Rendering Settings
public readonly GUIContent renderingSettingsLabel = new GUIContent("Rendering Settings");
public readonly GUIContent useForwardRenderingOnly = new GUIContent("Use Forward Rendering Only");
public readonly GUIContent useDepthPrepassWithDeferredRendering = new GUIContent("Use Depth Prepass with Deferred rendering");
public readonly GUIContent renderAlphaTestOnlyInDeferredPrepass = new GUIContent("Alpha Test Only");
public readonly GUIContent renderPipelineSettings = new GUIContent("Render Pipeline Settings");
// Texture Settings
public readonly GUIContent textureSettings = new GUIContent("Texture Settings");
public readonly GUIContent supportDBuffer = new GUIContent("Support Decal buffer");
public readonly GUIContent supportMSAA = new GUIContent("Support MSAA");
// Shadow Settings
public readonly GUIContent shadowSettings = new GUIContent("Shadow Settings");
public readonly GUIContent shadowsAtlasWidth = new GUIContent("Atlas Width");
public readonly GUIContent shadowsAtlasHeight = new GUIContent("Atlas Height");
// LightLoop Settings
public readonly GUIContent textureSettings = new GUIContent("LightLoop Settings");
public readonly GUIContent sssSettings = new GUIContent("Subsurface Scattering Settings");
public readonly GUIContent defaultFrameSettings = new GUIContent("Default Frame Settings");
// Shadow Settings
public readonly GUIContent shadowSettings = new GUIContent("Shadow Settings");
public readonly GUIContent shadowsAtlasWidth = new GUIContent("Atlas Width");
public readonly GUIContent shadowsAtlasHeight = new GUIContent("Atlas Height");
// Rendering Settings
public readonly GUIContent renderingSettingsLabel = new GUIContent("Rendering Settings");
public readonly GUIContent useForwardRenderingOnly = new GUIContent("Use Forward Rendering Only");
public readonly GUIContent useDepthPrepassWithDeferredRendering = new GUIContent("Use Depth Prepass with Deferred rendering");
public readonly GUIContent renderAlphaTestOnlyInDeferredPrepass = new GUIContent("Alpha Test Only");
public readonly GUIContent enableAsyncCompute = new GUIContent("Enable Async Compute");
// Tile pass Settings
public readonly GUIContent tileLightLoopSettings = new GUIContent("Tile Light Loop Settings");
// LightLoop Settings
public readonly GUIContent lightLoopSettings = new GUIContent("Light Loop Settings");
public readonly GUIContent enableTileAndCluster = new GUIContent("Tile/Clustered");
public readonly GUIContent enableComputeLightEvaluation = new GUIContent("Compute Light Evaluation");
public readonly GUIContent enableComputeLightVariants = new GUIContent("Compute Light Variants");

public readonly GUIContent enableAsyncCompute = new GUIContent("Enable Async Compute");
public readonly GUIContent sssSettings = new GUIContent("Subsurface Scattering Settings");
}
static Styles s_Styles;

206
ScriptableRenderPipeline/HDRenderPipeline/Editor/HDRenderPipelineInspector.cs


SerializedProperty m_DefaultDiffuseMaterial;
SerializedProperty m_DefaultShader;
// Global Frame Settings
// Global Render settings
SerializedProperty m_supportDBuffer;
SerializedProperty m_supportMSAA;
// Global Shadow settings
SerializedProperty m_ShadowAtlasWidth;
SerializedProperty m_ShadowAtlasHeight;
// Global LightLoop settings
SerializedProperty m_SpotCookieSize;
SerializedProperty m_PointCookieSize;
SerializedProperty m_ReflectionCubemapSize;
SerializedProperty m_ReflectionCacheCompressed;
// FrameSettings
// LightLoop settings
SerializedProperty m_enableTileAndCluster;
SerializedProperty m_enableSplitLightEvaluation;

SerializedProperty m_enableFptlForForwardOpaque;
SerializedProperty m_enableBigTilePrepass;
SerializedProperty m_enableAsyncCompute;
SerializedProperty m_enableAsyncCompute;
// Shadow Settings
SerializedProperty m_ShadowAtlasWidth;
SerializedProperty m_ShadowAtlasHeight;
// Texture Settings
SerializedProperty m_SpotCookieSize;
SerializedProperty m_PointCookieSize;
SerializedProperty m_ReflectionCubemapSize;
SerializedProperty m_ReflectionCacheCompressed;
void InitializeProperties()
{
m_RenderPipelineResources = properties.Find("m_RenderPipelineResources");

// Tile settings
m_enableTileAndCluster = properties.Find(x => x.lightLoopSettings.enableTileAndCluster);
m_enableComputeLightEvaluation = properties.Find(x => x.lightLoopSettings.enableComputeLightEvaluation);
m_enableComputeLightVariants = properties.Find(x => x.lightLoopSettings.enableComputeLightVariants);
m_enableComputeMaterialVariants = properties.Find(x => x.lightLoopSettings.enableComputeMaterialVariants);
m_enableFptlForForwardOpaque = properties.Find(x => x.lightLoopSettings.enableFptlForForwardOpaque);
m_enableBigTilePrepass = properties.Find(x => x.lightLoopSettings.enableBigTilePrepass);
m_enableAsyncCompute = properties.Find(x => x.lightLoopSettings.enableAsyncCompute);
// Global FrameSettings
// Global Render settings
m_supportDBuffer = properties.Find(x => x.renderPipelineSettings.supportDBuffer);
m_supportMSAA = properties.Find(x => x.renderPipelineSettings.supportMSAA);
// Global Shadow settings
m_ShadowAtlasWidth = properties.Find(x => x.renderPipelineSettings.shadowInitParams.shadowAtlasWidth);
m_ShadowAtlasHeight = properties.Find(x => x.renderPipelineSettings.shadowInitParams.shadowAtlasHeight);
// Global LightLoop settings
m_SpotCookieSize = properties.Find(x => x.renderPipelineSettings.lightLoopSettings.spotCookieSize);
m_PointCookieSize = properties.Find(x => x.renderPipelineSettings.lightLoopSettings.pointCookieSize);
m_ReflectionCubemapSize = properties.Find(x => x.renderPipelineSettings.lightLoopSettings.reflectionCubemapSize);
m_ReflectionCacheCompressed = properties.Find(x => x.renderPipelineSettings.lightLoopSettings.reflectionCacheCompressed);
// Shadow settings
m_ShadowAtlasWidth = properties.Find(x => x.shadowInitParams.shadowAtlasWidth);
m_ShadowAtlasHeight = properties.Find(x => x.shadowInitParams.shadowAtlasHeight);
// Texture settings
m_SpotCookieSize = properties.Find(x => x.globalTextureSettings.spotCookieSize);
m_PointCookieSize = properties.Find(x => x.globalTextureSettings.pointCookieSize);
m_ReflectionCubemapSize = properties.Find(x => x.globalTextureSettings.reflectionCubemapSize);
m_ReflectionCacheCompressed = properties.Find(x => x.globalTextureSettings.reflectionCacheCompressed);
// Rendering settings
m_RenderingUseForwardOnly = properties.Find(x => x.globalRenderingSettings.useForwardRenderingOnly);
m_RenderingUseDepthPrepass = properties.Find(x => x.globalRenderingSettings.useDepthPrepassWithDeferredRendering);
m_RenderingUseDepthPrepassAlphaTestOnly = properties.Find(x => x.globalRenderingSettings.renderAlphaTestOnlyInDeferredPrepass);
// FrameSettings
// LightLoop settings
m_enableTileAndCluster = properties.Find(x => x.serializedFrameSettings.lightLoopSettings.enableTileAndCluster);
m_enableComputeLightEvaluation = properties.Find(x => x.serializedFrameSettings.lightLoopSettings.enableComputeLightEvaluation);
m_enableComputeLightVariants = properties.Find(x => x.serializedFrameSettings.lightLoopSettings.enableComputeLightVariants);
m_enableComputeMaterialVariants = properties.Find(x => x.serializedFrameSettings.lightLoopSettings.enableComputeMaterialVariants);
m_enableFptlForForwardOpaque = properties.Find(x => x.serializedFrameSettings.lightLoopSettings.enableFptlForForwardOpaque);
m_enableBigTilePrepass = properties.Find(x => x.serializedFrameSettings.lightLoopSettings.enableBigTilePrepass);
// Rendering Settings
m_enableAsyncCompute = properties.Find(x => x.serializedFrameSettings.enableAsyncCompute);
m_RenderingUseForwardOnly = properties.Find(x => x.serializedFrameSettings.enableForwardRenderingOnly);
m_RenderingUseDepthPrepass = properties.Find(x => x.serializedFrameSettings.enableDepthPrepassWithDeferredRendering);
m_RenderingUseDepthPrepassAlphaTestOnly = properties.Find(x => x.serializedFrameSettings.enableAlphaTestOnlyInDeferredPrepass);
// Subsurface Scattering Settings
m_SubsurfaceScatteringSettings = properties.Find(x => x.sssSettings);

method.Invoke(asset, new object[0]);
}
void TileSettingsUI(HDRenderPipelineAsset renderContext)
void GlobalLightLoopSettingsUI(HDRenderPipelineAsset hdAsset)
EditorGUILayout.LabelField(s_Styles.tileLightLoopSettings);
EditorGUILayout.LabelField(s_Styles.textureSettings);
EditorGUILayout.PropertyField(m_enableTileAndCluster, s_Styles.enableTileAndCluster);
if (m_enableTileAndCluster.boolValue)
{
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(m_enableBigTilePrepass, s_Styles.enableBigTilePrepass);
// Allow to disable cluster for foward opaque when in forward only (option have no effect when MSAA is enabled)
// Deferred opaque are always tiled
EditorGUILayout.PropertyField(m_enableFptlForForwardOpaque, s_Styles.enableFptlForForwardOpaque);
EditorGUILayout.PropertyField(m_enableComputeLightEvaluation, s_Styles.enableComputeLightEvaluation);
if (m_enableComputeLightEvaluation.boolValue)
{
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(m_enableComputeLightVariants, s_Styles.enableComputeLightVariants);
EditorGUILayout.PropertyField(m_enableComputeMaterialVariants, s_Styles.enableComputeMaterialVariants);
EditorGUI.indentLevel--;
}
EditorGUILayout.PropertyField(m_enableAsyncCompute, s_Styles.enableAsyncCompute);
}
EditorGUILayout.PropertyField(m_SpotCookieSize, s_Styles.spotCookieSize);
EditorGUILayout.PropertyField(m_PointCookieSize, s_Styles.pointCookieSize);
EditorGUILayout.PropertyField(m_ReflectionCubemapSize, s_Styles.reflectionCubemapSize);
// Commented out until we have proper realtime BC6H compression
//EditorGUILayout.PropertyField(m_ReflectionCacheCompressed, s_Styles.reflectionCacheCompressed);
HackSetDirty(renderContext); // Repaint
HackSetDirty(hdAsset); // Repaint
void SssSettingsUI(HDRenderPipelineAsset renderContext)
void GlobalRenderSettingsUI(HDRenderPipelineAsset hdAsset)
EditorGUILayout.PropertyField(m_SubsurfaceScatteringSettings, s_Styles.sssSettings);
}
void SettingsUI(HDRenderPipelineAsset renderContext)
{
EditorGUILayout.LabelField(s_Styles.settingsLabel, EditorStyles.boldLabel);
EditorGUILayout.Space();
EditorGUILayout.LabelField(s_Styles.renderingSettingsLabel);
SssSettingsUI(renderContext);
ShadowSettingsUI(renderContext);
TextureSettingsUI(renderContext);
RendereringSettingsUI(renderContext);
TileSettingsUI(renderContext);
EditorGUI.BeginChangeCheck();
EditorGUILayout.PropertyField(m_supportDBuffer, s_Styles.supportDBuffer);
EditorGUILayout.PropertyField(m_supportMSAA, s_Styles.supportMSAA);
if (EditorGUI.EndChangeCheck())
{
HackSetDirty(hdAsset); // Repaint
}
void ShadowSettingsUI(HDRenderPipelineAsset renderContext)
void GlobalShadowSettingsUI(HDRenderPipelineAsset hdAsset)
if (EditorGUI.EndChangeCheck())
{
HackSetDirty(hdAsset); // Repaint
}
EditorGUI.indentLevel--;
}
void LightLoopSettingsUI(HDRenderPipelineAsset hdAsset)
{
EditorGUILayout.Space();
EditorGUILayout.LabelField(s_Styles.lightLoopSettings);
EditorGUI.indentLevel++;
EditorGUI.BeginChangeCheck();
EditorGUILayout.PropertyField(m_enableTileAndCluster, s_Styles.enableTileAndCluster);
if (m_enableTileAndCluster.boolValue)
{
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(m_enableBigTilePrepass, s_Styles.enableBigTilePrepass);
// Allow to disable cluster for forward opaque when in forward only (option have no effect when MSAA is enabled)
// Deferred opaque are always tiled
EditorGUILayout.PropertyField(m_enableFptlForForwardOpaque, s_Styles.enableFptlForForwardOpaque);
EditorGUILayout.PropertyField(m_enableComputeLightEvaluation, s_Styles.enableComputeLightEvaluation);
if (m_enableComputeLightEvaluation.boolValue)
{
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(m_enableComputeLightVariants, s_Styles.enableComputeLightVariants);
EditorGUILayout.PropertyField(m_enableComputeMaterialVariants, s_Styles.enableComputeMaterialVariants);
EditorGUI.indentLevel--;
}
}
HackSetDirty(renderContext); // Repaint
HackSetDirty(hdAsset); // Repaint
void RendereringSettingsUI(HDRenderPipelineAsset renderContext)
void RendereringSettingsUI(HDRenderPipelineAsset hdAsset)
{
EditorGUILayout.Space();
EditorGUILayout.LabelField(s_Styles.renderingSettingsLabel);

if (!m_RenderingUseForwardOnly.boolValue) // If we are deferred
{
EditorGUILayout.PropertyField(m_RenderingUseDepthPrepass, s_Styles.useDepthPrepassWithDeferredRendering);
if(m_RenderingUseDepthPrepass.boolValue)
if (m_RenderingUseDepthPrepass.boolValue)
{
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(m_RenderingUseDepthPrepassAlphaTestOnly, s_Styles.renderAlphaTestOnlyInDeferredPrepass);

EditorGUILayout.PropertyField(m_enableAsyncCompute, s_Styles.enableAsyncCompute);
void TextureSettingsUI(HDRenderPipelineAsset renderContext)
void SettingsUI(HDRenderPipelineAsset hdAsset)
EditorGUILayout.LabelField(s_Styles.settingsLabel, EditorStyles.boldLabel);
EditorGUI.indentLevel++;
EditorGUILayout.LabelField(s_Styles.renderPipelineSettings, EditorStyles.boldLabel);
GlobalRenderSettingsUI(hdAsset);
GlobalShadowSettingsUI(hdAsset);
GlobalLightLoopSettingsUI(hdAsset);
EditorGUILayout.LabelField(s_Styles.defaultFrameSettings, EditorStyles.boldLabel);
EditorGUILayout.LabelField(s_Styles.textureSettings);
EditorGUI.indentLevel++;
EditorGUI.BeginChangeCheck();
RendereringSettingsUI(hdAsset);
LightLoopSettingsUI(hdAsset);
EditorGUILayout.PropertyField(m_SpotCookieSize, s_Styles.spotCookieSize);
EditorGUILayout.PropertyField(m_PointCookieSize, s_Styles.pointCookieSize);
EditorGUILayout.PropertyField(m_ReflectionCubemapSize, s_Styles.reflectionCubemapSize);
// Commented ou until we have proper realtime BC6H compression
//EditorGUILayout.PropertyField(m_ReflectionCacheCompressed, s_Styles.reflectionCacheCompressed);
EditorGUI.indentLevel--;
if (EditorGUI.EndChangeCheck())
{
HackSetDirty(renderContext); // Repaint
}
EditorGUI.indentLevel--;
EditorGUILayout.Space();
EditorGUILayout.PropertyField(m_SubsurfaceScatteringSettings, s_Styles.sssSettings);
}
protected override void OnEnable()

EditorGUILayout.LabelField(s_Styles.defaults, EditorStyles.boldLabel);
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(m_RenderPipelineResources, s_Styles.renderPipelineResources);
EditorGUILayout.PropertyField(m_RenderPipelineResources, s_Styles.renderPipelineResources);
EditorGUILayout.PropertyField(m_DefaultDiffuseMaterial, s_Styles.defaultDiffuseMaterial);
EditorGUILayout.PropertyField(m_DefaultShader, s_Styles.defaultShader);
EditorGUI.indentLevel--;

2
ScriptableRenderPipeline/HDRenderPipeline/Editor/HDRenderPipelineMenuItems.cs


using System.IO;
using System.IO;
using UnityEngine;
using UnityEngine.Experimental.Rendering;
using UnityEngine.Experimental.Rendering.HDPipeline;

10
ScriptableRenderPipeline/HDRenderPipeline/Editor/Lighting/HDLightEditor.Styles.cs


public readonly GUIContent fadeDistance = new GUIContent("Fade Distance", "The distance at which the light will smoothly fade before being culled to minimize popping.");
public readonly GUIContent spotInnerPercent = new GUIContent("Inner Percent", "Controls size of the angular attenuation in percent of the base angle of the Spot light's cone.");
public readonly GUIContent spotLightShape = new GUIContent("Shape", "The shape use for the spotlight. Has an impact on the cookie transformation and light angular attenuation.");
public readonly GUIContent shapeLengthLine = new GUIContent("Length", "Length of the line light");
public readonly GUIContent shapeLengthRect = new GUIContent("Size X", "SizeX of the rectangle light");
public readonly GUIContent shapeWidthRect = new GUIContent("Size Y", "SizeY of the rectangle light");
public readonly GUIContent shapeWidthLine = new GUIContent("Length", "Length of the line light");
public readonly GUIContent shapeWidthRect = new GUIContent("Size X", "SizeX of the rectangle light");
public readonly GUIContent shapeHeightRect = new GUIContent("Size Y", "SizeY of the rectangle light");
public readonly GUIContent shapeLengthBox = new GUIContent("Size X", "");
public readonly GUIContent shapeWidthBox = new GUIContent("Size Y", "");
public readonly GUIContent shapeWidthBox = new GUIContent("Size X", "");
public readonly GUIContent shapeHeightBox = new GUIContent("Size Y", "");
public readonly GUIContent applyRangeAttenuation = new GUIContent("Apply Range Attenuation", "Allows disabling range attenuation. This is useful indoor (like a room) to avoid having to setup a large range for a light to get correct inverse square attenuation that may leak out of the indoor");
public readonly GUIContent shape = new GUIContent("Type", "Specifies the current type of light. Possible types are Directional, Spot, Point, Rectangle and Line lights.");

20
ScriptableRenderPipeline/HDRenderPipeline/Editor/Lighting/HDLightEditor.cs


public SerializedProperty affectSpecular;
public SerializedProperty lightTypeExtent;
public SerializedProperty spotLightShape;
public SerializedProperty shapeLength;
public SerializedProperty shapeHeight;
public SerializedProperty aspectRatio;
public SerializedProperty shapeRadius;
public SerializedProperty maxSmoothness;

affectSpecular = o.Find(x => x.affectSpecular),
lightTypeExtent = o.Find(x => x.lightTypeExtent),
spotLightShape = o.Find(x => x.spotLightShape),
shapeLength = o.Find(x => x.shapeLength),
shapeHeight = o.Find(x => x.shapeHeight),
aspectRatio = o.Find(x => x.aspectRatio),
shapeRadius = o.Find(x => x.shapeRadius),
maxSmoothness = o.Find(x => x.maxSmoothness),

}
else if (spotLightShape == SpotLightShape.Box)
{
EditorGUILayout.PropertyField(m_AdditionalLightData.shapeLength, s_Styles.shapeLengthBox);
EditorGUILayout.PropertyField(m_AdditionalLightData.shapeHeight, s_Styles.shapeHeightBox);
}
EditorGUILayout.PropertyField(m_AdditionalLightData.maxSmoothness, s_Styles.maxSmoothness);
break;

//m_BaseData.type.enumValueIndex = (int)LightType.Area;
settings.lightType.enumValueIndex = (int)LightType.Point;
m_AdditionalLightData.lightTypeExtent.enumValueIndex = (int)LightTypeExtent.Rectangle;
EditorGUILayout.PropertyField(m_AdditionalLightData.shapeLength, s_Styles.shapeLengthRect);
settings.areaSizeX.floatValue = m_AdditionalLightData.shapeLength.floatValue;
settings.areaSizeY.floatValue = m_AdditionalLightData.shapeWidth.floatValue;
EditorGUILayout.PropertyField(m_AdditionalLightData.shapeHeight, s_Styles.shapeHeightRect);
settings.areaSizeX.floatValue = m_AdditionalLightData.shapeWidth.floatValue;
settings.areaSizeY.floatValue = m_AdditionalLightData.shapeHeight.floatValue;
settings.shadowsType.enumValueIndex = (int)LightShadows.None;
break;

settings.lightType.enumValueIndex = (int)LightType.Point;
m_AdditionalLightData.lightTypeExtent.enumValueIndex = (int)LightTypeExtent.Line;
EditorGUILayout.PropertyField(m_AdditionalLightData.shapeLength, s_Styles.shapeLengthLine);
EditorGUILayout.PropertyField(m_AdditionalLightData.shapeWidth, s_Styles.shapeWidthLine);
settings.areaSizeX.floatValue = m_AdditionalLightData.shapeLength.floatValue;
settings.areaSizeX.floatValue = m_AdditionalLightData.shapeWidth.floatValue;
settings.areaSizeY.floatValue = 0.01f;
settings.shadowsType.enumValueIndex = (int)LightShadows.None;
break;

if (settings.cookie != null && m_LightShape == LightShape.Directional)
{
EditorGUI.indentLevel++;
EditorGUILayout.Slider(m_AdditionalLightData.shapeLength, 0.01f, 10f, s_Styles.cookieSizeX);
EditorGUILayout.Slider(m_AdditionalLightData.shapeWidth, 0.01f, 10f, s_Styles.cookieSizeY);
EditorGUILayout.Slider(m_AdditionalLightData.shapeWidth, 0.01f, 10f, s_Styles.cookieSizeX);
EditorGUILayout.Slider(m_AdditionalLightData.shapeHeight, 0.01f, 10f, s_Styles.cookieSizeY);
EditorGUI.indentLevel--;
}
}

2
ScriptableRenderPipeline/HDRenderPipeline/Editor/Material/Lit/LitUI.cs


}
// TODO: Optimize me
var profiles = hdPipeline.sssSettings.profiles;
var profiles = sssSettings.profiles;
var names = new GUIContent[profiles.Length + 1];
names[0] = new GUIContent("None");

228
ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipeline.cs


RenderTargetIdentifier[] m_RTIDs = new RenderTargetIdentifier[k_MaxDbuffer];
public void InitDBuffers(int width, int height, CommandBuffer cmd)
{
{
dbufferCount = Decal.GetMaterialDBufferCount();
RenderTextureFormat[] rtFormat;
RenderTextureReadWrite[] rtReadWrite;

static readonly RenderQueueRange k_RenderQueue_AllTransparent = new RenderQueueRange { min = (int)HDRenderQueue.PreRefraction, max = (int)HDRenderQueue.Overlay - 1 };
readonly HDRenderPipelineAsset m_Asset;
SubsurfaceScatteringSettings m_InternalSSSAsset;
public SubsurfaceScatteringSettings sssSettings
{
get
{
// If no SSS asset is set, build / reuse an internal one for simplicity
var asset = m_Asset.sssSettings;
if (asset == null)
{
if (m_InternalSSSAsset == null)
m_InternalSSSAsset = ScriptableObject.CreateInstance<SubsurfaceScatteringSettings>();
asset = m_InternalSSSAsset;
}
return asset;
}
}
readonly RenderPipelineMaterial m_DeferredMaterial;
readonly List<RenderPipelineMaterial> m_MaterialList = new List<RenderPipelineMaterial>();

static DebugDisplaySettings s_NeutralDebugDisplaySettings = new DebugDisplaySettings();
DebugDisplaySettings m_CurrentDebugDisplaySettings;
FrameSettings m_FrameSettings; // Init every frame
SubsurfaceScatteringSettings m_InternalSSSAsset;
public SubsurfaceScatteringSettings sssSettings
{
get
{
// If no SSS asset is set, build / reuse an internal one for simplicity
var asset = m_Asset.sssSettings;
if (asset == null)
{
if (m_InternalSSSAsset == null)
m_InternalSSSAsset = ScriptableObject.CreateInstance<SubsurfaceScatteringSettings>();
asset = m_InternalSSSAsset;
}
return asset;
}
}
public HDRenderPipeline(HDRenderPipelineAsset asset)
{
m_Asset = asset;

m_CameraSssDiffuseLightingBuffer = HDShaderIDs._CameraSssDiffuseLightingBuffer;
m_CameraSssDiffuseLightingBufferRT = new RenderTargetIdentifier(m_CameraSssDiffuseLightingBuffer);
m_SSSBufferManager.Build(asset.renderPipelineResources, asset.sssSettings);
m_SSSBufferManager.Build(asset);
// Initialize various compute shader resources
m_applyDistortionKernel = m_applyDistortionCS.FindKernel("KMain");

m_DeferredShadowBuffer = HDShaderIDs._DeferredShadowTexture;
m_DeferredShadowBufferRT = new RenderTargetIdentifier(m_DeferredShadowBuffer);
m_MaterialList.ForEach(material => material.Build(asset.renderPipelineResources));
m_MaterialList.ForEach(material => material.Build(asset));
m_LightLoop.Build(asset.renderPipelineResources, asset.lightLoopSettings, asset.globalTextureSettings, asset.shadowInitParams, m_ShadowSettings, m_IBLFilterGGX);
m_LightLoop.Build(asset, m_ShadowSettings, m_IBLFilterGGX);
m_SkyManager.Build(asset.renderPipelineResources, m_IBLFilterGGX);
m_SkyManager.Build(asset, m_IBLFilterGGX);
FrameSettings.RegisterDebug("Default Camera", m_Asset.GetFrameSettings());
// Init all samplers
for (int i = 0; i < (int)CustomSamplerId.Max; i++)

}
InitializeRenderStateBlocks();
RegisterDebug();
}
void RegisterDebug()
{
// These need to be Runtime Only because those values are held by the HDRenderPipeline asset so if user change them through the editor debug menu they might change the value in the asset without noticing it.
DebugMenuManager.instance.AddDebugItem<bool>("HDRP", "Forward Only", () => m_Asset.globalRenderingSettings.useForwardRenderingOnly, (value) => m_Asset.globalRenderingSettings.useForwardRenderingOnly = (bool)value, DebugItemFlag.RuntimeOnly);
DebugMenuManager.instance.AddDebugItem<bool>("HDRP", "Deferred Depth Prepass", () => m_Asset.globalRenderingSettings.useDepthPrepassWithDeferredRendering, (value) => m_Asset.globalRenderingSettings.useDepthPrepassWithDeferredRendering = (bool)value, DebugItemFlag.RuntimeOnly);
DebugMenuManager.instance.AddDebugItem<bool>("HDRP", "Deferred Depth Prepass ATest Only", () => m_Asset.globalRenderingSettings.renderAlphaTestOnlyInDeferredPrepass, (value) => m_Asset.globalRenderingSettings.renderAlphaTestOnlyInDeferredPrepass = (bool)value, DebugItemFlag.RuntimeOnly);
DebugMenuManager.instance.AddDebugItem<bool>("HDRP", "Enable Tile/Cluster", () => m_Asset.lightLoopSettings.enableTileAndCluster, (value) => m_Asset.lightLoopSettings.enableTileAndCluster = (bool)value, DebugItemFlag.RuntimeOnly);
DebugMenuManager.instance.AddDebugItem<bool>("HDRP", "Enable Big Tile", () => m_Asset.lightLoopSettings.enableBigTilePrepass, (value) => m_Asset.lightLoopSettings.enableBigTilePrepass = (bool)value, DebugItemFlag.RuntimeOnly);
DebugMenuManager.instance.AddDebugItem<bool>("HDRP", "Enable Compute Lighting", () => m_Asset.lightLoopSettings.enableComputeLightEvaluation, (value) => m_Asset.lightLoopSettings.enableComputeLightEvaluation = (bool)value, DebugItemFlag.RuntimeOnly);
DebugMenuManager.instance.AddDebugItem<bool>("HDRP", "Enable Light Classification", () => m_Asset.lightLoopSettings.enableComputeLightVariants, (value) => m_Asset.lightLoopSettings.enableComputeLightVariants = (bool)value, DebugItemFlag.RuntimeOnly);
DebugMenuManager.instance.AddDebugItem<bool>("HDRP", "Enable Material Classification", () => m_Asset.lightLoopSettings.enableComputeMaterialVariants, (value) => m_Asset.lightLoopSettings.enableComputeMaterialVariants = (bool)value, DebugItemFlag.RuntimeOnly);
DebugMenuManager.instance.AddDebugItem<bool>("HDRP", "Enable Async Compute", () => m_Asset.lightLoopSettings.enableAsyncCompute, (value) => m_Asset.lightLoopSettings.enableAsyncCompute = (bool)value, DebugItemFlag.RuntimeOnly);
}
void InitializeDebugMaterials()

public void OnSceneLoad()
{
// Recreate the textures which went NULL
m_MaterialList.ForEach(material => material.Build(m_Asset.renderPipelineResources));
m_MaterialList.ForEach(material => material.Build(m_Asset));
}
public override void Dispose()

CoreUtils.Destroy(m_DebugDisplayLatlong);
CoreUtils.Destroy(m_DebugFullScreen);
CoreUtils.Destroy(m_ErrorMaterial);
CoreUtils.Destroy(m_InternalSSSAsset);
m_SSSBufferManager.Cleanup();
m_SkyManager.Cleanup();

{
hdCamera.SetupGlobalParams(cmd);
m_SSSBufferManager.PushGlobalParams(cmd, sssParameters, m_CurrentDebugDisplaySettings);
m_SSSBufferManager.PushGlobalParams(cmd, sssParameters, m_FrameSettings);
}
}

HDCamera.CleanUnused();
m_FrameCount = Time.frameCount;
}
var stereoActive = UnityEngine.XR.XRSettings.isDeviceActive && m_DebugDisplaySettings.renderingDebugSettings.allowStereo;
if (camera == null)
continue;
// First, get aggregate of frame settings base on global settings, camera frame settings and debug settings
var additionalCameraData = camera.GetComponent<HDAdditionalCameraData>();
// Note: the scene view camera will never have additionalCameraData
m_FrameSettings = FrameSettings.InitializeFrameSettings( camera, m_Asset.GetRenderPipelineSettings(),
(additionalCameraData && additionalCameraData.renderingPath != HDAdditionalCameraData.RenderingPath.Default) ? additionalCameraData.GetFrameSettings() : m_Asset.GetFrameSettings());
using (new ProfilingSample(cmd, "HDRenderPipeline::Render", GetSampler(CustomSamplerId.HDRenderPipelineRender)))
{
// Init material if needed
// TODO: this should be move outside of the camera loop but we have no command buffer, ask details to Tim or Julien to do this
if (!m_IBLFilterGGX.IsInitialized())
m_IBLFilterGGX.Initialize(cmd);
using (new ProfilingSample(cmd, "HDRenderPipeline::Render", GetSampler(CustomSamplerId.HDRenderPipelineRender)))
{
m_LightLoop.NewFrame();
if (camera == null)
{
renderContext.Submit();
continue;
}
m_LightLoop.NewFrame(m_FrameSettings);
// If we render a reflection view or a preview we should not display any debug information
// This need to be call before ApplyDebugDisplaySettings()

ApplyDebugDisplaySettings(cmd);
UpdateShadowSettings();
if (!m_IBLFilterGGX.IsInitialized())
m_IBLFilterGGX.Initialize(cmd);
ScriptableCullingParameters cullingParams;
if (!CullResults.GetCullingParameters(camera, out cullingParams))
{

}
var postProcessLayer = camera.GetComponent<PostProcessLayer>();
var hdCamera = HDCamera.Get(camera, postProcessLayer, m_Asset.globalRenderingSettings, stereoActive);
m_LightLoop.UpdateRenderingPathState(hdCamera.useForwardOnly);
var hdCamera = HDCamera.Get(camera, postProcessLayer);
Resize(camera);

// We have to bind the material specific global parameters in this mode
m_MaterialList.ForEach(material => material.Bind());
var additionalCameraData = camera.GetComponent<HDAdditionalCameraData>();
if (additionalCameraData && additionalCameraData.renderingPath == RenderingPathHDRP.Unlit)
if (additionalCameraData && additionalCameraData.renderingPath == HDAdditionalCameraData.RenderingPath.Unlit)
{
// TODO: Add another path dedicated to planar reflection / real time cubemap that implement simpler lighting
// It is up to the users to only send unlit object for this camera path

bool enableBakeShadowMask;
using (new ProfilingSample(cmd, "TP_PrepareLightsForGPU", GetSampler(CustomSamplerId.TPPrepareLightsForGPU)))
{
enableBakeShadowMask = m_LightLoop.PrepareLightsForGPU(cmd, m_ShadowSettings, m_CullResults, camera);
enableBakeShadowMask = m_LightLoop.PrepareLightsForGPU(cmd, m_ShadowSettings, m_CullResults, camera) && m_FrameSettings.enableShadowMask;
}
ConfigureForShadowMask(enableBakeShadowMask, cmd);

RenderSSAO(cmd, camera, renderContext, postProcessLayer);
}
bool enableAsyncCompute = m_LightLoop.IsAsyncEnabled();
if (enableAsyncCompute)
if (m_FrameSettings.enableAsyncCompute)
CommandBufferPool.Release(cmd);
cmd = CommandBufferPool.Get("");
cmd.Clear();
buildGPULightListsCompleteFence = m_LightLoop.BuildGPULightListsAsyncBegin(camera, renderContext, m_CameraDepthStencilBufferRT, m_CameraStencilBufferCopyRT, startFence, m_SkyManager.IsSkyValid());
}

}
}
if (enableAsyncCompute)
if (m_FrameSettings.enableAsyncCompute)
{
m_LightLoop.BuildGPULightListAsyncEnd(camera, cmd, buildGPULightListsCompleteFence);
}

RenderForwardError(m_CullResults, camera, renderContext, cmd, ForwardPass.Opaque);
// SSS pass here handle both SSS material from deferred and forward
m_SSSBufferManager.SubsurfaceScatteringPass(hdCamera, cmd, sssSettings, m_CurrentDebugDisplaySettings,
m_SSSBufferManager.SubsurfaceScatteringPass(hdCamera, cmd, sssSettings, m_FrameSettings,
m_CameraColorBufferRT, m_CameraSssDiffuseLightingBufferRT, m_CameraDepthStencilBufferRT, GetDepthTexture());
RenderSky(hdCamera, cmd);

RenderForward(m_CullResults, hdCamera, renderContext, cmd, ForwardPass.Transparent);
RenderForwardError(m_CullResults, camera, renderContext, cmd, ForwardPass.Transparent);
// Fill depth buffer to reduce artifact for transparent object
// Fill depth buffer to reduce artifact for transparent object during postprocess
// Planar and real time cubemap doesn't need post process and render in FP16
if (camera.cameraType == CameraType.Reflection)
RenderGaussianPyramidColor(camera, cmd, renderContext, FullScreenDebugMode.FinalColorPyramid);
AccumulateDistortion(m_CullResults, camera, renderContext, cmd);
RenderDistortion(cmd, m_Asset.renderPipelineResources);
// Final blit
if (m_FrameSettings.enablePostprocess && CoreUtils.IsPostProcessingActive(postProcessLayer))
{
RenderPostProcess(hdCamera, cmd, postProcessLayer);
}
else
{
using (new ProfilingSample(cmd, "Blit to final RT", GetSampler(CustomSamplerId.BlitToFinalRT)))
{

}
else
{
RenderGaussianPyramidColor(camera, cmd, renderContext, FullScreenDebugMode.FinalColorPyramid);
// TODO: Check with VFX team.
// Rendering distortion here have off course lot of artifact.
// But resolving at each objects that write in distortion is not possible (need to sort transparent, render those that do not distort, then resolve, then etc...)
// Instead we chose to apply distortion at the end after we cumulate distortion vector and desired blurriness.
AccumulateDistortion(m_CullResults, camera, renderContext, cmd);
RenderDistortion(cmd, m_Asset.renderPipelineResources);
RenderPostProcesses(hdCamera, cmd, postProcessLayer);
}
}
RenderDebug(hdCamera, cmd);

RenderStateBlock? stateBlock = null,
Material overrideMaterial = null)
{
if (!m_CurrentDebugDisplaySettings.renderingDebugSettings.displayOpaqueObjects)
if (!m_FrameSettings.enableOpaqueObjects)
return;
// This is done here because DrawRenderers API lives outside command buffers so we need to make call this before doing any DrawRenders

Material overrideMaterial = null
)
{
if (!m_CurrentDebugDisplaySettings.renderingDebugSettings.displayTransparentObjects)
if (!m_FrameSettings.enableTransparentObjects)
return;
// This is done here because DrawRenderers API lives outside command buffers so we need to make call this before doing any DrawRenders

void AccumulateDistortion(CullResults cullResults, Camera camera, ScriptableRenderContext renderContext, CommandBuffer cmd)
{
if (!m_CurrentDebugDisplaySettings.renderingDebugSettings.enableDistortion)
if (!m_FrameSettings.enableDistortion)
return;
using (new ProfilingSample(cmd, "Distortion", GetSampler(CustomSamplerId.Distortion)))

void RenderDistortion(CommandBuffer cmd, RenderPipelineResources resources)
{
if (!m_FrameSettings.enableDistortion)
return;
using (new ProfilingSample(cmd, "ApplyDistortion", GetSampler(CustomSamplerId.ApplyDistortion)))
{
var size = new Vector4(m_CurrentWidth, m_CurrentHeight, 1f / m_CurrentWidth, 1f / m_CurrentHeight);

// It must also have a "DepthForwardOnly" and no "DepthOnly" pass as forward material (either deferred or forward only rendering) have always a depth pass.
// In case of forward only rendering we have a depth prepass. In case of deferred renderer, it is optional
bool addFullDepthPrepass = hdCamera.useForwardOnly || m_Asset.globalRenderingSettings.useDepthPrepassWithDeferredRendering;
bool addAlphaTestedOnly = !hdCamera.useForwardOnly && m_Asset.globalRenderingSettings.useDepthPrepassWithDeferredRendering && m_Asset.globalRenderingSettings.renderAlphaTestOnlyInDeferredPrepass;
bool addFullDepthPrepass = m_FrameSettings.enableForwardRenderingOnly || m_FrameSettings.enableDepthPrepassWithDeferredRendering;
bool addAlphaTestedOnly = !m_FrameSettings.enableForwardRenderingOnly && m_FrameSettings.enableDepthPrepassWithDeferredRendering && m_FrameSettings.enableAlphaTestOnlyInDeferredPrepass;
var camera = hdCamera.camera;

}
}
if (m_FrameSettings.enableTransparentPrePass)
{
{
{
}
}
// RenderGBuffer do the gbuffer pass. This is solely call with deferred. If we use a depth prepass, then the depth prepass will perform the alpha testing for opaque apha tested and we don't need to do it anymore

if (hdCamera.useForwardOnly)
if (m_FrameSettings.enableForwardRenderingOnly)
return;
var camera = hdCamera.camera;

}
else
{
if (m_Asset.globalRenderingSettings.useDepthPrepassWithDeferredRendering)
if (m_FrameSettings.enableDepthPrepassWithDeferredRendering)
RenderOpaqueRenderList(cull, camera, renderContext, cmd, HDShaderPassNames.s_GBufferName, m_currentRendererConfigurationBakedLighting, rangeOpaqueNoAlphaTest, m_Asset.globalRenderingSettings.renderAlphaTestOnlyInDeferredPrepass ? m_DepthStateOpaque : m_DepthStateOpaqueWithPrepass);
RenderOpaqueRenderList(cull, camera, renderContext, cmd, HDShaderPassNames.s_GBufferName, m_currentRendererConfigurationBakedLighting, rangeOpaqueNoAlphaTest, m_FrameSettings.enableAlphaTestOnlyInDeferredPrepass ? m_DepthStateOpaque : m_DepthStateOpaqueWithPrepass);
// but for opaque alpha tested object we use a depth equal and no depth write. And we rely on the shader pass GbufferWithDepthPrepass
RenderOpaqueRenderList(cull, camera, renderContext, cmd, HDShaderPassNames.s_GBufferWithPrepassName, m_currentRendererConfigurationBakedLighting, rangeOpaqueAlphaTest, m_DepthStateOpaqueWithPrepass);
}

void RenderDBuffer(Vector3 cameraPos, ScriptableRenderContext renderContext, CommandBuffer cmd)
{
// Currently disabled
if (!m_FrameSettings.enableDBuffer)
return ;
using (new ProfilingSample(cmd, "DBuffer", GetSampler(CustomSamplerId.DBuffer)))

{
using (new ProfilingSample(cmd, "DisplayDebug ViewMaterial", GetSampler(CustomSamplerId.DisplayDebugViewMaterial)))
{
if (m_CurrentDebugDisplaySettings.materialDebugSettings.IsDebugGBufferEnabled() && !m_Asset.globalRenderingSettings.ShouldUseForwardRenderingOnly())
if (m_CurrentDebugDisplaySettings.materialDebugSettings.IsDebugGBufferEnabled() && !m_FrameSettings.enableForwardRenderingOnly)
{
using (new ProfilingSample(cmd, "DebugViewMaterialGBuffer", GetSampler(CustomSamplerId.DebugViewMaterialGBuffer)))
{

void RenderSSAO(CommandBuffer cmd, Camera camera, ScriptableRenderContext renderContext, PostProcessLayer postProcessLayer)
{
// Apply SSAO from PostProcessLayer
if (postProcessLayer != null && postProcessLayer.enabled)
if (m_FrameSettings.enableSSAO && postProcessLayer != null && postProcessLayer.enabled)
{
var settings = postProcessLayer.GetSettings<AmbientOcclusion>();

void RenderDeferredLighting(HDCamera hdCamera, CommandBuffer cmd)
{
if (hdCamera.useForwardOnly)
if (m_FrameSettings.enableForwardRenderingOnly)
return;
m_MRTCache2[0] = m_CameraColorBufferRT;

var options = new LightLoop.LightingPassOptions();
if (m_CurrentDebugDisplaySettings.renderingDebugSettings.enableSSSAndTransmission)
if (m_FrameSettings.enableSSSAndTransmission)
{
// Output split lighting for materials asking for it (masked in the stencil buffer)
options.outputSplitLighting = true;

if (pass == ForwardPass.Opaque)
{
// In case of forward SSS we will bind all the required target. It is up to the shader to write into it or not.
if (m_CurrentDebugDisplaySettings.renderingDebugSettings.enableSSSAndTransmission)
if (m_FrameSettings.enableSSSAndTransmission)
{
RenderTargetIdentifier[] m_MRTWithSSS = new RenderTargetIdentifier[2 + m_SSSBufferManager.sssBufferCount];
m_MRTWithSSS[0] = m_CameraColorBufferRT; // Store the specular color

m_ForwardAndForwardOnlyPassNames[1] = HDShaderPassNames.s_ForwardName;
}
var passNames = hdCamera.useForwardOnly ? m_ForwardAndForwardOnlyPassNames : m_ForwardOnlyPassNames;
var passNames = m_FrameSettings.enableForwardRenderingOnly ? m_ForwardAndForwardOnlyPassNames : m_ForwardOnlyPassNames;
// Forward opaque material always have a prepass (whether or not we use deferred, whether or not there is option like alpha test only) so we pass the right depth state here.
RenderOpaqueRenderList(cullResults, camera, renderContext, cmd, passNames, m_currentRendererConfigurationBakedLighting, null, m_DepthStateOpaqueWithPrepass);
}

void RenderTransparentDepthPostPass(CullResults cullResults, Camera camera, ScriptableRenderContext renderContext, CommandBuffer cmd, ForwardPass pass)
{
if (!m_FrameSettings.enableTransparentPostPass)
return;
using (new ProfilingSample(cmd, "Render Transparent Depth Post ", GetSampler(CustomSamplerId.TransparentDepthPostPass)))
{
CoreUtils.SetRenderTarget(cmd, m_CameraDepthStencilBufferRT);

void RenderVelocity(CullResults cullResults, HDCamera hdcam, ScriptableRenderContext renderContext, CommandBuffer cmd)
{
if (!m_FrameSettings.enableMotionVectors)
return;
using (new ProfilingSample(cmd, "Velocity", GetSampler(CustomSamplerId.Velocity)))
{
// If opaque velocity have been render during GBuffer no need to render it here

void RenderGaussianPyramidColor(Camera camera, CommandBuffer cmd, ScriptableRenderContext renderContext, FullScreenDebugMode debugMode)
{
if (!m_CurrentDebugDisplaySettings.renderingDebugSettings.enableGaussianPyramid)
if (debugMode == FullScreenDebugMode.PreRefractionColorPyramid)
{
if (!m_FrameSettings.enableRoughRefraction)
}
else if (debugMode == FullScreenDebugMode.FinalColorPyramid)
{
// TODO: This final Gaussian pyramid can be reuse by Bloom and SSR in the future, so disable it only if there is no postprocess AND no distortion
if (!m_FrameSettings.enableDistortion && !m_FrameSettings.enablePostprocess && !m_FrameSettings.enableSSR)
return;
}
using (new ProfilingSample(cmd, "Gaussian Pyramid Color", GetSampler(CustomSamplerId.GaussianPyramidColor)))
{

void RenderPyramidDepth(Camera camera, CommandBuffer cmd, ScriptableRenderContext renderContext, FullScreenDebugMode debugMode)
{
if (!m_CurrentDebugDisplaySettings.renderingDebugSettings.enableGaussianPyramid)
return;
using (new ProfilingSample(cmd, "Pyramid Depth", GetSampler(CustomSamplerId.PyramidDepth)))
{
int w = camera.pixelWidth;

}
}
void RenderPostProcesses(HDCamera hdcamera, CommandBuffer cmd, PostProcessLayer layer)
void RenderPostProcess(HDCamera hdcamera, CommandBuffer cmd, PostProcessLayer layer)
if (CoreUtils.IsPostProcessingActive(layer))
{
// Note: Here we don't use GetDepthTexture() to get the depth texture but m_CameraDepthStencilBuffer as the Forward transparent pass can
// write extra data to deal with DOF/MB
cmd.SetGlobalTexture(HDShaderIDs._CameraDepthTexture, m_CameraDepthStencilBuffer);

layer.Render(context);
}
else
{
cmd.Blit(m_CameraColorBufferRT, BuiltinRenderTextureType.CameraTarget);
}
}
m_ShadowSettings.enabled = m_CurrentDebugDisplaySettings.lightingDebugSettings.enableShadows;
m_ShadowSettings.enabled = m_FrameSettings.enableShadow;
var lightingDebugSettings = m_CurrentDebugDisplaySettings.lightingDebugSettings;
var debugAlbedo = new Vector4(lightingDebugSettings.debugLightingAlbedo.r, lightingDebugSettings.debugLightingAlbedo.g, lightingDebugSettings.debugLightingAlbedo.b, 0.0f);

cmd.GetTemporaryRT(m_DepthPyramidBuffer, m_DepthPyramidBufferDesc, FilterMode.Trilinear);
// End
if (!hdCamera.useForwardOnly)
if (!m_FrameSettings.enableForwardRenderingOnly)
{
m_GbufferManager.InitGBuffers(w, h, m_DeferredMaterial, enableBakeShadowMask, cmd);
m_SSSBufferManager.InitSSSBuffersFromGBuffer(w, h, m_GbufferManager, cmd);

}
// Clear GBuffers
if (!hdCamera.useForwardOnly)
if (!m_FrameSettings.enableForwardRenderingOnly)
{
using (new ProfilingSample(cmd, "Clear GBuffer", GetSampler(CustomSamplerId.ClearGBuffer)))
{

58
ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipelineAsset.asset


m_EditorClassIdentifier:
m_RenderPipelineResources: {fileID: 11400000, guid: 3ce144cff5783da45aa5d4fdc2da14b7,
type: 2}
globalRenderingSettings:
useForwardRenderingOnly: 0
useDepthPrepassWithDeferredRendering: 0
renderAlphaTestOnlyInDeferredPrepass: 0
globalTextureSettings:
spotCookieSize: 128
pointCookieSize: 512
reflectionCubemapSize: 128
reflectionCacheCompressed: 0
sssSettings: {fileID: 11400000, guid: c4d57f106d34d0046a33b3e66da29a72, type: 2}
lightLoopSettings:
enableTileAndCluster: 1
enableComputeLightEvaluation: 1
enableComputeLightVariants: 1
enableComputeMaterialVariants: 1
enableFptlForForwardOpaque: 1
enableBigTilePrepass: 1
enableAsyncCompute: 0
shadowInitParams:
shadowAtlasWidth: 4096
shadowAtlasHeight: 4096
defaultFrameSettings:
lightingSettings:
enableShadow: 1
enableSSR: 1
enableSSAO: 1
enableSSSAndTransmission: 1
diffuseGlobalDimmer: 1
specularGlobalDimmer: 1
renderSettings:
enableForwardRenderingOnly: 1
enableDepthPrepassWithDeferredRendering: 0
enableAlphaTestOnlyInDeferredPrepass: 0
enableTransparentPrePass: 1
enableMotionVectors: 1
enableDBuffer: 1
enableAtmosphericScattering: 1
enableRoughRefraction: 1
enableTransparentPostPass: 1
enableDistortion: 1
enablePostprocess: 1
enableStereo: 0
enableAsyncCompute: 0
enableOpaqueObjects: 1
enableTransparentObjects: 1
enableMSAA: 0
enableMaterialDisplayDebug: 0
enableShadowMask: 0
lightLoopSettings:
enableTileAndCluster: 1
enableComputeLightEvaluation: 1
enableComputeLightVariants: 1
enableComputeMaterialVariants: 1
enableFptlForForwardOpaque: 1
enableBigTilePrepass: 1
isFptlEnabled: 1
m_globalFrameSettings: {fileID: 0}
m_sssSettings: {fileID: 0}
m_DefaultDiffuseMaterial: {fileID: 2100000, guid: 73c176f402d2c2f4d929aa5da7585d17,
type: 2}
m_DefaultShader: {fileID: 4800000, guid: 6e4ae4064600d784cac1e41a9e6f2e59, type: 3}

40
ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipelineAsset.cs


set { m_RenderPipelineResources = value; }
}
// NOTE: All those properties are public because of how HDRenderPipelineInspector retrieves those properties via serialization/reflection
// Doing it this way allows to change parameters name and still retrieve correct serialized values
// To be able to turn on/off FrameSettings properties at runtime for debugging purpose without affecting the original one
// we create a runtime copy (m_ActiveFrameSettings that is used, and any parametrization is done on serialized frameSettings)
public FrameSettings serializedFrameSettings = new FrameSettings(); // This are the defaultFrameSettings for all the camera and apply to sceneView, public to be visible in the inspector
// Not serialized, not visible, the settings effectively used
FrameSettings m_FrameSettings = new FrameSettings();
// Global Renderer Settings
public GlobalRenderingSettings globalRenderingSettings = new GlobalRenderingSettings();
public GlobalTextureSettings globalTextureSettings = new GlobalTextureSettings();
public SubsurfaceScatteringSettings sssSettings;
public LightLoopSettings lightLoopSettings = new LightLoopSettings();
public FrameSettings GetFrameSettings()
{
return m_FrameSettings;
}
// Shadow Settings
public ShadowInitParameters shadowInitParams = new ShadowInitParameters();
public void OnValidate()
{
// Modification of defaultFrameSettings in the inspector will call OnValidate().
// We do a copy of the settings to those effectively used
serializedFrameSettings.CopyTo(m_FrameSettings);
}
// Store the various RenderPipelineSettings for each platform (for now only one)
public RenderPipelineSettings renderPipelineSettings = new RenderPipelineSettings();
// Return the current use RenderPipelineSettings (i.e for the current platform)
public RenderPipelineSettings GetRenderPipelineSettings()
{
return renderPipelineSettings;
}
[SerializeField]
public SubsurfaceScatteringSettings sssSettings;
// Default Material / Shader
[SerializeField]

public override Material GetDefault2DMaterial()
{
return null;
}
public void OnValidate()
{
}
}
}

8
ScriptableRenderPipeline/HDRenderPipeline/Lighting/HDAdditionalLightData.cs


// Only for Rectangle/Line/box projector lights
[Range(0.0f, 20.0f)]
[FormerlySerializedAs("lightLength")]
public float shapeLength = 0.5f;
[FormerlySerializedAs("lightWidth")]
public float shapeWidth = 0.5f;
[FormerlySerializedAs("lightWidth")]
public float shapeWidth = 0.5f;
[FormerlySerializedAs("lightHeight")]
public float shapeHeight = 0.5f;
// Only for pyramid projector
public float aspectRatio = 1.0f;

6
ScriptableRenderPipeline/HDRenderPipeline/Lighting/HDLightEditorUtilities.cs


{
var additionalLightData = spherelight.GetComponent<HDAdditionalLightData>();
if (additionalLightData == null) return;
Gizmos.DrawSphere(spherelight.transform.position, additionalLightData.shapeLength);
Gizmos.DrawSphere(spherelight.transform.position, additionalLightData.shapeWidth);
if (spherelight.shadows != LightShadows.None) Gizmos.DrawWireSphere(spherelight.transform.position, spherelight.shadowNearPlane);
Gizmos.DrawWireSphere(spherelight.transform.position, spherelight.range);
}

}
else // Ortho frustum
{
//DrawLightOrthoFrustum(Vector3.zero, additionalLightData.shapeLength, additionalLightData.shapeWidth, frustumlight.range, 0.0f);
//DrawLightOrthoFrustum(Vector3.zero, additionalLightData.shapeWidth, additionalLightData.shapeHeight, frustumlight.range, 0.0f);
Vector3 frustumsize = new Vector3(additionalLightData.shapeLength, additionalLightData.shapeWidth, frustumlight.range);
Vector3 frustumsize = new Vector3(additionalLightData.shapeWidth, additionalLightData.shapeHeight, frustumlight.range);
Gizmos.DrawWireCube(frustumCenter, frustumsize);
}
Gizmos.matrix = Matrix4x4.identity;

10
ScriptableRenderPipeline/HDRenderPipeline/Lighting/LightDefinition.cs


public Vector3 forward;
public int cookieIndex; // -1 if unused
public Vector3 right; // Rescaled by (2 / shapeLength)
public Vector3 right; // Rescaled by (2 / shapeWidth)
public Vector3 up; // Rescaled by (2 / shapeWidth)
public Vector3 up; // Rescaled by (2 / shapeHeight)
public float diffuseScale;
public Vector2 fadeDistanceScaleAndBias; // Use with ShadowMask feature

public Vector3 forward;
public int cookieIndex; // -1 if unused
public Vector3 right; // If spot: rescaled by cot(outerHalfAngle); if projector: rescaled by (2 / shapeLength)
public Vector3 right; // If spot: rescaled by cot(outerHalfAngle); if projector: rescaled by (2 / shapeWidth)
public Vector3 up; // If spot: rescaled by cot(outerHalfAngle); if projector: rescaled by (2 / shapeWidth)
public Vector3 up; // If spot: rescaled by cot(outerHalfAngle); if projector: rescaled by (2 / shapeHeight)
public float diffuseScale;
public float angleScale; // Spot light

public Vector4 shadowMaskSelector; // Use with ShadowMask feature
public Vector2 size; // Used by area and pyramid projector lights
public Vector2 size; // Used by area (X = length or width, Y = height) and box projector lights (X = range (depth))
public GPULightType lightType;
public float minRoughness; // This is use to give a small "area" to punctual light, as if we have a light with a radius.
};

236
ScriptableRenderPipeline/HDRenderPipeline/Lighting/LightLoop/LightLoop.cs


using UnityEngine.Rendering;
using UnityEngine.Rendering;
using System.Collections.Generic;
using System;

public float unused2;
};
[Serializable]
public class LightLoopSettings
public class LightLoop
public bool enableTileAndCluster; // For debug / test
public bool enableComputeLightEvaluation;
public bool enableComputeLightVariants;
public bool enableComputeMaterialVariants;
// Deferred opaque always use FPTL, forward opaque can use FPTL or cluster, transparent always use cluster
// When MSAA is enabled, we only support cluster (Fptl is too slow with MSAA), and we don't support MSAA for deferred path (mean it is ok to keep fptl)
public bool enableFptlForForwardOpaque;
// clustered light list specific buffers and data begin
public bool enableBigTilePrepass;
public bool enableAsyncCompute;
public enum TileClusterDebug : int
{
None,

EnvironmentAndAreaAndPunctual = 7
};
public LightLoopSettings()
{
enableTileAndCluster = true;
enableComputeLightEvaluation = true;
enableComputeLightVariants = true;
enableComputeMaterialVariants = true;
enableFptlForForwardOpaque = true;
enableBigTilePrepass = true;
enableAsyncCompute = false;
}
}
public class LightLoop
{
public const int k_MaxDirectionalLightsOnScreen = 4;
public const int k_MaxPunctualLightsOnScreen = 512;
public const int k_MaxAreaLightsOnScreen = 64;

static Cubemap m_DefaultTextureCube;
ReflectionProbeCache m_ReflectionProbeCache;
int m_ReflectionProbeCacheSize = 128;
int m_CookieTexArraySize = 16;
int m_CubeCookieTexArraySize = 16;
LightingSettings m_LightingSettings = new LightingSettings();
public class LightList
{

static int s_GenListPerBigTileKernel;
const bool k_UseDepthBuffer = true; // only has an impact when EnableClustered is true (requires a depth-prepass)
const bool k_UseAsyncCompute = true; // should not use on mobile
const int k_Log2NumClusters = 6; // accepted range is from 0 to 6. NumClusters is 1<<g_iLog2NumClusters
const float k_ClustLogBase = 1.02f; // each slice 2% bigger than the previous

static ComputeBuffer s_GlobalLightListAtomic = null;
// clustered light list specific buffers and data end
bool m_isForwardRenderingOnly;
bool m_isFptlEnabled;
bool m_isFptlEnabledForForwardOpaque;
FrameSettings m_FrameSettings = null;
RenderPipelineResources m_Resources = null;
// Following is an array of material of size eight for all combination of keyword: OUTPUT_SPLIT_LIGHTING - LIGHTLOOP_TILE_PASS - SHADOWS_SHADOWMASK - USE_FPTL_LIGHTLIST/USE_CLUSTERED_LIGHTLIST - DEBUG_DISPLAY
Material[] m_deferredLightingMaterial;

}
}
int GetNumTileFtplX(Camera camera)
{
return (camera.pixelWidth + (LightDefinitions.s_TileSizeFptl - 1)) / LightDefinitions.s_TileSizeFptl;

public bool GetFeatureVariantsEnabled()
{
return !m_isForwardRenderingOnly && m_isFptlEnabled && m_LightLoopSettings.enableComputeLightEvaluation &&
(m_LightLoopSettings.enableComputeLightVariants || m_LightLoopSettings.enableComputeMaterialVariants);
return !m_FrameSettings.enableForwardRenderingOnly && m_FrameSettings.lightLoopSettings.isFptlEnabled && m_FrameSettings.lightLoopSettings.enableComputeLightEvaluation &&
(m_FrameSettings.lightLoopSettings.enableComputeLightVariants || m_FrameSettings.lightLoopSettings.enableComputeMaterialVariants);
LightLoopSettings m_LightLoopSettings = null;
RenderPipelineResources m_Resources = null;
public LightLoop()
{}

return (outputSplitLighting) | (lightLoopTilePass << 1) | (shadowMask << 2) | (debugDisplay << 3);
}
public void Build( RenderPipelineResources renderPipelineResources,
LightLoopSettings lightLoopSettings,
GlobalTextureSettings textureSettings,
ShadowInitParameters shadowInit, ShadowSettings shadowSettings, IBLFilterGGX iblFilterGGX)
public void Build(HDRenderPipelineAsset hdAsset, ShadowSettings shadowSettings, IBLFilterGGX iblFilterGGX)
m_Resources = renderPipelineResources;
m_LightLoopSettings = lightLoopSettings;
m_Resources = hdAsset.renderPipelineResources;
m_lightList = new LightList();
m_lightList.Allocate();

s_EnvLightDatas = new ComputeBuffer(k_MaxEnvLightsOnScreen, System.Runtime.InteropServices.Marshal.SizeOf(typeof(EnvLightData)));
s_shadowDatas = new ComputeBuffer(k_MaxCascadeCount + k_MaxShadowOnScreen, System.Runtime.InteropServices.Marshal.SizeOf(typeof(ShadowData)));
GlobalLightLoopSettings gLightLoopSettings = hdAsset.GetRenderPipelineSettings().lightLoopSettings;
m_CookieTexArray.AllocTextureArray(m_CookieTexArraySize, textureSettings.spotCookieSize, textureSettings.spotCookieSize, TextureFormat.RGBA32, true);
m_CookieTexArray.AllocTextureArray(gLightLoopSettings.cookieTexArraySize, gLightLoopSettings.spotCookieSize, gLightLoopSettings.spotCookieSize, TextureFormat.RGBA32, true);
m_CubeCookieTexArray.AllocTextureArray(m_CubeCookieTexArraySize, textureSettings.pointCookieSize, TextureFormat.RGBA32, true);
m_CubeCookieTexArray.AllocTextureArray(gLightLoopSettings.cubeCookieTexArraySize, gLightLoopSettings.pointCookieSize, TextureFormat.RGBA32, true);
TextureFormat probeCacheFormat = textureSettings.reflectionCacheCompressed ? TextureFormat.BC6H : TextureFormat.RGBAHalf;
m_ReflectionProbeCache = new ReflectionProbeCache(iblFilterGGX, m_ReflectionProbeCacheSize, textureSettings.reflectionCubemapSize, probeCacheFormat, true);
TextureFormat probeCacheFormat = gLightLoopSettings.reflectionCacheCompressed ? TextureFormat.BC6H : TextureFormat.RGBAHalf;
m_ReflectionProbeCache = new ReflectionProbeCache(iblFilterGGX, gLightLoopSettings.reflectionProbeCacheSize, gLightLoopSettings.reflectionCubemapSize, probeCacheFormat, true);
s_GenAABBKernel = buildScreenAABBShader.FindKernel("ScreenBoundsAABB");

// Cluster
{
var kernelName = m_LightLoopSettings.enableBigTilePrepass ? (k_UseDepthBuffer ? "TileLightListGen_DepthRT_SrcBigTile" : "TileLightListGen_NoDepthRT_SrcBigTile") : (k_UseDepthBuffer ? "TileLightListGen_DepthRT" : "TileLightListGen_NoDepthRT");
s_GenListPerVoxelKernel = buildPerVoxelLightListShader.FindKernel(kernelName);
if (m_LightLoopSettings.enableBigTilePrepass)
{
}
s_BuildDispatchIndirectKernel = buildDispatchIndirectShader.FindKernel("BuildDispatchIndirect");
s_ClearDispatchIndirectKernel = clearDispatchIndirectShader.FindKernel("ClearDispatchIndirect");

UnityEditor.SceneView.onSceneGUIDelegate += OnSceneGUI;
#endif
InitShadowSystem(shadowInit, shadowSettings);
InitShadowSystem(hdAsset.GetRenderPipelineSettings().shadowInitParams, shadowSettings);
}
public void Cleanup()

CoreUtils.Destroy(m_DebugViewTilesMaterial);
}
public void NewFrame()
public void NewFrame(FrameSettings frameSettings)
{
m_FrameSettings = frameSettings;
// Cluster
{
var kernelName = m_FrameSettings.lightLoopSettings.enableBigTilePrepass ? (k_UseDepthBuffer ? "TileLightListGen_DepthRT_SrcBigTile" : "TileLightListGen_NoDepthRT_SrcBigTile") : (k_UseDepthBuffer ? "TileLightListGen_DepthRT" : "TileLightListGen_NoDepthRT");
s_GenListPerVoxelKernel = buildPerVoxelLightListShader.FindKernel(kernelName);
}
if (GetFeatureVariantsEnabled())
{
s_GenListPerTileKernel = buildPerTileLightListShader.FindKernel(m_FrameSettings.lightLoopSettings.enableBigTilePrepass ? "TileLightListGen_SrcBigTile_FeatureFlags" : "TileLightListGen_FeatureFlags");
}
else
s_GenListPerTileKernel = buildPerTileLightListShader.FindKernel(m_FrameSettings.lightLoopSettings.enableBigTilePrepass ? "TileLightListGen_SrcBigTile" : "TileLightListGen");
}
m_CookieTexArray.NewFrame();
m_CubeCookieTexArray.NewFrame();
m_ReflectionProbeCache.NewFrame();

{
return s_LightList == null || s_TileList == null || s_TileFeatureFlags == null ||
(s_BigTileLightList == null && m_LightLoopSettings.enableBigTilePrepass) ||
(s_BigTileLightList == null && m_FrameSettings.lightLoopSettings.enableBigTilePrepass) ||
(s_PerVoxelLightLists == null);
}

}
}
if (m_LightLoopSettings.enableBigTilePrepass)
if (m_FrameSettings.lightLoopSettings.enableBigTilePrepass)
{
var nrBigTilesX = (width + 63) / 64;
var nrBigTilesY = (height + 63) / 64;

{
var directionalLightData = new DirectionalLightData();
float diffuseDimmer = m_LightingSettings.diffuseGlobalDimmer * additionalData.lightDimmer;
float specularDimmer = m_LightingSettings.specularGlobalDimmer * additionalData.lightDimmer;
float diffuseDimmer = m_FrameSettings.diffuseGlobalDimmer * additionalData.lightDimmer;
float specularDimmer = m_FrameSettings.specularGlobalDimmer * additionalData.lightDimmer;
if (diffuseDimmer <= 0.0f && specularDimmer <= 0.0f)
return false;

directionalLightData.up = light.light.transform.up * 2 / additionalData.shapeWidth;
directionalLightData.right = light.light.transform.right * 2 / additionalData.shapeLength;
directionalLightData.up = light.light.transform.up * 2 / additionalData.shapeHeight;
directionalLightData.right = light.light.transform.right * 2 / additionalData.shapeWidth;
directionalLightData.positionWS = light.light.transform.position;
directionalLightData.color = GetLightColor(light);
directionalLightData.diffuseScale = additionalData.affectDiffuse ? diffuseDimmer : 0.0f;

return 1.0f - Mathf.Clamp01(distanceToCamera * scale + bias);
}
public bool GetLightData(CommandBuffer cmd, ShadowSettings shadowSettings, Camera camera, GPULightType gpuLightType, VisibleLight light, HDAdditionalLightData additionalLightData, AdditionalShadowData additionalshadowData, int lightIndex)
public bool GetLightData(CommandBuffer cmd, ShadowSettings shadowSettings, Camera camera, GPULightType gpuLightType,
VisibleLight light, HDAdditionalLightData additionalLightData, AdditionalShadowData additionalshadowData,
int lightIndex, ref Vector3 lightDimensions)
{
var lightData = new LightData();

lightData.up = light.light.transform.up;
lightData.right = light.light.transform.right;
lightData.size = new Vector2(additionalLightData.shapeLength, additionalLightData.shapeWidth);
lightDimensions.x = additionalLightData.shapeWidth;
lightDimensions.y = additionalLightData.shapeHeight;
lightDimensions.z = light.range;
lightData.size.x = light.range;
lightData.right *= 2.0f / additionalLightData.shapeLength;
lightData.up *= 2.0f / additionalLightData.shapeWidth;
lightData.right *= 2.0f / additionalLightData.shapeWidth;
lightData.up *= 2.0f / additionalLightData.shapeHeight;
}
else if (lightData.lightType == GPULightType.ProjectorPyramid)
{

float frustumHeight;
float frustumWidth;
float frustumWidth, frustumHeight;
if (additionalLightData.aspectRatio >= 1.0f)
{
frustumHeight = 2.0f * Mathf.Tan(spotAngle * 0.5f * Mathf.Deg2Rad);

frustumHeight = frustumWidth / additionalLightData.aspectRatio;
}
lightData.size = new Vector2(frustumWidth, frustumHeight);
// Adjust based on the new parametrization.
lightDimensions.x = frustumWidth;
lightDimensions.y = frustumHeight;
// Rescale for cookies and windowing.
lightData.right *= 2.0f / frustumWidth;

lightData.angleOffset = 1.0f;
}
if (lightData.lightType == GPULightType.Rectangle || lightData.lightType == GPULightType.Line)
{
lightData.size = new Vector2(additionalLightData.shapeWidth, additionalLightData.shapeHeight);
}
lightData.diffuseScale = additionalLightData.affectDiffuse ? lightScale * m_LightingSettings.diffuseGlobalDimmer : 0.0f;
lightData.specularScale = additionalLightData.affectSpecular ? lightScale * m_LightingSettings.specularGlobalDimmer : 0.0f;
lightData.diffuseScale = additionalLightData.affectDiffuse ? lightScale * m_FrameSettings.diffuseGlobalDimmer : 0.0f;
lightData.specularScale = additionalLightData.affectSpecular ? lightScale * m_FrameSettings.specularGlobalDimmer : 0.0f;
if (lightData.diffuseScale <= 0.0f && lightData.specularScale <= 0.0f)
return false;

}
// TODO: we should be able to do this calculation only with LightData without VisibleLight light, but for now pass both
public void GetLightVolumeDataAndBound(LightCategory lightCategory, GPULightType gpuLightType, LightVolumeType lightVolumeType, VisibleLight light, LightData lightData, Matrix4x4 worldToView)
public void GetLightVolumeDataAndBound(LightCategory lightCategory, GPULightType gpuLightType, LightVolumeType lightVolumeType,
VisibleLight light, LightData lightData, Vector3 lightDimensions, Matrix4x4 worldToView)
var range = light.range;
var range = lightDimensions.z;
var lightToWorld = light.localToWorld;
Vector3 positionWS = lightData.positionWS;
Vector3 positionVS = worldToView.MultiplyPoint(positionWS);

if (gpuLightType == GPULightType.ProjectorPyramid)
{
Vector3 lightPosToProjWindowCorner = (0.5f * lightData.size.x) * vx + (0.5f * lightData.size.y) * vy + 1.0f * vz;
Vector3 lightPosToProjWindowCorner = (0.5f * lightDimensions.x) * vx + (0.5f * lightDimensions.y) * vy + 1.0f * vz;
cs = Vector3.Dot(vz, Vector3.Normalize(lightPosToProjWindowCorner));
si = Mathf.Sqrt(1.0f - cs * cs);
}

}
else if (gpuLightType == GPULightType.Line)
{
Vector3 dimensions = new Vector3(lightData.size.x + 2 * range, 2 * range, 2 * range); // Omni-directional
Vector3 dimensions = new Vector3(lightDimensions.x + 2 * range, 2 * range, 2 * range); // Omni-directional
Vector3 extents = 0.5f * dimensions;
bound.center = positionVS;

lightVolumeData.lightAxisX = xAxisVS;
lightVolumeData.lightAxisY = yAxisVS;
lightVolumeData.lightAxisZ = zAxisVS;
lightVolumeData.boxInnerDist = new Vector3(lightData.size.x, 0, 0);
lightVolumeData.boxInnerDist = new Vector3(lightDimensions.x, 0, 0);
Vector3 dimensions = new Vector3(lightData.size.x + 2 * range, lightData.size.y + 2 * range, range); // One-sided
Vector3 dimensions = new Vector3(lightDimensions.x + 2 * range, lightDimensions.y + 2 * range, range); // One-sided
Vector3 extents = 0.5f * dimensions;
Vector3 centerVS = positionVS + extents.z * zAxisVS;

}
else if (gpuLightType == GPULightType.ProjectorBox)
{
Vector3 dimensions = new Vector3(lightData.size.x, lightData.size.y, range); // One-sided
Vector3 dimensions = new Vector3(lightDimensions.x, lightDimensions.y, range); // One-sided
Vector3 extents = 0.5f * dimensions;
Vector3 centerVS = positionVS + extents.z * zAxisVS;

light.bakingOutput.occlusionMaskChannel != -1; // We need to have an occlusion mask channel assign, else we have no shadow mask
}
public void UpdateRenderingPathState(bool useForwardRenderingOnly)
{
// Deferred opaque are always using Fptl. Forward opaque can use Fptl or Cluster, transparent use cluster.
// When MSAA is enabled we disable Fptl as it become expensive compare to cluster
// In HD, MSAA is only supported for forward only rendering, no MSAA in deferred mode (for code complexity reasons)
// If Deferred, enable Fptl. If we are forward renderer only and not using Fptl for forward opaque, disable Fptl
m_isForwardRenderingOnly = useForwardRenderingOnly;
m_isFptlEnabled = !m_isForwardRenderingOnly || m_LightLoopSettings.enableFptlForForwardOpaque; // TODO: Disable if MSAA
m_isFptlEnabledForForwardOpaque = m_LightLoopSettings.enableFptlForForwardOpaque; // TODO: Disable if MSAA
if (GetFeatureVariantsEnabled())
{
s_GenListPerTileKernel = buildPerTileLightListShader.FindKernel(m_LightLoopSettings.enableBigTilePrepass ? "TileLightListGen_SrcBigTile_FeatureFlags" : "TileLightListGen_FeatureFlags");
}
else
{
s_GenListPerTileKernel = buildPerTileLightListShader.FindKernel(m_LightLoopSettings.enableBigTilePrepass ? "TileLightListGen_SrcBigTile" : "TileLightListGen");
}
}
// Return true if BakedShadowMask are enabled
public bool PrepareLightsForGPU(CommandBuffer cmd, ShadowSettings shadowSettings, CullResults cullResults, Camera camera)
{

}
}
float oldSpecularGlobalDimmer = m_LightingSettings.specularGlobalDimmer;
// Change some parameters in case of "special" rendering (can be preview, reflection, etc.)
if (camera.cameraType == CameraType.Reflection)
{
m_LightingSettings.specularGlobalDimmer = 0.0f;
}
// 1. Count the number of lights and sort all lights by category, type and volume - This is required for the fptl/cluster shader code
// If we reach maximum of lights available on screen, then we discard the light.
// Lights are processed in order, so we don't discards light based on their importance but based on their ordering in visible lights list.

continue;
}
Vector3 lightDimensions = new Vector3(); // X = length or width, Y = height, Z = range (depth)
if (GetLightData(cmd, shadowSettings, camera, gpuLightType, light, additionalLightData, additionalShadowData, lightIndex))
if (GetLightData(cmd, shadowSettings, camera, gpuLightType, light, additionalLightData, additionalShadowData, lightIndex, ref lightDimensions))
{
switch (lightCategory)
{

}
// Then culling side. Must be call in this order as we pass the created Light data to the function
GetLightVolumeDataAndBound(lightCategory, gpuLightType, lightVolumeType, light, m_lightList.lights[m_lightList.lights.Count - 1], worldToView);
GetLightVolumeDataAndBound(lightCategory, gpuLightType, lightVolumeType, light, m_lightList.lights[m_lightList.lights.Count - 1], lightDimensions, worldToView);
// We make the light position camera-relative as late as possible in order
// to allow the preceding code to work with the absolute world space coordinates.

m_lightList.envLights[n - 1] = envLightData;
}
}
// Restore values after "special rendering"
m_LightingSettings.specularGlobalDimmer = oldSpecularGlobalDimmer;
}
m_lightCount = m_lightList.lights.Count + m_lightList.envLights.Count;

cmd.SetComputeBufferParam(buildPerVoxelLightListShader, s_GenListPerVoxelKernel, HDShaderIDs.g_vLayeredLightList, s_PerVoxelLightLists);
cmd.SetComputeBufferParam(buildPerVoxelLightListShader, s_GenListPerVoxelKernel, HDShaderIDs.g_LayeredOffset, s_PerVoxelOffset);
cmd.SetComputeBufferParam(buildPerVoxelLightListShader, s_GenListPerVoxelKernel, HDShaderIDs.g_LayeredSingleIdxBuffer, s_GlobalLightListAtomic);
if (m_LightLoopSettings.enableBigTilePrepass)
if (m_FrameSettings.lightLoopSettings.enableBigTilePrepass)
cmd.SetComputeBufferParam(buildPerVoxelLightListShader, s_GenListPerVoxelKernel, HDShaderIDs.g_vBigTileLightList, s_BigTileLightList);
if (k_UseDepthBuffer)

var numTilesX = GetNumTileClusteredX(camera);
var numTilesY = GetNumTileClusteredY(camera);
cmd.DispatchCompute(buildPerVoxelLightListShader, s_GenListPerVoxelKernel, numTilesX, numTilesY, 1);
}
public bool IsAsyncEnabled()
{
return m_LightLoopSettings.enableAsyncCompute;
}
public void BuildGPULightListsCommon(Camera camera, CommandBuffer cmd, RenderTargetIdentifier cameraDepthBufferRT, RenderTargetIdentifier stencilTextureRT, bool skyEnabled)

}
// enable coarse 2D pass on 64x64 tiles (used for both fptl and clustered).
if (m_LightLoopSettings.enableBigTilePrepass)
if (m_FrameSettings.lightLoopSettings.enableBigTilePrepass)
{
cmd.SetComputeIntParam(buildPerBigTileLightListShader, HDShaderIDs.g_isOrthographic, isOrthographic ? 1 : 0);
cmd.SetComputeIntParams(buildPerBigTileLightListShader, HDShaderIDs.g_viDimensions, w, h);

bool enableFeatureVariants = GetFeatureVariantsEnabled();
// optimized for opaques only
if (m_isFptlEnabled)
if (m_FrameSettings.lightLoopSettings.isFptlEnabled)
{
cmd.SetComputeIntParam(buildPerTileLightListShader, HDShaderIDs.g_isOrthographic, isOrthographic ? 1 : 0);
cmd.SetComputeIntParams(buildPerTileLightListShader, HDShaderIDs.g_viDimensions, w, h);

cmd.SetComputeMatrixParam(buildPerTileLightListShader, HDShaderIDs.g_mInvScrProjection, invProjscr);
cmd.SetComputeTextureParam(buildPerTileLightListShader, s_GenListPerTileKernel, HDShaderIDs.g_depth_tex, cameraDepthBufferRT);
cmd.SetComputeBufferParam(buildPerTileLightListShader, s_GenListPerTileKernel, HDShaderIDs.g_vLightList, s_LightList);
if (m_LightLoopSettings.enableBigTilePrepass)
if (m_FrameSettings.lightLoopSettings.enableBigTilePrepass)
cmd.SetComputeBufferParam(buildPerTileLightListShader, s_GenListPerTileKernel, HDShaderIDs.g_vBigTileLightList, s_BigTileLightList);
if (enableFeatureVariants)

{
baseFeatureFlags |= (uint)LightFeatureFlags.Sky;
}
if (!m_LightLoopSettings.enableComputeMaterialVariants)
if (!m_FrameSettings.lightLoopSettings.enableComputeMaterialVariants)
{
baseFeatureFlags |= LightDefinitions.s_MaterialFeatureMaskFlags;
}

if (enableFeatureVariants)
{
// material classification
if (m_LightLoopSettings.enableComputeMaterialVariants)
if (m_FrameSettings.lightLoopSettings.enableComputeMaterialVariants)
if (!m_LightLoopSettings.enableComputeLightVariants)
if (!m_FrameSettings.lightLoopSettings.enableComputeLightVariants)
{
buildMaterialFlagsKernel = s_BuildMaterialFlagsWriteKernel;
baseFeatureFlags |= LightDefinitions.s_LightFeatureMaskFlags;

cmd.SetGlobalInt(HDShaderIDs._NumTileClusteredX, GetNumTileClusteredX(camera));
cmd.SetGlobalInt(HDShaderIDs._NumTileClusteredY, GetNumTileClusteredY(camera));
if (m_LightLoopSettings.enableBigTilePrepass)
if (m_FrameSettings.lightLoopSettings.enableBigTilePrepass)
cmd.SetGlobalBuffer(HDShaderIDs.g_vBigTileLightList, s_BigTileLightList);
// Cluster

}
}
public void RenderDeferredLighting( HDCamera hdCamera, CommandBuffer cmd,
DebugDisplaySettings debugDisplaySettings,
public void RenderDeferredLighting( HDCamera hdCamera, CommandBuffer cmd, DebugDisplaySettings debugDisplaySettings,
if (m_LightLoopSettings.enableTileAndCluster && m_LightLoopSettings.enableComputeLightEvaluation && options.outputSplitLighting)
if (m_FrameSettings.lightLoopSettings.enableTileAndCluster && m_FrameSettings.lightLoopSettings.enableComputeLightEvaluation && options.outputSplitLighting)
{
// The CS is always in the MRT mode. Do not execute the same shader twice.
return;

string singlePassName = "SinglePass - Deferred Lighting Pass";
string SinglePassMRTName = "SinglePass - Deferred Lighting Pass MRT";
string sLabel = m_LightLoopSettings.enableTileAndCluster ?
string sLabel = m_FrameSettings.lightLoopSettings.enableTileAndCluster ?
(options.outputSplitLighting ? tilePassMRTName : tilePassName) :
(options.outputSplitLighting ? SinglePassMRTName : singlePassName);

// Compute path
if (m_LightLoopSettings.enableTileAndCluster && m_LightLoopSettings.enableComputeLightEvaluation)
if (m_FrameSettings.lightLoopSettings.enableTileAndCluster && m_FrameSettings.lightLoopSettings.enableComputeLightEvaluation)
{
int w = camera.pixelWidth;
int h = camera.pixelHeight;

else // Pixel shader evaluation
{
int index = GetDeferredLightingMaterialIndex( options.outputSplitLighting ? 1 : 0,
m_LightLoopSettings.enableTileAndCluster ? 1 : 0,
m_FrameSettings.lightLoopSettings.enableTileAndCluster ? 1 : 0,
m_enableBakeShadowMask ? 1 : 0,
debugDisplaySettings.IsDebugDisplayEnabled() ? 1 : 0);

{
// If SSS is disable, do lighting for both split lighting and no split lighting
// This is for debug purpose, so fine to use immediate material mode here to modify render state
if (!debugDisplaySettings.renderingDebugSettings.enableSSSAndTransmission)
if (!m_FrameSettings.enableSSSAndTransmission)
{
currentLightingMaterial.SetInt(HDShaderIDs._StencilRef, (int)StencilLightingUsage.NoLighting);
currentLightingMaterial.SetInt(HDShaderIDs._StencilCmp, (int)CompareFunction.NotEqual);

// Note: SHADOWS_SHADOWMASK keyword is enabled in HDRenderPipeline.cs ConfigureForShadowMask
// Note: if we use render opaque with deferred tiling we need to render a opaque depth pass for these opaque objects
if (!m_LightLoopSettings.enableTileAndCluster)
if (!m_FrameSettings.lightLoopSettings.enableTileAndCluster)
{
using (new ProfilingSample(cmd, "Forward pass", HDRenderPipeline.GetSampler(CustomSamplerId.TPForwardPass)))
{

else
{
// Only opaques can use FPTL, transparent must use clustered!
bool useFptl = renderOpaque && m_isFptlEnabledForForwardOpaque;
bool useFptl = renderOpaque && m_FrameSettings.lightLoopSettings.enableFptlForForwardOpaque;
using (new ProfilingSample(cmd, useFptl ? "Forward Tiled pass" : "Forward Clustered pass", HDRenderPipeline.GetSampler(CustomSamplerId.TPForwardTiledClusterpass)))
{

using (new ProfilingSample(cmd, "Tiled/cluster Lighting Debug", HDRenderPipeline.GetSampler(CustomSamplerId.TPTiledLightingDebug)))
{
if (lightingDebug.tileClusterDebug != LightLoopSettings.TileClusterDebug.None)
if (lightingDebug.tileClusterDebug != LightLoop.TileClusterDebug.None)
{
int w = hdCamera.camera.pixelWidth;

#endif
// Debug tiles
if (lightingDebug.tileClusterDebug == LightLoopSettings.TileClusterDebug.FeatureVariants)
if (lightingDebug.tileClusterDebug == LightLoop.TileClusterDebug.FeatureVariants)
{
if (GetFeatureVariantsEnabled())
{

}
else // tile or cluster
{
bool bUseClustered = lightingDebug.tileClusterDebug == LightLoopSettings.TileClusterDebug.Cluster;
bool bUseClustered = lightingDebug.tileClusterDebug == LightLoop.TileClusterDebug.Cluster;
// lightCategories
m_DebugViewTilesMaterial.SetInt(HDShaderIDs._ViewTilesFlags, (int)lightingDebug.tileClusterDebugByCategory);

2
ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.cs


public Lit() {}
public override void Build(RenderPipelineResources renderPipelineResources)
public override void Build(HDRenderPipelineAsset hdAsset)
{
m_InitPreFGD = CoreUtils.CreateEngineMaterial("Hidden/HDRenderPipeline/PreIntegratedFGD");

4
ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.hlsl


{
bsdfData.diffuseColor = surfaceData.baseColor;
bsdfData.fresnel0 = _TransmissionTintsAndFresnel0[surfaceData.subsurfaceProfile].a;
uint transmissionMode = BitFieldExtract(asuint(_TransmissionFlags), 2u, 2u * surfaceData.subsurfaceProfile);
uint transmissionMode = BitFieldExtract(asuint(_TransmissionFlags), 2u * surfaceData.subsurfaceProfile, 2u);
FillMaterialIdSssData(surfaceData.subsurfaceProfile,
surfaceData.subsurfaceRadius,

DecodeFromSSSBuffer(inGBuffer0, positionSS, sssData);
subsurfaceProfile = sssData.subsurfaceProfile;
transmissionMode = BitFieldExtract(asuint(_TransmissionFlags), 2u, 2u * subsurfaceProfile);
transmissionMode = BitFieldExtract(asuint(_TransmissionFlags), 2u * subsurfaceProfile, 2u);
radius = sssData.subsurfaceRadius;
thickness = inGBuffer2.g;

26
ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.shader


[ToggleOff] _AlphaCutoffEnable("Alpha Cutoff Enable", Float) = 0.0
_AlphaCutoff("Alpha Cutoff", Range(0.0, 1.0)) = 0.5
_AlphaCutoffPrepass("_AlphaCutoffPrepass", Range(0.0, 1.0)) = 0.5
[ToggleOff] _TransparentDepthPrepassEnable("_TransparentDepthPrepassEnable", Float) = 0.0
[ToggleOff] _TransparentBackfaceEnable("_TransparentBackfaceEnable", Float) = 0.0
[ToggleOff] _TransparentDepthPostpassEnable("_TransparentDepthPostpassEnable", Float) = 0.0

#include "ShaderPass/LitDistortionPass.hlsl"
#include "LitData.hlsl"
#include "../../ShaderPass/ShaderPassDistortion.hlsl"
ENDHLSL
}
// Caution: Order of pass mater. It should be:
// TransparentDepthPrepass, TransparentBackface, Forward/ForwardOnly, TransparentDepthPostpass
Pass
{
Name "TransparentDepthPrepass"
Tags{ "LightMode" = "TransparentDepthPrepass" }
Cull[_CullMode]
ZWrite On
ColorMask 0
HLSLPROGRAM
#define SHADERPASS SHADERPASS_DEPTH_ONLY
#define CUTOFF_TRANSPARENT_DEPTH_PREPASS
#include "../../ShaderVariables.hlsl"
#include "../../Material/Material.hlsl"
#include "ShaderPass/LitDepthPass.hlsl"
#include "LitData.hlsl"
#include "../../ShaderPass/ShaderPassDepthOnly.hlsl"
ENDHLSL
}

8
ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LitDataIndividualLayer.hlsl


// Perform alha test very early to save performance (a killed pixel will not sample textures)
#if defined(_ALPHATEST_ON) && !defined(LAYERED_LIT_SHADER)
float alphaCutoff = _AlphaCutoff;
#ifdef CUTOFF_TRANSPARENT_DEPTH_POSTPASS
#ifdef CUTOFF_TRANSPARENT_DEPTH_PREPASS
alphaCutoff = _AlphaCutoffPrepass;
#elif defined(CUTOFF_TRANSPARENT_DEPTH_POSTPASS)
alphaCutoff = _AlphaCutoffPostpass;
#endif
DoAlphaTest(alpha, alphaCutoff);

surfaceData.baseColor = SAMPLE_UVMAPPING_TEXTURE2D(ADD_IDX(_BaseColorMap), ADD_ZERO_IDX(sampler_BaseColorMap), ADD_IDX(layerTexCoord.base)).rgb * ADD_IDX(_BaseColor).rgb;
#ifdef _DETAIL_MAP_IDX
// Use overlay blend mode for detail abledo: (base < 0.5 ? (2.0 * base * blend) : (1.0 - 2.0 * (1.0 - base) * (1.0 - blend)))
float3 baseColorOverlay = (detailAlbedo < 0.5) ?
float3 baseColorOverlay = (detailAlbedo < 0.5) ?
surfaceData.baseColor * PositivePow(2.0 * detailAlbedo, ADD_IDX(_DetailAlbedoScale)) :
1.0 - (1.0 - surfaceData.baseColor) * PositivePow(2.0 * (1.0 - detailAlbedo), ADD_IDX(_DetailAlbedoScale));
// Lerp with details mask

surfaceData.atDistance = _ATDistance;
// Thickness already defined with SSS (from both thickness and thicknessMap)
surfaceData.thickness *= _ThicknessMultiplier;
// Rough refraction don't use opacity. Instead we use opacity as a transmittance mask.
// Rough refraction don't use opacity. Instead we use opacity as a transmittance mask.
surfaceData.transmittanceMask = 1.0 - alpha;
alpha = 1.0;
#else

1
ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LitProperties.hlsl


// shared constant between lit and layered lit
float _AlphaCutoff;
float _AlphaCutoffPrepass;
float _AlphaCutoffPostpass;
float4 _DoubleSidedConstants;
float _DistortionScale;

32
ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LitTessellation.shader


[ToggleOff] _AlphaCutoffEnable("Alpha Cutoff Enable", Float) = 0.0
_AlphaCutoff("Alpha Cutoff", Range(0.0, 1.0)) = 0.5
_AlphaCutoffPrepass("_AlphaCutoffPrepass", Range(0.0, 1.0)) = 0.5
[ToggleOff] _TransparentDepthPrepassEnable("_TransparentDepthPrepassEnable", Float) = 0.0
[ToggleOff] _TransparentBackfaceEnable("_TransparentBackfaceEnable", Float) = 0.0
[ToggleOff] _TransparentDepthPostpassEnable("_TransparentDepthPostpassEnable", Float) = 0.0

ENDHLSL
}
// Caution: Order of pass mater. It should be:
// TransparentDepthPrepass, TransparentBackface, Forward/ForwardOnly, TransparentDepthPostpass
Pass
{
Name "TransparentDepthPrepass"
Tags{ "LightMode" = "TransparentDepthPrepass" }
Cull[_CullMode]
ZWrite On
ColorMask 0
HLSLPROGRAM
#pragma hull Hull
#pragma domain Domain
#define SHADERPASS SHADERPASS_DEPTH_ONLY
#define CUTOFF_TRANSPARENT_DEPTH_PREPASS
#include "../../ShaderVariables.hlsl"
#include "../../Material/Material.hlsl"
#include "ShaderPass/LitDepthPass.hlsl"
#include "LitData.hlsl"
#include "../../ShaderPass/ShaderPassDepthOnly.hlsl"
ENDHLSL
}
Pass
{
Name "TransparentBackface"

ColorMask 0
HLSLPROGRAM
#pragma hull Hull
#pragma domain Domain
#define SHADERPASS SHADERPASS_DEPTH_ONLY
#define CUTOFF_TRANSPARENT_DEPTH_POSTPASS

2
ScriptableRenderPipeline/HDRenderPipeline/Material/RenderPipelineMaterial.cs


}
// Regular interface
public virtual void Build(RenderPipelineResources renderPipelineResources) {}
public virtual void Build(HDRenderPipelineAsset hdAsset) {}
public virtual void Cleanup() {}
// Following function can be use to initialize GPU resource (once or each frame) and bind them

30
ScriptableRenderPipeline/HDRenderPipeline/Material/SubsurfaceScattering/SubsurfaceScatteringManager.cs


// This is use to be able to read stencil value in compute shader
Material m_CopyStencilForSplitLighting;
SubsurfaceScatteringSettings m_sssSettings;
m_SSSBuffer0 = HDShaderIDs._SSSBufferTexture[0];
m_SSSBuffer0RT = new RenderTargetIdentifier(m_SSSBuffer0);
// Use with Jimenez

return m_RTIDs[index];
}
public void Build(RenderPipelineResources renderPipelineResources, SubsurfaceScatteringSettings sssSettings)
public void Build(HDRenderPipelineAsset hdAsset)
m_sssSettings = sssSettings;
m_SubsurfaceScatteringCS = renderPipelineResources.subsurfaceScatteringCS;
m_SubsurfaceScatteringCS = hdAsset.renderPipelineResources.subsurfaceScatteringCS;
m_CombineLightingPass = CoreUtils.CreateEngineMaterial(renderPipelineResources.combineLighting);
m_CombineLightingPass = CoreUtils.CreateEngineMaterial(hdAsset.renderPipelineResources.combineLighting);
m_SssVerticalFilterPass = CoreUtils.CreateEngineMaterial(renderPipelineResources.subsurfaceScattering);
m_SssVerticalFilterPass = CoreUtils.CreateEngineMaterial(hdAsset.renderPipelineResources.subsurfaceScattering);
m_SssHorizontalFilterAndCombinePass = CoreUtils.CreateEngineMaterial(renderPipelineResources.subsurfaceScattering);
m_SssHorizontalFilterAndCombinePass = CoreUtils.CreateEngineMaterial(hdAsset.renderPipelineResources.subsurfaceScattering);
m_CopyStencilForSplitLighting = CoreUtils.CreateEngineMaterial(renderPipelineResources.copyStencilBuffer);
m_CopyStencilForSplitLighting = CoreUtils.CreateEngineMaterial(hdAsset.renderPipelineResources.copyStencilBuffer);
m_CopyStencilForSplitLighting.SetInt(HDShaderIDs._StencilRef, (int)StencilLightingUsage.SplitLighting);
}

m_HTileRT = new RenderTargetIdentifier(m_HTile);
}
public void PushGlobalParams(CommandBuffer cmd, SubsurfaceScatteringSettings sssParameters, DebugDisplaySettings debugDisplaySettings)
public void PushGlobalParams(CommandBuffer cmd, SubsurfaceScatteringSettings sssParameters, FrameSettings frameSettings)
cmd.SetGlobalInt(HDShaderIDs._EnableSSSAndTransmission, debugDisplaySettings.renderingDebugSettings.enableSSSAndTransmission ? 1 : 0);
cmd.SetGlobalInt(HDShaderIDs._EnableSSSAndTransmission, frameSettings.enableSSSAndTransmission ? 1 : 0);
cmd.SetGlobalInt(HDShaderIDs._UseDisneySSS, sssParameters.useDisneySSS ? 1 : 0);
unsafe
{

}
// Combines specular lighting and diffuse lighting with subsurface scattering.
public void SubsurfaceScatteringPass(HDCamera hdCamera, CommandBuffer cmd, SubsurfaceScatteringSettings sssParameters, DebugDisplaySettings debugDisplaySettings,
public void SubsurfaceScatteringPass(HDCamera hdCamera, CommandBuffer cmd, SubsurfaceScatteringSettings sssParameters, FrameSettings frameSettings,
if (m_sssSettings == null || !debugDisplaySettings.renderingDebugSettings.enableSSSAndTransmission)
if (sssParameters == null || !frameSettings.enableSSSAndTransmission)
return;
using (new ProfilingSample(cmd, "Subsurface Scattering", HDRenderPipeline.GetSampler(CustomSamplerId.SubsurfaceScattering)))

// For Jimenez we always need an extra buffer, for Disney it depends on platform
if (!m_sssSettings.useDisneySSS ||
(m_sssSettings.useDisneySSS && NeedTemporarySubsurfaceBuffer()))
if (!sssParameters.useDisneySSS ||
(sssParameters.useDisneySSS && NeedTemporarySubsurfaceBuffer()))
{
// Caution: must be same format as m_CameraSssDiffuseLightingBuffer
cmd.ReleaseTemporaryRT(m_CameraFilteringBuffer);

}
}
if (m_sssSettings.useDisneySSS)
if (sssParameters.useDisneySSS)
{
using (new ProfilingSample(cmd, "HTile for SSS", HDRenderPipeline.GetSampler(CustomSamplerId.HTileForSSS)))
{

2
ScriptableRenderPipeline/HDRenderPipeline/ShaderPass/VaryingMesh.hlsl


#endif
#if defined(VARYINGS_NEED_CULLFACE) && SHADER_STAGE_FRAGMENT
FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMATIC;
FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC;
#endif
};

6
ScriptableRenderPipeline/HDRenderPipeline/Sky/AtmosphericScattering/AtmosphericScattering.cs


{
// Keep this class first in the file. Otherwise it seems that the script type is not registered properly.
public abstract class AtmosphericScattering : VolumeComponent
{
{
private readonly static int m_TypeParam = Shader.PropertyToID("_AtmosphericScatteringType");
// Fog Color
private readonly static int m_ColorModeParam = Shader.PropertyToID("_FogColorMode");

cmd.SetGlobalFloat(m_TypeParam, (float)FogType.None);
}
public void PushShaderParametersCommon(CommandBuffer cmd, FogType type, RenderingDebugSettings renderingDebug)
public void PushShaderParametersCommon(CommandBuffer cmd, FrameSettings frameSettings)
if(renderingDebug.enableAtmosphericScattering)
if(frameSettings.enableAtmosphericScattering)
cmd.SetGlobalFloat(m_TypeParam, (float)type);
else
cmd.SetGlobalFloat(m_TypeParam, (float)FogType.None);

52
ScriptableRenderPipeline/HDRenderPipeline/Sky/SkyManager.cs


else
return m_VisualSky.reflectionTexture;
}
}
}
{
{
{
case SkyType.HDRISky:
case SkyType.HDRISky:
{
}
}
{
{
}
}
m_VisualSky.skySettings = newSkySettings;
m_BakingSky.skySettings = SkySettings.GetBakingSkySettings();

m_LastFrameUpdated = -1;
}
public void Build(RenderPipelineResources renderPipelineResources, IBLFilterGGX iblFilterGGX)
public void Build(HDRenderPipelineAsset hdAsset, IBLFilterGGX iblFilterGGX)
{
// For now, both these rendering context will allocate render textures
// In theory, when we have a lighting override we don't need any cubemaps from the visual sky so we could avoid allocating them

m_BakingSky = new SkyRenderingContext(false, iblFilterGGX);
m_StandardSkyboxMaterial = CoreUtils.CreateEngineMaterial(renderPipelineResources.skyboxCubemap);
m_StandardSkyboxMaterial = CoreUtils.CreateEngineMaterial(hdAsset.renderPipelineResources.skyboxCubemap);
m_BlitCubemapMaterial = CoreUtils.CreateEngineMaterial(renderPipelineResources.blitCubemap);
m_BlitCubemapMaterial = CoreUtils.CreateEngineMaterial(hdAsset.renderPipelineResources.blitCubemap);
m_OpaqueAtmScatteringMaterial = CoreUtils.CreateEngineMaterial(renderPipelineResources.opaqueAtmosphericScattering);
m_OpaqueAtmScatteringMaterial = CoreUtils.CreateEngineMaterial(hdAsset.renderPipelineResources.opaqueAtmosphericScattering);
}
public void Cleanup()

public bool IsSkyValid()
{
return m_VisualSky.IsValid();
}
}
void BlitCubemap(CommandBuffer cmd, Cubemap source, RenderTexture dest)

// Here we update the global SkyMaterial so that it uses our baking sky cubemap. This way, next time the GI is baked, the right sky will be present.
float intensity = m_BakingSky.IsValid() ? 1.0f : 0.0f; // Eliminate all diffuse if we don't have a skybox (meaning for now the background is black in HDRP)
m_StandardSkyboxMaterial.SetTexture("_Tex", m_BakingSky.cubemapRT);
RenderSettings.skybox = m_StandardSkyboxMaterial; // Setup this material as the default to be use in RenderSettings
RenderSettings.ambientIntensity = intensity;
RenderSettings.ambientMode = AmbientMode.Skybox; // Force skybox for our HDRI
RenderSettings.reflectionIntensity = intensity;
RenderSettings.customReflection = null;
RenderSettings.skybox = m_StandardSkyboxMaterial; // Setup this material as the default to be use in RenderSettings
RenderSettings.ambientIntensity = intensity;
RenderSettings.ambientMode = AmbientMode.Skybox; // Force skybox for our HDRI
RenderSettings.reflectionIntensity = intensity;
RenderSettings.customReflection = null;
DynamicGI.UpdateEnvironment();
DynamicGI.UpdateEnvironment();
m_NeedUpdateBakingSky = false;
}

m_NeedUpdateBakingSky = m_BakingSky.UpdateEnvironment(camera, sunLight, m_UpdateRequired, cmd);
if (m_LightingOverrideSky.IsValid())
{
{
{
{
}
}
m_UpdateRequired = false;

if (IsSkyValid())
{
cmd.SetGlobalInt(HDShaderIDs._EnvLightSkyEnabled, 1);
}
}
}
}
}
}
CoreUtils.DrawFullScreen(cmd, m_OpaqueAtmScatteringMaterial);
CoreUtils.DrawFullScreen(cmd, m_OpaqueAtmScatteringMaterial);
}
}
public Texture2D ExportSkyToTexture()
{

4
Tests/GraphicsTests/RenderPipeline/HDRenderPipeline/Scenes/1xxx_Materials/1210_Lit_BentNormal.unity


affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 2
shapeLength: 2.5
shapeWidth: 4.51
shapeWidth: 2.5
shapeHeight: 4.51
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

2
Tests/GraphicsTests/RenderPipeline/HDRenderPipeline/Scenes/2xxx_Lighting/2001_Dynamic_Directional.unity


affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 8
shapeHeight: 8
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

8
Tests/GraphicsTests/RenderPipeline/HDRenderPipeline/Scenes/2xxx_Lighting/2002_Dynamic_Mix.unity


affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 1
shapeLength: 0.5
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 2
shapeLength: 3.5
shapeHeight: 3.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0.5
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0.5
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

54
Tests/GraphicsTests/RenderPipeline/HDRenderPipeline/Scenes/2xxx_Lighting/2003_Light_Parameters.unity


affectSpecular: 1
lightTypeExtent: 1
spotLightShape: 0
shapeLength: 0.5
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 1
spotLightShape: 0
shapeLength: 0.5
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0.5
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 2
shapeLength: 1.1
shapeWidth: 6
shapeWidth: 1.1
shapeHeight: 6
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 0.2

affectSpecular: 0
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0.5
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 2
spotLightShape: 0
shapeLength: 0.5
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0.5
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0.5
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0.5
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 2
spotLightShape: 0
shapeLength: 0.5
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 2
spotLightShape: 0
shapeLength: 0.5
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0.5
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 2
shapeLength: 1.1
shapeWidth: 6
shapeWidth: 1.1
shapeHeight: 6
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 0.8

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 2
shapeLength: 1.1
shapeWidth: 6
shapeWidth: 1.1
shapeHeight: 6
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 2
shapeLength: 1.1
shapeWidth: 6
shapeWidth: 1.1
shapeHeight: 6
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 0.6

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0.5
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 2
shapeLength: 1.1
shapeWidth: 6
shapeWidth: 1.1
shapeHeight: 6
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 0.4

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0.5
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0.5
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 1
spotLightShape: 0
shapeLength: 0.5
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 0
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0.5
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0.5
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

26
ScriptableRenderPipeline/HDRenderPipeline/Lighting/LightLoop/GlobalLightLoopSettings.cs


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
namespace UnityEngine.Experimental.Rendering.HDPipeline
{
// RenderRenderPipelineSettings represent settings that are immutable at runtime.
// There is a dedicated RenderRenderPipelineSettings for each platform
[Serializable]
public class GlobalLightLoopSettings
{
public int spotCookieSize = 128;
public int cookieTexArraySize = 16;
public int pointCookieSize = 512;
public int cubeCookieTexArraySize = 16;
public int reflectionProbeCacheSize = 128;
public int reflectionCubemapSize = 128;
public bool reflectionCacheCompressed = false;
}
}

11
ScriptableRenderPipeline/HDRenderPipeline/Lighting/LightLoop/GlobalLightLoopSettings.cs.meta


fileFormatVersion: 2
guid: 2cb8dc033b6e8d944bd7a4fc62dbb8ca
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

82
ScriptableRenderPipeline/HDRenderPipeline/Lighting/LightLoop/LightLoopSettings.cs


using System;
using UnityEngine;
namespace UnityEngine.Experimental.Rendering.HDPipeline
{
[Serializable]
public class LightLoopSettings
{
public static string kEnableTileCluster = "Enable Tile/Cluster";
public static string kEnableBigTile = "Enable Big Tile";
public static string kEnableComputeLighting = "Enable Compute Lighting";
public static string kEnableLightclassification = "Enable Light Classification";
public static string kEnableMaterialClassification = "Enable Material Classification";
// Setup by the users
public bool enableTileAndCluster = true;
public bool enableComputeLightEvaluation = true;
public bool enableComputeLightVariants = true;
public bool enableComputeMaterialVariants = true;
// Deferred opaque always use FPTL, forward opaque can use FPTL or cluster, transparent always use cluster
// When MSAA is enabled, we only support cluster (Fptl is too slow with MSAA), and we don't support MSAA for deferred path (mean it is ok to keep fptl)
public bool enableFptlForForwardOpaque = true;
public bool enableBigTilePrepass = true;
// Setup by system
public bool isFptlEnabled = true;
public void CopyTo(LightLoopSettings lightLoopSettings)
{
lightLoopSettings.enableTileAndCluster = this.enableTileAndCluster;
lightLoopSettings.enableComputeLightEvaluation = this.enableComputeLightEvaluation;
lightLoopSettings.enableComputeLightVariants = this.enableComputeLightVariants;
lightLoopSettings.enableComputeMaterialVariants = this.enableComputeMaterialVariants;
lightLoopSettings.enableFptlForForwardOpaque = this.enableFptlForForwardOpaque;
lightLoopSettings.enableBigTilePrepass = this.enableBigTilePrepass;
lightLoopSettings.isFptlEnabled = this.isFptlEnabled;
}
// aggregateFrameSettings already contain the aggregation of RenderPipelineSettings and FrameSettings (regular and/or debug)
static public LightLoopSettings InitializeLightLoopSettings(Camera camera, FrameSettings aggregateFrameSettings,
RenderPipelineSettings renderPipelineSettings, FrameSettings frameSettings)
{
LightLoopSettings aggregate = new LightLoopSettings();
aggregate.enableTileAndCluster = frameSettings.lightLoopSettings.enableTileAndCluster;
aggregate.enableComputeLightEvaluation = frameSettings.lightLoopSettings.enableComputeLightEvaluation;
aggregate.enableComputeLightVariants = frameSettings.lightLoopSettings.enableComputeLightVariants;
aggregate.enableComputeMaterialVariants = frameSettings.lightLoopSettings.enableComputeMaterialVariants;
aggregate.enableFptlForForwardOpaque = frameSettings.lightLoopSettings.enableFptlForForwardOpaque;
aggregate.enableBigTilePrepass = frameSettings.lightLoopSettings.enableBigTilePrepass;
// Deferred opaque are always using Fptl. Forward opaque can use Fptl or Cluster, transparent use cluster.
// When MSAA is enabled we disable Fptl as it become expensive compare to cluster
// In HD, MSAA is only supported for forward only rendering, no MSAA in deferred mode (for code complexity reasons)
aggregate.enableFptlForForwardOpaque = aggregate.enableFptlForForwardOpaque && aggregateFrameSettings.enableMSAA;
// If Deferred, enable Fptl. If we are forward renderer only and not using Fptl for forward opaque, disable Fptl
aggregate.isFptlEnabled = !aggregateFrameSettings.enableForwardRenderingOnly || aggregate.enableFptlForForwardOpaque;
return aggregate;
}
static public void RegisterDebug(String menuName, LightLoopSettings lightLoopSettings)
{
DebugMenuManager.instance.AddDebugItem<bool>(menuName, kEnableTileCluster, () => lightLoopSettings.enableTileAndCluster, (value) => lightLoopSettings.enableTileAndCluster = (bool)value);
DebugMenuManager.instance.AddDebugItem<bool>(menuName, kEnableBigTile, () => lightLoopSettings.enableBigTilePrepass, (value) => lightLoopSettings.enableBigTilePrepass = (bool)value);
DebugMenuManager.instance.AddDebugItem<bool>(menuName, kEnableComputeLighting, () => lightLoopSettings.enableComputeLightEvaluation, (value) => lightLoopSettings.enableComputeLightEvaluation = (bool)value);
DebugMenuManager.instance.AddDebugItem<bool>(menuName, kEnableLightclassification, () => lightLoopSettings.enableComputeLightVariants, (value) => lightLoopSettings.enableComputeLightVariants = (bool)value);
DebugMenuManager.instance.AddDebugItem<bool>(menuName, kEnableMaterialClassification, () => lightLoopSettings.enableComputeMaterialVariants, (value) => lightLoopSettings.enableComputeMaterialVariants = (bool)value);
}
static public void UnRegisterDebug(String menuName)
{
DebugMenuManager.instance.RemoveDebugItem(menuName, kEnableTileCluster);
DebugMenuManager.instance.RemoveDebugItem(menuName, kEnableBigTile);
DebugMenuManager.instance.RemoveDebugItem(menuName, kEnableComputeLighting);
DebugMenuManager.instance.RemoveDebugItem(menuName, kEnableLightclassification);
DebugMenuManager.instance.RemoveDebugItem(menuName, kEnableMaterialClassification);
}
}
}

11
ScriptableRenderPipeline/HDRenderPipeline/Lighting/LightLoop/LightLoopSettings.cs.meta


fileFormatVersion: 2
guid: c8ff9f58676b0dd40b7d189461b54bf1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

8
ScriptableRenderPipeline/HDRenderPipeline/RenderPipeline.meta


fileFormatVersion: 2
guid: 73709c10d2eabb84d97c8af27f1bfc19
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

242
ScriptableRenderPipeline/HDRenderPipeline/RenderPipeline/FrameSettings.cs


using System;
using UnityEngine;
namespace UnityEngine.Experimental.Rendering.HDPipeline
{
// The settings here are per frame settings.
// Each camera must have its own per frame settings
[Serializable]
public class FrameSettings
{
public static string kEnableShadow = "Enable Shadow";
public static string kEnableSSR = "Enable SSR";
public static string kEnableSSAO = "Enable SSAO";
public static string kEnableSSSAndTransmission = "Enable SSS and Transmission";
public static string kForwardOnly = "Forward Only";
public static string kDeferredDepthPrePass = "Deferred Depth Prepass";
public static string kDeferredDepthPrepassATestOnly = "Deferred Depth Prepass ATest Only";
public static string KEnableTransparentPrepass = "Enable Transparent Prepass";
public static string kEnableMotionVectors = "Enable Motion Vectors";
public static string KEnableObjectMotionVectors = "Enable Object Motion Vectors";
public static string kEnableDBuffer = "Enable DBuffer";
public static string kEnableAtmosphericScattering = "Enable Atmospheric Scattering";
public static string kEnableRoughRefraction = "Enable Rough Refraction";
public static string kEnableTransparentPostpass = "Enable Transparent Postpass";
public static string kEnableDistortion = "Enable Distortion";
public static string kEnablePostprocess = "Enable Postprocess";
public static string kEnableStereoRendering = "Enable Stereo Rendering";
public static string kEnableAsyncCompute = "Enable Async Compute";
public static string kEnableOpaqueObjects = "Enable Opaque Objects";
public static string kEnableTransparentObjects = "Enable Transparent Objects";
public static string kEnableMSAA = "Enable MSAA";
public static string kEnableShadowMask = "Enable ShadowMask";
// Lighting
// Setup by users
public bool enableShadow = true;
public bool enableSSR = true; // Depends on DepthPyramid
public bool enableSSAO = true;
public bool enableSSSAndTransmission = true;
// Setup by system
public float diffuseGlobalDimmer = 1.0f;
public float specularGlobalDimmer = 1.0f;
// View
public bool enableForwardRenderingOnly = false; // TODO: Currently there is no way to strip the extra forward shaders generated by the shaders compiler, so we can switch dynamically.
public bool enableDepthPrepassWithDeferredRendering = false;
public bool enableAlphaTestOnlyInDeferredPrepass = false;
public bool enableTransparentPrePass = true;
public bool enableMotionVectors = true; // Enable/disable whole motion vectors pass (Camera + Object).
public bool enableObjectMotionVectors = true;
public bool enableDBuffer = true;
public bool enableAtmosphericScattering = true;
public bool enableRoughRefraction = true; // Depends on DepthPyramid - If not enable, just do a copy of the scene color (?) - how to disable rough refraction ?
public bool enableTransparentPostPass = true;
public bool enableDistortion = true;
public bool enablePostprocess = true;
public bool enableStereo = false;
public bool enableAsyncCompute = false;
public bool enableOpaqueObjects = true;
public bool enableTransparentObjects = true;
public bool enableMSAA = false;
public bool enableShadowMask = false;
public LightLoopSettings lightLoopSettings = new LightLoopSettings();
public void CopyTo(FrameSettings frameSettings)
{
frameSettings.enableShadow = this.enableShadow;
frameSettings.enableSSR = this.enableSSR;
frameSettings.enableSSAO = this.enableSSAO;
frameSettings.enableSSSAndTransmission = this.enableSSSAndTransmission;
frameSettings.diffuseGlobalDimmer = this.diffuseGlobalDimmer;
frameSettings.specularGlobalDimmer = this.specularGlobalDimmer;
frameSettings.enableForwardRenderingOnly = this.enableForwardRenderingOnly;
frameSettings.enableDepthPrepassWithDeferredRendering = this.enableDepthPrepassWithDeferredRendering;
frameSettings.enableAlphaTestOnlyInDeferredPrepass = this.enableAlphaTestOnlyInDeferredPrepass;
frameSettings.enableTransparentPrePass = this.enableTransparentPrePass;
frameSettings.enableMotionVectors = this.enableMotionVectors;
frameSettings.enableObjectMotionVectors = this.enableObjectMotionVectors;
frameSettings.enableDBuffer = this.enableDBuffer;
frameSettings.enableAtmosphericScattering = this.enableAtmosphericScattering;
frameSettings.enableRoughRefraction = this.enableRoughRefraction;
frameSettings.enableTransparentPostPass = this.enableTransparentPostPass;
frameSettings.enableDistortion = this.enableDistortion;
frameSettings.enablePostprocess = this.enablePostprocess;
frameSettings.enableStereo = this.enableStereo;
frameSettings.enableForwardRenderingOnly = this.enableForwardRenderingOnly;
frameSettings.enableOpaqueObjects = this.enableOpaqueObjects;
frameSettings.enableTransparentObjects = this.enableTransparentObjects;
frameSettings.enableAsyncCompute = this.enableAsyncCompute;
frameSettings.enableMSAA = this.enableMSAA;
frameSettings.enableShadowMask = this.enableShadowMask;
this.lightLoopSettings.CopyTo(frameSettings.lightLoopSettings);
}
// Init a FrameSettings from renderpipeline settings, frame settings and debug settings (if any)
// This will aggregate the various option
static public FrameSettings InitializeFrameSettings(Camera camera, RenderPipelineSettings renderPipelineSettings, FrameSettings frameSettings)
{
FrameSettings aggregate = new FrameSettings();
// When rendering reflection probe we disable specular as it is view dependent
if (camera.cameraType == CameraType.Reflection)
{
aggregate.diffuseGlobalDimmer = 1.0f;
aggregate.specularGlobalDimmer = 0.0f;
}
else
{
aggregate.diffuseGlobalDimmer = 1.0f;
aggregate.specularGlobalDimmer = 1.0f;
}
aggregate.enableShadow = frameSettings.enableShadow;
aggregate.enableSSR = camera.cameraType == CameraType.Reflection ? false : frameSettings.enableSSR && renderPipelineSettings.supportSSR;
aggregate.enableSSAO = frameSettings.enableSSAO && renderPipelineSettings.supportSSAO;
aggregate.enableSSSAndTransmission = camera.cameraType == CameraType.Reflection ? false : frameSettings.enableSSSAndTransmission && renderPipelineSettings.supportSSSAndTransmission;
// We have to fall back to forward-only rendering when scene view is using wireframe rendering mode
// as rendering everything in wireframe + deferred do not play well together
aggregate.enableForwardRenderingOnly = frameSettings.enableForwardRenderingOnly || GL.wireframe;
aggregate.enableDepthPrepassWithDeferredRendering = frameSettings.enableDepthPrepassWithDeferredRendering;
aggregate.enableAlphaTestOnlyInDeferredPrepass = frameSettings.enableAlphaTestOnlyInDeferredPrepass;
aggregate.enableTransparentPrePass = frameSettings.enableTransparentPrePass;
aggregate.enableMotionVectors = camera.cameraType == CameraType.Reflection ? false : frameSettings.enableMotionVectors;
aggregate.enableObjectMotionVectors = camera.cameraType == CameraType.Reflection ? false : frameSettings.enableObjectMotionVectors;
aggregate.enableDBuffer = frameSettings.enableDBuffer && renderPipelineSettings.supportDBuffer;
aggregate.enableAtmosphericScattering = frameSettings.enableAtmosphericScattering;
aggregate.enableRoughRefraction = frameSettings.enableRoughRefraction;
aggregate.enableTransparentPostPass = frameSettings.enableTransparentPostPass;
aggregate.enableDistortion = camera.cameraType == CameraType.Reflection ? false : frameSettings.enableDistortion;
// Planar and real time cubemap doesn't need post process and render in FP16
aggregate.enablePostprocess = camera.cameraType == CameraType.Reflection ? false : frameSettings.enablePostprocess;
aggregate.enableStereo = camera.cameraType == CameraType.Reflection ? false : frameSettings.enableStereo && UnityEngine.XR.XRSettings.isDeviceActive && (camera.stereoTargetEye == StereoTargetEyeMask.Both);
// Force forward if we request stereo. TODO: We should not enforce that, users should be able to chose deferred
aggregate.enableForwardRenderingOnly = aggregate.enableForwardRenderingOnly || aggregate.enableStereo;
aggregate.enableAsyncCompute = frameSettings.enableAsyncCompute && renderPipelineSettings.supportAsyncCompute;
aggregate.enableOpaqueObjects = frameSettings.enableOpaqueObjects;
aggregate.enableTransparentObjects = frameSettings.enableTransparentObjects;
aggregate.enableMSAA = frameSettings.enableMSAA && renderPipelineSettings.supportMSAA;
aggregate.enableShadowMask = renderPipelineSettings.supportShadowMask;
aggregate.lightLoopSettings = LightLoopSettings.InitializeLightLoopSettings(camera, aggregate, renderPipelineSettings, frameSettings);
return aggregate;
}
static public void RegisterDebug(String menuName, FrameSettings frameSettings)
{
// Register the camera into the debug menu
DebugMenuManager.instance.AddDebugItem<bool>(menuName, kEnableShadow, () => frameSettings.enableShadow, (value) => frameSettings.enableShadow = (bool)value);
DebugMenuManager.instance.AddDebugItem<bool>(menuName, kEnableSSR, () => frameSettings.enableSSR, (value) => frameSettings.enableSSR = (bool)value);
DebugMenuManager.instance.AddDebugItem<bool>(menuName, kEnableSSAO, () => frameSettings.enableSSAO, (value) => frameSettings.enableSSAO = (bool)value);
DebugMenuManager.instance.AddDebugItem<bool>(menuName, kEnableSSSAndTransmission, () => frameSettings.enableSSSAndTransmission, (value) => frameSettings.enableSSSAndTransmission = (bool)value);
DebugMenuManager.instance.AddDebugItem<bool>(menuName, kForwardOnly, () => frameSettings.enableForwardRenderingOnly, (value) => frameSettings.enableForwardRenderingOnly = (bool)value);
DebugMenuManager.instance.AddDebugItem<bool>(menuName, kDeferredDepthPrepassATestOnly, () => frameSettings.enableDepthPrepassWithDeferredRendering, (value) => frameSettings.enableDepthPrepassWithDeferredRendering = (bool)value);
DebugMenuManager.instance.AddDebugItem<bool>(menuName, KEnableTransparentPrepass, () => frameSettings.enableAlphaTestOnlyInDeferredPrepass, (value) => frameSettings.enableAlphaTestOnlyInDeferredPrepass = (bool)value);
DebugMenuManager.instance.AddDebugItem<bool>(menuName, KEnableTransparentPrepass, () => frameSettings.enableTransparentPrePass, (value) => frameSettings.enableTransparentPrePass = (bool)value);
DebugMenuManager.instance.AddDebugItem<bool>(menuName, kEnableMotionVectors, () => frameSettings.enableMotionVectors, (value) => frameSettings.enableMotionVectors = (bool)value);
DebugMenuManager.instance.AddDebugItem<bool>(menuName, KEnableObjectMotionVectors, () => frameSettings.enableObjectMotionVectors, (value) => frameSettings.enableObjectMotionVectors = (bool)value);
DebugMenuManager.instance.AddDebugItem<bool>(menuName, kEnableDBuffer, () => frameSettings.enableDBuffer, (value) => frameSettings.enableDBuffer = (bool)value);
DebugMenuManager.instance.AddDebugItem<bool>(menuName, kEnableAtmosphericScattering, () => frameSettings.enableAtmosphericScattering, (value) => frameSettings.enableAtmosphericScattering = (bool)value);
DebugMenuManager.instance.AddDebugItem<bool>(menuName, kEnableRoughRefraction, () => frameSettings.enableRoughRefraction, (value) => frameSettings.enableRoughRefraction = (bool)value);
DebugMenuManager.instance.AddDebugItem<bool>(menuName, kEnableTransparentPostpass, () => frameSettings.enableTransparentPostPass, (value) => frameSettings.enableTransparentPostPass = (bool)value);
DebugMenuManager.instance.AddDebugItem<bool>(menuName, kEnableDistortion, () => frameSettings.enableDistortion, (value) => frameSettings.enableDistortion = (bool)value);
DebugMenuManager.instance.AddDebugItem<bool>(menuName, kEnablePostprocess, () => frameSettings.enablePostprocess, (value) => frameSettings.enablePostprocess = (bool)value);
DebugMenuManager.instance.AddDebugItem<bool>(menuName, kEnableStereoRendering, () => frameSettings.enableStereo, (value) => frameSettings.enableStereo = (bool)value);
DebugMenuManager.instance.AddDebugItem<bool>(menuName, kEnableAsyncCompute, () => frameSettings.enableAsyncCompute, (value) => frameSettings.enableAsyncCompute = (bool)value);
DebugMenuManager.instance.AddDebugItem<bool>(menuName, kEnableOpaqueObjects, () => frameSettings.enableOpaqueObjects, (value) => frameSettings.enableOpaqueObjects = (bool)value);
DebugMenuManager.instance.AddDebugItem<bool>(menuName, kEnableTransparentObjects, () => frameSettings.enableTransparentObjects, (value) => frameSettings.enableTransparentObjects = (bool)value);
DebugMenuManager.instance.AddDebugItem<bool>(menuName, kEnableMSAA, () => frameSettings.enableMSAA, (value) => frameSettings.enableMSAA = (bool)value);
DebugMenuManager.instance.AddDebugItem<bool>(menuName, kEnableShadowMask, () => frameSettings.enableShadowMask, (value) => frameSettings.enableShadowMask = (bool)value);
LightLoopSettings.RegisterDebug(menuName, frameSettings.lightLoopSettings);
}
static public void UnRegisterDebug(String menuName)
{
// Register the camera into the debug menu
DebugMenuManager.instance.RemoveDebugItem(menuName, kEnableShadow);
DebugMenuManager.instance.RemoveDebugItem(menuName, kEnableSSR);
DebugMenuManager.instance.RemoveDebugItem(menuName, kEnableSSAO);
DebugMenuManager.instance.RemoveDebugItem(menuName, kEnableSSSAndTransmission);
DebugMenuManager.instance.RemoveDebugItem(menuName, kForwardOnly);
DebugMenuManager.instance.RemoveDebugItem(menuName, kDeferredDepthPrepassATestOnly);
DebugMenuManager.instance.RemoveDebugItem(menuName, KEnableTransparentPrepass);
DebugMenuManager.instance.RemoveDebugItem(menuName, KEnableTransparentPrepass);
DebugMenuManager.instance.RemoveDebugItem(menuName, kEnableMotionVectors);
DebugMenuManager.instance.RemoveDebugItem(menuName, KEnableObjectMotionVectors);
DebugMenuManager.instance.RemoveDebugItem(menuName, kEnableDBuffer);
DebugMenuManager.instance.RemoveDebugItem(menuName, kEnableAtmosphericScattering);
DebugMenuManager.instance.RemoveDebugItem(menuName, kEnableRoughRefraction);
DebugMenuManager.instance.RemoveDebugItem(menuName, kEnableTransparentPostpass);
DebugMenuManager.instance.RemoveDebugItem(menuName, kEnableDistortion);
DebugMenuManager.instance.RemoveDebugItem(menuName, kEnablePostprocess);
DebugMenuManager.instance.RemoveDebugItem(menuName, kEnableStereoRendering);
DebugMenuManager.instance.RemoveDebugItem(menuName, kEnableAsyncCompute);
DebugMenuManager.instance.RemoveDebugItem(menuName, kEnableOpaqueObjects);
DebugMenuManager.instance.RemoveDebugItem(menuName, kEnableTransparentObjects);
DebugMenuManager.instance.RemoveDebugItem(menuName, kEnableMSAA);
DebugMenuManager.instance.RemoveDebugItem(menuName, kEnableShadowMask);
LightLoopSettings.UnRegisterDebug(menuName);
}
}
}

36
ScriptableRenderPipeline/HDRenderPipeline/RenderPipeline/RenderPipelineSettings.cs


using System;
using UnityEngine;
namespace UnityEngine.Experimental.Rendering.HDPipeline
{
// RenderPipelineSettings define settings that can't be change during runtime. It is equivalent to the GraphicsSettings of Unity (Tiers + shader variant removal).
// This allow to allocate resource or not for a given feature.
// FrameSettings control within a frame what is enable or not(enableShadow, enableStereo, enableDistortion...).
// HDRenderPipelineAsset reference the current RenderPipelineSettings use, there is one per supported platform(Currently this feature is not implemented and only one GlobalFrameSettings is available).
// A Camera with HDAdditionalData have one FrameSettings that configure how it will render.For example a camera use for reflection will disable distortion and postprocess.
// Additionally on a Camera there is another FrameSettings call ActiveFrameSettings that is created on the fly based on FrameSettings and allow modification for debugging purpose at runtime without being serialized on disk.
// The ActiveFrameSettings is register in the debug windows at the creation of the camera.
// A Camera with HDAdditionalData have a RenderPath that define if it use a "Default" FrameSettings, a preset of FrameSettings or a custom one.
// HDRenderPipelineAsset contain a "Default" FrameSettings that can be reference by any camera with RenderPath.Defaut or when the camera don't have HDAdditionalData like the camera of the Editor.
// It also contain a DefaultActiveFrameSettings
// RenderPipelineSettings represent settings that are immutable at runtime.
// There is a dedicated RenderPipelineSettings for each platform
[Serializable]
public class RenderPipelineSettings
{
// Lighting
public bool supportShadowMask = true;
public bool supportSSR = true;
public bool supportSSAO = true;
public bool supportSSSAndTransmission = true;
// Engine
public bool supportDBuffer = false;
public bool supportMSAA = false;
public bool supportAsyncCompute = false;
public GlobalLightLoopSettings lightLoopSettings = new GlobalLightLoopSettings();
public ShadowInitParameters shadowInitParams = new ShadowInitParameters();
}
}

11
ScriptableRenderPipeline/HDRenderPipeline/RenderPipeline/RenderPipelineSettings.cs.meta


fileFormatVersion: 2
guid: 189e7ccf6292277448e6cecbfead78b8
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

11
ScriptableRenderPipeline/HDRenderPipeline/Debug/RenderingDebug.cs.meta


fileFormatVersion: 2
guid: 1e64277580777ed4fae930253871a755
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

18
ScriptableRenderPipeline/HDRenderPipeline/Debug/RenderingDebug.cs


using System.Collections.Generic;
using UnityEngine;
using System;
namespace UnityEngine.Experimental.Rendering.HDPipeline
{
[Serializable]
public class RenderingDebugSettings
{
public bool displayOpaqueObjects = true;
public bool displayTransparentObjects = true;
public bool enableDistortion = true;
public bool enableGaussianPyramid = true;
public bool enableSSSAndTransmission = true;
public bool enableAtmosphericScattering = true;
public bool allowStereo = true;
}
}

14
ScriptableRenderPipeline/HDRenderPipeline/FrameSettings.cs


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
namespace UnityEngine.Experimental.Rendering.HDPipeline
{
// The settings here are per frame settings. They can be changed by the renderer based on its need each frame.
public class LightingSettings
{
public float diffuseGlobalDimmer = 1.0f;
public float specularGlobalDimmer = 1.0f;
}
}

38
ScriptableRenderPipeline/HDRenderPipeline/GlobalSettings.cs


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
namespace UnityEngine.Experimental.Rendering.HDPipeline
{
// All the structures here represent global engine settings.
// It means that they are supposed to be setup once and not changed during the game.
// All of these will be serialized in the HDRenderPipelineInstance used for the project.
[Serializable]
public class GlobalTextureSettings
{
public const int kHDDefaultSpotCookieSize = 128;
public const int kHDDefaultPointCookieSize = 512;
public const int kHDDefaultReflectionCubemapSize = 128;
public int spotCookieSize = kHDDefaultSpotCookieSize;
public int pointCookieSize = kHDDefaultPointCookieSize;
public int reflectionCubemapSize = kHDDefaultReflectionCubemapSize;
public bool reflectionCacheCompressed = false;
}
[Serializable]
public class GlobalRenderingSettings
{
public bool useForwardRenderingOnly; // TODO: Currently there is no way to strip the extra forward shaders generated by the shaders compiler, so we can switch dynamically.
public bool useDepthPrepassWithDeferredRendering;
public bool renderAlphaTestOnlyInDeferredPrepass;
// We have to fall back to forward-only rendering when scene view is using wireframe rendering mode --
// as rendering everything in wireframe + deferred do not play well together
public bool ShouldUseForwardRenderingOnly()
{
return useForwardRenderingOnly || GL.wireframe;
}
}
}

11
ScriptableRenderPipeline/HDRenderPipeline/GlobalSettings.cs.meta


fileFormatVersion: 2
guid: 0e59d5f3fb6a6744dbb195534816c029
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

8
Tests/GraphicsTests/RenderPipeline/HDRenderPipeline/Scenes/2xxx_Lighting/2201_Env_SurfaceReactions.meta


fileFormatVersion: 2
guid: 640e34fffdb27d64ca5d604850e6a173
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

/ScriptableRenderPipeline/HDRenderPipeline/FrameSettings.cs.meta → /ScriptableRenderPipeline/HDRenderPipeline/RenderPipeline/FrameSettings.cs.meta

正在加载...
取消
保存