浏览代码

Merge branch 'Unity-2017.3' into LightweightPipeline

/RenderPassXR_Sandbox
Felipe Lira 7 年前
当前提交
68c6f48c
共有 30 个文件被更改,包括 538 次插入417 次删除
  1. 4
      ScriptableRenderPipeline/Core/TextureCache.cs
  2. 17
      ScriptableRenderPipeline/HDRenderPipeline/Editor/HDRenderPipelineInspector.cs
  3. 329
      ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipeline.cs
  4. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipelineAsset.asset
  5. 20
      ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/LightingConvexHullUtils.hlsl
  6. 4
      ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/ShadowDispatch.hlsl
  7. 17
      ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/TilePass.cs
  8. 2
      ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/lightlistbuild-clustered.compute
  9. 6
      ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/scrbound.compute
  10. 2
      ScriptableRenderPipeline/HDRenderPipeline/Lighting/Volumetrics/VolumetricLighting.cs
  11. 42
      ScriptableRenderPipeline/HDRenderPipeline/Material/LayeredLit/Editor/LayeredLitUI.cs
  12. 1
      ScriptableRenderPipeline/HDRenderPipeline/Material/LayeredLit/LayeredLit.shader
  13. 1
      ScriptableRenderPipeline/HDRenderPipeline/Material/LayeredLit/LayeredLitTessellation.shader
  14. 4
      ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/ShaderPass/LitDepthPass.hlsl
  15. 4
      ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/ShaderPass/LitDistortionPass.hlsl
  16. 4
      ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/ShaderPass/LitMetaPass.hlsl
  17. 4
      ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/ShaderPass/LitVelocityPass.hlsl
  18. 32
      ScriptableRenderPipeline/HDRenderPipeline/Material/MaterialUtilities.hlsl
  19. 4
      ScriptableRenderPipeline/HDRenderPipeline/ShaderPass/VertMesh.hlsl
  20. 15
      TestbedPipelines/Fptl/FptlLighting.cs
  21. 20
      TestbedPipelines/Fptl/LightingConvexHullUtils.hlsl
  22. 2
      TestbedPipelines/Fptl/lightlistbuild-clustered.compute
  23. 6
      TestbedPipelines/Fptl/scrbound.compute
  24. 10
      ImageTemplates/Editor.meta
  25. 214
      ScriptableRenderPipeline/HDRenderPipeline/HDStringConstants.cs
  26. 189
      ScriptableRenderPipeline/HDRenderPipeline/HDShaderIDs.cs
  27. 0
      /ScriptableRenderPipeline/HDRenderPipeline/HDStringConstants.cs.meta
  28. 0
      /ImageTemplates/Editor/TemplatePreprocessor.cs
  29. 0
      /ImageTemplates/Editor/TemplatePreprocessor.cs.meta

4
ScriptableRenderPipeline/Core/TextureCache.cs


{
sliceIndex = m_LocatorInSliceArray[texId];
bFoundAvailOrExistingSlice = true;
//assert(m_SliceArray[sliceIndex].TexID==TexID);
Debug.Assert(m_SliceArray[sliceIndex].texId == texId);
}
// If no existing copy found in the array

// wrap up
//assert(bFoundAvailOrExistingSlice);
Debug.Assert(bFoundAvailOrExistingSlice); // if this fails either increase the size of the texture cache or reduce number of unique cached textures in use.
if (bFoundAvailOrExistingSlice)
{
m_SliceArray[sliceIndex].countLRU = 0; // mark slice as in use this frame

17
ScriptableRenderPipeline/HDRenderPipeline/Editor/HDRenderPipelineInspector.cs


// Rendering Settings
public readonly GUIContent renderingSettingsLabel = new GUIContent("Rendering Settings");
public readonly GUIContent useForwardRenderingOnly = new GUIContent("Use Forward Rendering Only");
public readonly GUIContent useDepthPrepass = new GUIContent("Use Depth Prepass");
public readonly GUIContent useDepthPrepassWithDeferredRendering = new GUIContent("Use Depth Prepass with Deferred rendering");
// Texture Settings
public readonly GUIContent textureSettings = new GUIContent("Texture Settings");

// Rendering settings
m_RenderingUseForwardOnly = FindProperty(x => x.renderingSettings.useForwardRenderingOnly);
m_RenderingUseDepthPrepass = FindProperty(x => x.renderingSettings.useDepthPrepass);
m_RenderingUseDepthPrepass = FindProperty(x => x.renderingSettings.useDepthPrepassWithDeferredRendering);
// Subsurface Scattering Settings
// Old SSS Model >>>

EditorGUILayout.Space();
EditorGUILayout.LabelField(styles.renderingSettingsLabel);
EditorGUI.indentLevel++;
EditorGUI.BeginChangeCheck();
EditorGUILayout.PropertyField(m_RenderingUseDepthPrepass, styles.useDepthPrepass);
if (EditorGUI.EndChangeCheck())
if (!m_RenderingUseForwardOnly.boolValue) // If we are deferred
if (m_RenderingUseForwardOnly.boolValue && !m_RenderingUseDepthPrepass.boolValue)
{
// Force depth prepass for forward-only rendering (for FPTL, etc).
m_RenderingUseDepthPrepass.boolValue = true;
HackSetDirty(renderContext); // Repaint
}
EditorGUILayout.PropertyField(m_RenderingUseDepthPrepass, styles.useDepthPrepassWithDeferredRendering);
EditorGUI.indentLevel--;
}

329
ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipeline.cs


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

public class RenderingSettings
{
public bool useForwardRenderingOnly = 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 useDepthPrepass = false;
public bool useDepthPrepassWithDeferredRendering = false;
// 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

Material m_CameraMotionVectorsMaterial;
// Debug material
#if UNITY_EDITOR
Material m_ErrorMaterial;
#endif
// Various buffer
readonly int m_CameraColorBuffer;

// Debugging
MaterialPropertyBlock m_SharedPropertyBlock = new MaterialPropertyBlock();
public DebugDisplaySettings m_DebugDisplaySettings = new DebugDisplaySettings();
DebugDisplaySettings m_DebugDisplaySettings = new DebugDisplaySettings();
static DebugDisplaySettings s_NeutraDebugDisplaySettings = new DebugDisplaySettings();
DebugDisplaySettings m_CurrentDebugDisplaySettings = null;
private int m_DebugFullScreenTempRT;
private bool m_FullScreenDebugPushed = false;

m_DebugViewMaterialGBuffer = Utilities.CreateEngineMaterial(m_Asset.renderPipelineResources.debugViewMaterialGBufferShader);
m_DebugDisplayLatlong = Utilities.CreateEngineMaterial(m_Asset.renderPipelineResources.debugDisplayLatlongShader);
m_DebugFullScreen = Utilities.CreateEngineMaterial(m_Asset.renderPipelineResources.debugFullScreenShader);
#if UNITY_EDITOR
m_ErrorMaterial = Utilities.CreateEngineMaterial("Hidden/InternalErrorShader");
#endif
}
public void CreateSssMaterials(bool useDisneySSS)

Utilities.Destroy(m_DebugViewMaterialGBuffer);
Utilities.Destroy(m_DebugDisplayLatlong);
Utilities.Destroy(m_DebugFullScreen);
#if UNITY_EDITOR
Utilities.Destroy(m_ErrorMaterial);
#endif
m_SkyManager.Cleanup();

}
// Broadcast SSS parameters to all shaders.
Shader.SetGlobalInt( HDShaderIDs._EnableSSSAndTransmission, m_DebugDisplaySettings.renderingDebugSettings.enableSSSAndTransmission ? 1 : 0);
Shader.SetGlobalInt( HDShaderIDs._EnableSSSAndTransmission, m_CurrentDebugDisplaySettings.renderingDebugSettings.enableSSSAndTransmission ? 1 : 0);
Shader.SetGlobalInt( HDShaderIDs._TexturingModeFlags, (int)sssParameters.texturingModeFlags);
Shader.SetGlobalInt( HDShaderIDs._TransmissionFlags, (int)sssParameters.transmissionFlags);
Shader.SetGlobalInt( HDShaderIDs._UseDisneySSS, sssParameters.useDisneySSS ? 1 : 0);

{
// Currently, Unity does not offer a way to bind the stencil buffer as a texture in a compute shader.
// Therefore, it's manually copied using a pixel shader.
return m_DebugDisplaySettings.renderingDebugSettings.enableSSSAndTransmission || LightLoop.GetFeatureVariantsEnabled(m_Asset.tileSettings);
return m_CurrentDebugDisplaySettings.renderingDebugSettings.enableSSSAndTransmission || LightLoop.GetFeatureVariantsEnabled(m_Asset.tileSettings);
}
bool NeedHTileCopy()

return m_DebugDisplaySettings.renderingDebugSettings.enableSSSAndTransmission;
return m_CurrentDebugDisplaySettings.renderingDebugSettings.enableSSSAndTransmission;
}
RenderTargetIdentifier GetDepthTexture()

#if UNITY_EDITOR
SupportedRenderingFeatures.active = s_NeededFeatures;
#endif
// HD use specific GraphicsSettings. This is init here.
// TODO: This should not be set at each Frame but is there another place for these config setup ?
GraphicsSettings.lightsUseLinearIntensity = true;
GraphicsSettings.lightsUseColorTemperature = true;
if (m_FrameCount != Time.frameCount)
{

GraphicsSettings.lightsUseLinearIntensity = true;
GraphicsSettings.lightsUseColorTemperature = true;
// This is the main command buffer used for the frame.
CommandBuffer cmd = CommandBufferPool.Get("");

m_LightLoop.NewFrame();
ApplyDebugDisplaySettings();
UpdateCommonSettings();
// Set Frame constant buffer
// TODO...
// we only want to render one camera for now
// select the most main camera!

return;
}
// Set camera constant buffer
// TODO...
// If we render a reflection view or a preview we should not display any debug information
// This need to be call before ApplyDebugDisplaySettings()
if (camera.cameraType == CameraType.Reflection || camera.cameraType == CameraType.Preview)
{
// Neutral allow to disable all debug settings
m_CurrentDebugDisplaySettings = s_NeutraDebugDisplaySettings;
}
else
{
m_CurrentDebugDisplaySettings = m_DebugDisplaySettings;
}
ApplyDebugDisplaySettings();
UpdateCommonSettings();
ScriptableCullingParameters cullingParams;
if (!CullResults.GetCullingParameters(camera, out cullingParams))

}
m_LightLoop.UpdateCullingParameters( ref cullingParams );
// emit scene view UI
// emit scene view UI
{
}
#endif
CullResults.Cull(ref cullingParams, renderContext,ref m_CullResults);

if (additionalCameraData && additionalCameraData.renderingPath == RenderingPathHDRP.Unlit)
{
// TODO: Add another path dedicated to planar reflection / real time cubemap that implement simpler lighting
string passName = "Forward"; // It is up to the users to only send unlit object for this camera path
// It is up to the users to only send unlit object for this camera path
using (new Utilities.ProfilingSample(passName, cmd))
using (new Utilities.ProfilingSample("Forward", cmd))
RenderOpaqueRenderList(m_CullResults, camera, renderContext, cmd, passName);
RenderTransparentRenderList(m_CullResults, camera, renderContext, cmd, passName);
ShaderPassName[] arrayShaderPassName = { HDShaderPassNames.m_ForwardName };
RenderOpaqueRenderList(m_CullResults, camera, renderContext, cmd, arrayShaderPassName);
RenderTransparentRenderList(m_CullResults, camera, renderContext, cmd, arrayShaderPassName);
}
renderContext.ExecuteCommandBuffer(cmd);

RenderDepthPrepass(m_CullResults, camera, renderContext, cmd);
// Forward opaque with deferred/cluster tile require that we fill the depth buffer
// correctly to build the light list.
RenderForwardOnlyOpaqueDepthPrepass(m_CullResults, camera, renderContext, cmd);
RenderGBuffer(m_CullResults, camera, renderContext, cmd);
// If full forward rendering, we did not do any rendering yet, so don't need to copy the buffer.

// Required for the SSS and the shader feature classification pass.
PrepareAndBindStencilTexture(cmd);
if (m_DebugDisplaySettings.IsDebugMaterialDisplayEnabled())
if (m_CurrentDebugDisplaySettings.IsDebugMaterialDisplayEnabled())
{
RenderDebugViewMaterial(m_CullResults, hdCamera, renderContext, cmd);
}

{
// TODO: Everything here (SSAO, Shadow, Build light list, material and light classification can be parallelize with Async compute)
// TODO: Everything here (SSAO, Shadow, Build light list, deffered shadow, material and light classification can be parallelize with Async compute)
m_SsaoEffect.Render(ssaoSettingsToUse, this, hdCamera, renderContext, cmd, m_Asset.renderingSettings.useForwardRenderingOnly);
m_LightLoop.PrepareLightsForGPU(m_ShadowSettings, m_CullResults, camera);
m_LightLoop.RenderShadows(renderContext, cmd, m_CullResults);

m_LightLoop.BuildGPULightLists(camera, cmd, m_CameraDepthStencilBufferRT, GetStencilTexture());
}
// Caution: We require sun light here as some sky use the sun light to render, mean UpdateSkyEnvironment
// must be call after BuildGPULightLists.
// TODO: Try to arrange code so we can trigger this call earlier and use async compute here to run sky convolution during other passes (once we move convolution shader to compute).
UpdateSkyEnvironment(hdCamera, cmd);
// Don't update the sky environment if we are rendering a cubemap (it should be update already)
if (camera.cameraType != CameraType.Reflection)
{
// Caution: We require sun light here as some sky use the sun light to render, mean UpdateSkyEnvironment
// must be call after BuildGPULightLists.
// TODO: Try to arrange code so we can trigger this call earlier and use async compute here to run sky convolution during other passes (once we move convolution shader to compute).
UpdateSkyEnvironment(hdCamera, cmd);
}
RenderDeferredLighting(hdCamera, cmd);

SubsurfaceScatteringPass(hdCamera, cmd, m_Asset.sssSettings);
// For opaque forward we have split rendering in two categories
// Material that are always forward and material that can be deferred or forward depends on render pipeline options (like switch to rendering forward only mode)
// Material that are always forward are unlit and complex (Like Hair) and don't require sorting, so it is ok to split them.
RenderForward(m_CullResults, camera, renderContext, cmd, true); // Render deferred or forward opaque
RenderForwardOnlyOpaque(m_CullResults, camera, renderContext, cmd);
RenderForward(m_CullResults, camera, renderContext, cmd, true);
#if UNITY_EDITOR
RenderForwardError(m_CullResults, camera, renderContext, cmd, true);
#endif
RenderLightingDebug(hdCamera, cmd, m_CameraColorBufferRT, m_DebugDisplaySettings);
RenderLightingDebug(hdCamera, cmd, m_CameraColorBufferRT, m_CurrentDebugDisplaySettings);
// If full forward rendering, we did just rendered everything, so we can copy the depth buffer
// If Deferred nothing needs copying anymore.

// Render all type of transparent forward (unlit, lit, complex (hair...)) to keep the sorting between transparent objects.
RenderForward(m_CullResults, camera, renderContext, cmd, false);
// Render fog.
VolumetricLightingPass(cmd, hdCamera);
#if UNITY_EDITOR
RenderForwardError(m_CullResults, camera, renderContext, cmd, false);
#endif
// Render volumetric lighting
VolumetricLightingPass(hdCamera, cmd);
PushFullScreenDebugTexture(cmd, m_CameraColorBuffer, camera, renderContext, FullScreenDebugMode.NanTracker);

RenderDebug(hdCamera, cmd);
#if UNITY_EDITOR
#endif
renderContext.ExecuteCommandBuffer(cmd);
CommandBufferPool.Release(cmd);

private static Material m_ErrorMaterial;
private static Material errorMaterial
void RenderOpaqueRenderList(CullResults cull, Camera camera, ScriptableRenderContext renderContext, CommandBuffer cmd, ShaderPassName passName, RendererConfiguration rendererConfiguration = 0, Material overrideMaterial = null)
get
{
if (m_ErrorMaterial == null)
m_ErrorMaterial = new Material(Shader.Find("Hidden/InternalErrorShader"));
return m_ErrorMaterial;
}
RenderOpaqueRenderList(cull, camera, renderContext, cmd, new ShaderPassName[] { passName }, rendererConfiguration, overrideMaterial);
void RenderOpaqueRenderList(CullResults cull, Camera camera, ScriptableRenderContext renderContext, CommandBuffer cmd, string passName, RendererConfiguration rendererConfiguration = 0)
void RenderOpaqueRenderList(CullResults cull, Camera camera, ScriptableRenderContext renderContext, CommandBuffer cmd, ShaderPassName[] passNames, RendererConfiguration rendererConfiguration = 0, Material overrideMaterial = null)
if (!m_DebugDisplaySettings.renderingDebugSettings.displayOpaqueObjects)
if (!m_CurrentDebugDisplaySettings.renderingDebugSettings.displayOpaqueObjects)
return;
// This is done here because DrawRenderers API lives outside command buffers so we need to make call this before doing any DrawRenders

var drawSettings = new DrawRendererSettings(camera, new ShaderPassName(passName))
var drawSettings = new DrawRendererSettings(camera, HDShaderPassNames.s_EmptyName)
drawSettings.SetShaderPassName(1, new ShaderPassName("SRPDefaultUnlit"));
for (int i = 0; i < passNames.Length; ++i)
{
drawSettings.SetShaderPassName(i, passNames[i]);
}
if (overrideMaterial != null)
{
drawSettings.SetOverrideMaterial(overrideMaterial, 0);
}
#if UNITY_EDITOR
// in editor draw invalid things with error material
ConfigureErrorDraw(ref drawSettings);
renderContext.DrawRenderers(cull.visibleRenderers, ref drawSettings, filterSettings);
#endif
}
void RenderTransparentRenderList(CullResults cull, Camera camera, ScriptableRenderContext renderContext, CommandBuffer cmd, ShaderPassName passName, RendererConfiguration rendererConfiguration = 0, Material overrideMaterial = null)
{
RenderTransparentRenderList(cull, camera, renderContext, cmd, new ShaderPassName[] { passName }, rendererConfiguration, overrideMaterial);
void RenderTransparentRenderList(CullResults cull, Camera camera, ScriptableRenderContext renderContext, CommandBuffer cmd, string passName, RendererConfiguration rendererConfiguration = 0)
void RenderTransparentRenderList(CullResults cull, Camera camera, ScriptableRenderContext renderContext, CommandBuffer cmd, ShaderPassName[] passNames, RendererConfiguration rendererConfiguration = 0, Material overrideMaterial = null)
if (!m_DebugDisplaySettings.renderingDebugSettings.displayTransparentObjects)
if (!m_CurrentDebugDisplaySettings.renderingDebugSettings.displayTransparentObjects)
return;
// This is done here because DrawRenderers API lives outside command buffers so we need to make call this before doing any DrawRenders

var drawSettings = new DrawRendererSettings(camera, new ShaderPassName(passName))
var drawSettings = new DrawRendererSettings(camera, HDShaderPassNames.s_EmptyName)
var filterSettings = new FilterRenderersSettings(true) {renderQueueRange = RenderQueueRange.transparent};
renderContext.DrawRenderers(cull.visibleRenderers, ref drawSettings, filterSettings);
for (int i = 0; i < passNames.Length; ++i)
{
drawSettings.SetShaderPassName(i, passNames[i]);
}
if (overrideMaterial != null)
{
drawSettings.SetOverrideMaterial(overrideMaterial, 0);
}
#if UNITY_EDITOR
// in editor draw invalid things with error material
ConfigureErrorDraw(ref drawSettings);
var filterSettings = new FilterRenderersSettings(true) {renderQueueRange = RenderQueueRange.transparent};
#endif
private static void ConfigureErrorDraw(ref DrawRendererSettings drawSettings)
void RenderDepthPrepass(CullResults cull, Camera camera, ScriptableRenderContext renderContext, CommandBuffer cmd)
drawSettings.SetShaderPassName(0, new ShaderPassName("Always"));
drawSettings.SetShaderPassName(1, new ShaderPassName("ForwardBase"));
drawSettings.SetShaderPassName(2, new ShaderPassName("Deferred"));
drawSettings.SetShaderPassName(3, new ShaderPassName("PrepassBase"));
drawSettings.SetShaderPassName(4, new ShaderPassName("Vertex"));
drawSettings.SetShaderPassName(5, new ShaderPassName("VertexLMRGBM"));
drawSettings.SetShaderPassName(6, new ShaderPassName("VertexLM"));
drawSettings.SetOverrideMaterial(errorMaterial, 0);
}
// Guidelines: To be able to switch from deferred to forward renderer we need to have forward opaque material with both DepthOnly and ForwardOnlyOpaqueDepthOnly pass.
// This is also required if we want to support optional depth prepass dynamically.
// This is what is assume here. But users may want to reduce number of shader combination once they have made their choice.
// In case of forward only renderer we have a depth prepass. In case of deferred renderer, it is optional
bool addDepthPrepass = m_Asset.renderingSettings.ShouldUseForwardRenderingOnly() || m_Asset.renderingSettings.useDepthPrepassWithDeferredRendering;
// In case of deferred renderer, we can have forward opaque material. These materials need to be render in the depth buffer to correctly build the light list. And they will tag the stencil to not be lit during the deferred lighting pass.
// Caution: If a DepthPrepass is enabled for deferred then the object will be rendered with the pass DepthPrepass. See guidelines. This allow to switch dynamically between both mode.
// So we don't need to render the ForwardOnlyOpaqueDepthOnly pass
// Note that an object can't be in both list
bool addForwardOnlyOpaqueDepthPrepass = !m_Asset.renderingSettings.ShouldUseForwardRenderingOnly() && !m_Asset.renderingSettings.useDepthPrepassWithDeferredRendering;
void RenderDepthPrepass(CullResults cull, Camera camera, ScriptableRenderContext renderContext, CommandBuffer cmd)
{
if (!m_Asset.renderingSettings.useDepthPrepass)
if (addDepthPrepass == false && addForwardOnlyOpaqueDepthPrepass == false)
using (new Utilities.ProfilingSample("Depth Prepass", cmd))
using (new Utilities.ProfilingSample(addDepthPrepass ? "Depth Prepass" : "Depth Prepass forward opaque ", cmd))
// TODO: Must do opaque then alpha masked for performance!
// TODO: front to back for opaque and by material for opaque tested when we split in two
// TODO: We should sort the Material by opaque then alpha masked Must do opaque then alpha masked for performance
RenderOpaqueRenderList(cull, camera, renderContext, cmd, "DepthOnly");
// Note: addDepthPrepass and addForwardOnlyOpaqueDepthPrepass can't be both true at the same time. And if we are here both are not false
RenderOpaqueRenderList(cull, camera, renderContext, cmd, addDepthPrepass ? HDShaderPassNames.m_DepthOnlyName : HDShaderPassNames.m_ForwardOnlyOpaqueDepthOnlyName);
}
}

return;
string passName = m_DebugDisplaySettings.IsDebugDisplayEnabled() ? "GBufferDebugDisplay" : "GBuffer";
using (new Utilities.ProfilingSample(passName, cmd))
using (new Utilities.ProfilingSample(m_CurrentDebugDisplaySettings.IsDebugDisplayEnabled() ? "GBufferDebugDisplay" : "GBuffer", cmd))
RenderOpaqueRenderList(cull, camera, renderContext, cmd, passName, Utilities.kRendererConfigurationBakedLighting);
}
}
// This pass is use in case of forward opaque and deferred rendering. We need to render forward objects before tile lighting pass
void RenderForwardOnlyOpaqueDepthPrepass(CullResults cull, Camera camera, ScriptableRenderContext renderContext, CommandBuffer cmd)
{
// If we are forward only we don't need to render ForwardOnlyOpaqueDepthOnly object
// But in case we request a prepass we render it
if (m_Asset.renderingSettings.ShouldUseForwardRenderingOnly() && !m_Asset.renderingSettings.useDepthPrepass)
return;
using (new Utilities.ProfilingSample("Forward opaque depth", cmd))
{
Utilities.SetRenderTarget(cmd, m_CameraDepthStencilBufferRT);
RenderOpaqueRenderList(cull, camera, renderContext, cmd, "ForwardOnlyOpaqueDepthOnly");
RenderOpaqueRenderList(cull, camera, renderContext, cmd, m_CurrentDebugDisplaySettings.IsDebugDisplayEnabled() ? HDShaderPassNames.m_GBufferDebugDisplayName : HDShaderPassNames.m_GBufferName, Utilities.kRendererConfigurationBakedLighting);
}
}

{
if(m_DebugDisplaySettings.materialDebugSettings.IsDebugGBufferEnabled() && !m_Asset.renderingSettings.ShouldUseForwardRenderingOnly())
if (m_CurrentDebugDisplaySettings.materialDebugSettings.IsDebugGBufferEnabled() && !m_Asset.renderingSettings.ShouldUseForwardRenderingOnly())
{
using (new Utilities.ProfilingSample("DebugViewMaterialGBuffer", cmd))
{

{
Utilities.SetRenderTarget(cmd, m_CameraColorBufferRT, m_CameraDepthStencilBufferRT, Utilities.kClearAll, Color.black);
// Render Opaque forward
RenderOpaqueRenderList(cull, hdCamera.camera, renderContext, cmd, "ForwardDisplayDebug", Utilities.kRendererConfigurationBakedLighting);
RenderOpaqueRenderList(cull, hdCamera.camera, renderContext, cmd, HDShaderPassNames.m_ForwardDisplayDebugName, Utilities.kRendererConfigurationBakedLighting);
RenderTransparentRenderList(cull, hdCamera.camera, renderContext, cmd, "ForwardDisplayDebug", Utilities.kRendererConfigurationBakedLighting);
RenderTransparentRenderList(cull, hdCamera.camera, renderContext, cmd, HDShaderPassNames.m_ForwardDisplayDebugName, Utilities.kRendererConfigurationBakedLighting);
}
}

LightLoop.LightingPassOptions options = new LightLoop.LightingPassOptions();
options.volumetricLightingEnabled = m_VolumetricLightingEnabled;
if (m_DebugDisplaySettings.renderingDebugSettings.enableSSSAndTransmission)
if (m_CurrentDebugDisplaySettings.renderingDebugSettings.enableSSSAndTransmission)
m_LightLoop.RenderDeferredLighting(hdCamera, cmd, m_DebugDisplaySettings, colorRTs, m_CameraDepthStencilBufferRT, depthTexture, m_DeferredShadowBuffer, options);
m_LightLoop.RenderDeferredLighting(hdCamera, cmd, m_CurrentDebugDisplaySettings, colorRTs, m_CameraDepthStencilBufferRT, depthTexture, m_DeferredShadowBuffer, options);
m_LightLoop.RenderDeferredLighting(hdCamera, cmd, m_DebugDisplaySettings, colorRTs, m_CameraDepthStencilBufferRT, depthTexture, m_DeferredShadowBuffer, options);
m_LightLoop.RenderDeferredLighting(hdCamera, cmd, m_CurrentDebugDisplaySettings, colorRTs, m_CameraDepthStencilBufferRT, depthTexture, m_DeferredShadowBuffer, options);
}
// Combines specular lighting and diffuse lighting with subsurface scattering.

if (!m_DebugDisplaySettings.renderingDebugSettings.enableSSSAndTransmission || m_Asset.renderingSettings.ShouldUseForwardRenderingOnly())
if (!m_CurrentDebugDisplaySettings.renderingDebugSettings.enableSSSAndTransmission || m_Asset.renderingSettings.ShouldUseForwardRenderingOnly())
return;
using (new Utilities.ProfilingSample("Subsurface Scattering", cmd))

m_LightLoop.RenderLightingDebug(camera, cmd, colorBuffer, debugDisplaySettings);
}
// Render forward is use for both transparent and opaque objects. In case of deferred we can still render opaque object in forward.
if (!m_Asset.renderingSettings.ShouldUseForwardRenderingOnly() && renderOpaque)
return;
// Guidelines: To be able to switch from deferred to forward renderer we need to have forward opaque material with both Forward and ForwardOnlyOpaque pass.
// This is what is assume here. But users may want to reduce number of shader combination once they have made their choice.
string passName = m_DebugDisplaySettings.IsDebugDisplayEnabled() ? "ForwardDisplayDebug" : "Forward";
// If we are transparent, we add the forward pass. Else (Render Opaque) we add it only if we are forward rendering
bool addForwardPass = !renderOpaque || m_Asset.renderingSettings.ShouldUseForwardRenderingOnly();
using (new Utilities.ProfilingSample(passName, cmd))
// In case of deferred we can still have forward opaque object
// It mean that addForwardOnlyOpaquePass = !addForwardPass which is a simplification of: renderOpaque && !m_Asset.renderingSettings.ShouldUseForwardRenderingOnly()
// There is no need to store this case as we don't need to test for it
ShaderPassName passName;
string profileName;
if (m_CurrentDebugDisplaySettings.IsDebugDisplayEnabled())
{
passName = addForwardPass ? HDShaderPassNames.m_ForwardDisplayDebugName : HDShaderPassNames.m_ForwardOnlyOpaqueDisplayDebugName;
profileName = addForwardPass ? (renderOpaque ? "Forward Opaque Display Debug" : "Forward Transparent Display Debug") : "ForwardOnlyOpaqueDisplayDebug";
}
else
{
passName = addForwardPass ? HDShaderPassNames.m_ForwardName : HDShaderPassNames.m_ForwardOnlyOpaqueName;
profileName = addForwardPass ? (renderOpaque ? "Forward Opaque" : "Forward Transparent") : "Forward Only Opaque";
}
using (new Utilities.ProfilingSample(profileName, cmd))
// The pass "SRPDefaultUnlit" is a fallback to legacy unlit rendering and is required to support unity 2d + unity UI that render in the scene.
ShaderPassName[] arrayNames = { passName, HDShaderPassNames.m_SRPDefaultUnlitName};
RenderOpaqueRenderList(cullResults, camera, renderContext, cmd, passName, Utilities.kRendererConfigurationBakedLighting);
RenderOpaqueRenderList(cullResults, camera, renderContext, cmd, arrayNames, Utilities.kRendererConfigurationBakedLighting);
RenderTransparentRenderList(cullResults, camera, renderContext, cmd, passName, Utilities.kRendererConfigurationBakedLighting);
RenderTransparentRenderList(cullResults, camera, renderContext, cmd, arrayNames, Utilities.kRendererConfigurationBakedLighting);
// Render material that are forward opaque only (like eye), this include unlit material
void RenderForwardOnlyOpaque(CullResults cullResults, Camera camera, ScriptableRenderContext renderContext, CommandBuffer cmd)
#if UNITY_EDITOR
// This is use to Display legacy shader with an error shader
void RenderForwardError(CullResults cullResults, Camera camera, ScriptableRenderContext renderContext, CommandBuffer cmd, bool renderOpaque)
string passName = m_DebugDisplaySettings.IsDebugDisplayEnabled() ? "ForwardOnlyOpaqueDisplayDebug" : "ForwardOnlyOpaque";
using (new Utilities.ProfilingSample(passName, cmd))
using (new Utilities.ProfilingSample("Render Forward Error", cmd))
m_LightLoop.RenderForward(camera, cmd, true);
ShaderPassName[] arrayNames = { HDShaderPassNames.m_AlwaysName, HDShaderPassNames.m_ForwardBaseName, HDShaderPassNames.m_DeferredName, HDShaderPassNames.m_PrepassBaseName, HDShaderPassNames.m_VertexName, HDShaderPassNames.m_VertexLMRGBMName, HDShaderPassNames.m_VertexLMName };
RenderOpaqueRenderList(cullResults, camera, renderContext, cmd, passName, Utilities.kRendererConfigurationBakedLighting);
if (renderOpaque)
{
RenderOpaqueRenderList(cullResults, camera, renderContext, cmd, arrayNames, 0, m_ErrorMaterial);
}
else
{
RenderTransparentRenderList(cullResults, camera, renderContext, cmd, arrayNames, 0, m_ErrorMaterial);
}
#endif
void RenderVelocity(CullResults cullResults, HDCamera hdcam, ScriptableRenderContext renderContext, CommandBuffer cmd)
{

if ((ShaderConfig.s_VelocityInGbuffer == 1) || m_Asset.renderingSettings.ShouldUseForwardRenderingOnly())
// TODO: Currently we can't render velocity vector into GBuffer, neither during forward pass (in case of forward opaque), so it is always a separate pass
// Note that we if we have forward only opaque with deferred rendering, it must also support the rendering of velocity vector to be correct with following test.
if ((ShaderConfig.s_VelocityInGbuffer == 1))
{
Debug.LogWarning("Velocity in Gbuffer is currently not supported");
}
// These flags are still required in SRP or the engine won't compute previous model matrices...
// If the flag hasn't been set yet on this camera, motion vectors will skip a frame.

Utilities.DrawFullScreen(cmd, m_CameraMotionVectorsMaterial, m_VelocityBufferRT, null, 0);
cmd.SetRenderTarget(m_VelocityBufferRT, m_CameraDepthStencilBufferRT);
RenderOpaqueRenderList(cullResults, hdcam.camera, renderContext, cmd, "MotionVectors", RendererConfiguration.PerObjectMotionVectors);
RenderOpaqueRenderList(cullResults, hdcam.camera, renderContext, cmd, HDShaderPassNames.m_MotionVectorsName, RendererConfiguration.PerObjectMotionVectors);
PushFullScreenDebugTexture(cmd, m_VelocityBuffer, hdcam.camera, renderContext, FullScreenDebugMode.MotionVectors);
}

{
if (!m_DebugDisplaySettings.renderingDebugSettings.enableDistortion)
if (!m_CurrentDebugDisplaySettings.renderingDebugSettings.enableDistortion)
return;
using (new Utilities.ProfilingSample("Distortion", cmd))

cmd.ClearRenderTarget(false, true, Color.black); // TODO: can we avoid this clear for performance ?
// Only transparent object can render distortion vectors
RenderTransparentRenderList(cullResults, camera, renderContext, cmd, "DistortionVectors");
RenderTransparentRenderList(cullResults, camera, renderContext, cmd, HDShaderPassNames.m_DistortionVectorsName);
}
}

public void ApplyDebugDisplaySettings()
{
m_ShadowSettings.enabled = m_DebugDisplaySettings.lightingDebugSettings.enableShadows;
m_ShadowSettings.enabled = m_CurrentDebugDisplaySettings.lightingDebugSettings.enableShadows;
LightingDebugSettings lightingDebugSettings = m_DebugDisplaySettings.lightingDebugSettings;
LightingDebugSettings lightingDebugSettings = m_CurrentDebugDisplaySettings.lightingDebugSettings;
Shader.SetGlobalInt(HDShaderIDs._DebugViewMaterial, (int)m_DebugDisplaySettings.GetDebugMaterialIndex());
Shader.SetGlobalInt(HDShaderIDs._DebugLightingMode, (int)m_DebugDisplaySettings.GetDebugLightingMode());
Shader.SetGlobalInt(HDShaderIDs._DebugViewMaterial, (int)m_CurrentDebugDisplaySettings.GetDebugMaterialIndex());
Shader.SetGlobalInt(HDShaderIDs._DebugLightingMode, (int)m_CurrentDebugDisplaySettings.GetDebugLightingMode());
Shader.SetGlobalVector(HDShaderIDs._DebugLightingAlbedo, debugAlbedo);
Shader.SetGlobalVector(HDShaderIDs._DebugLightingSmoothness, debugSmoothness);
}

if (debugMode == m_DebugDisplaySettings.fullScreenDebugMode)
if (debugMode == m_CurrentDebugDisplaySettings.fullScreenDebugMode)
{
m_FullScreenDebugPushed = true; // We need this flag because otherwise if no fullscreen debug is pushed, when we render the result in RenderDebug the temporary RT will not exist.
cb.GetTemporaryRT(m_DebugFullScreenTempRT, camera.pixelWidth, camera.pixelHeight, 0, FilterMode.Point, RenderTextureFormat.ARGBHalf, RenderTextureReadWrite.Linear);

Utilities.SetRenderTarget(cmd, BuiltinRenderTextureType.CameraTarget, m_CameraDepthStencilBufferRT);
// First render full screen debug texture
if(m_DebugDisplaySettings.fullScreenDebugMode != FullScreenDebugMode.None && m_FullScreenDebugPushed)
if (m_CurrentDebugDisplaySettings.fullScreenDebugMode != FullScreenDebugMode.None && m_FullScreenDebugPushed)
m_DebugFullScreen.SetFloat(HDShaderIDs._FullScreenDebugMode, (float)m_DebugDisplaySettings.fullScreenDebugMode);
m_DebugFullScreen.SetFloat(HDShaderIDs._FullScreenDebugMode, (float)m_CurrentDebugDisplaySettings.fullScreenDebugMode);
float overlayRatio = m_DebugDisplaySettings.debugOverlayRatio;
float overlayRatio = m_CurrentDebugDisplaySettings.debugOverlayRatio;
LightingDebugSettings lightingDebug = m_DebugDisplaySettings.lightingDebugSettings;
LightingDebugSettings lightingDebug = m_CurrentDebugDisplaySettings.lightingDebugSettings;
if (lightingDebug.displaySkyReflection)
{

Utilities.NextOverlayCoord(ref x, ref y, overlaySize, overlaySize, camera.camera.pixelWidth);
}
m_LightLoop.RenderDebugOverlay(camera.camera, cmd, m_DebugDisplaySettings, ref x, ref y, overlaySize, camera.camera.pixelWidth);
m_LightLoop.RenderDebugOverlay(camera.camera, cmd, m_CurrentDebugDisplaySettings, ref x, ref y, overlaySize, camera.camera.pixelWidth);
}
}

2
ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipelineAsset.asset


type: 2}
renderingSettings:
useForwardRenderingOnly: 0
useDepthPrepass: 0
useDepthPrepassWithDeferredRendering: 0
sssSettings:
numProfiles: 2
profiles:

20
ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/LightingConvexHullUtils.hlsl


vE0 = p1-p0;
}
void GetQuad(out float3 p0, out float3 p1, out float3 p2, out float3 p3, const float3 boxX, const float3 boxY, const float3 boxZ, const float3 center, const float2 scaleXY, const int sideIndex)
void GetHullQuad(out float3 p0, out float3 p1, out float3 p2, out float3 p3, const float3 boxX, const float3 boxY, const float3 boxZ, const float3 center, const float2 scaleXY, const int sideIndex)
{
//const int iAbsSide = (sideIndex == 0 || sideIndex == 1) ? 0 : ((sideIndex == 2 || sideIndex == 3) ? 1 : 2);
const int iAbsSide = min(sideIndex>>1, 2);

p3 = center + (vA2 + vB2 + vC);
}
void GetPlane(out float3 p0, out float3 vN, const float3 boxX, const float3 boxY, const float3 boxZ, const float3 center, const float2 scaleXY, const int sideIndex)
void GetHullPlane(out float3 p0, out float3 n0, const float3 boxX, const float3 boxY, const float3 boxZ, const float3 center, const float2 scaleXY, const int sideIndex)
{
//const int iAbsSide = (sideIndex == 0 || sideIndex == 1) ? 0 : ((sideIndex == 2 || sideIndex == 3) ? 1 : 2);
const int iAbsSide = min(sideIndex>>1, 2);

if (bIsSideQuad) { vA2 *= (iAbsSide == 0 ? scaleXY.x : scaleXY.y); vB2 *= (iAbsSide == 0 ? scaleXY.y : scaleXY.x); }
p0 = center + (vA + vB - vC); // center + vA is center of face when scaleXY is 1.0
float3 vNout = cross( vB2, 0.5*(vA-vA2) - vC );
#if USE_LEFT_HAND_CAMERA_SPACE
vNout = -vNout;
#endif
vN = vNout;
float3 vN = cross(vB2, 0.5 * (vA - vA2) - vC); // +/- normal
float3 v0 = vA + vB - vC; // vector from center to p0
p0 = center + v0; // center + vA is center of face when scaleXY is 1.0
n0 = dot(vN,v0) < 0.0 ? (-vN) : vN;
float4 GetPlaneEq(const float3 boxX, const float3 boxY, const float3 boxZ, const float3 center, const float2 scaleXY, const int sideIndex)
float4 GetHullPlaneEq(const float3 boxX, const float3 boxY, const float3 boxZ, const float3 center, const float2 scaleXY, const int sideIndex)
GetPlane(p0, vN, boxX, boxY, boxZ, center, scaleXY, sideIndex);
GetHullPlane(p0, vN, boxX, boxY, boxZ, center, scaleXY, sideIndex);
return float4(vN, -dot(vN,p0));
}

4
ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/ShadowDispatch.hlsl


// directional
#define SHADOW_DISPATCH_DIR_TEX 3
#define SHADOW_DISPATCH_DIR_SMP 0
#define SHADOW_DISPATCH_DIR_ALG GPUSHADOWALGORITHM_PCF_TENT_7X7
#define SHADOW_DISPATCH_DIR_ALG GPUSHADOWALGORITHM_PCF_TENT_5X5
// point
#define SHADOW_DISPATCH_POINT_TEX 3
#define SHADOW_DISPATCH_POINT_SMP 0

//punctual
#define SHADOW_DISPATCH_PUNC_TEX 3
#define SHADOW_DISPATCH_PUNC_SMP 0
#define SHADOW_DISPATCH_PUNC_ALG GPUSHADOWALGORITHM_PCF_TENT_7X7
#define SHADOW_DISPATCH_PUNC_ALG GPUSHADOWALGORITHM_PCF_9TAP
// example of overriding directional lights
#ifdef SHADOW_DISPATCH_USE_CUSTOM_DIRECTIONAL

17
ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/TilePass.cs


}
else if (gpuLightType == GPULightType.Point)
{
bool isNegDeterminant = Vector3.Dot(worldToView.GetColumn(0), Vector3.Cross(worldToView.GetColumn(1), worldToView.GetColumn(2))) < 0.0f; // 3x3 Determinant.
Vector3 vx = xAxisVS;
Vector3 vy = yAxisVS;
Vector3 vz = zAxisVS;
bound.center = positionVS;
bound.boxAxisX.Set(range, 0, 0);
bound.boxAxisY.Set(0, range, 0);
bound.boxAxisZ.Set(0, 0, isNegDeterminant ? (-range) : range); // transform to camera space (becomes a left hand coordinate frame in Unity since Determinant(worldToView)<0)
bound.center = positionVS;
bound.boxAxisX = vx * range;
bound.boxAxisY = vy * range;
bound.boxAxisZ = vz * range;
// represents a left hand coordinate system in world space since det(worldToView)<0
Vector3 vx = xAxisVS;
Vector3 vy = yAxisVS;
Vector3 vz = zAxisVS;
// fill up ldata
lightVolumeData.lightAxisX = vx;

2
ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/lightlistbuild-clustered.compute


const float radius = lgtDat.radius;
const float2 scaleXY = lgtDat.scaleXY;
return GetPlaneEq(boxX, boxY, boxZ, center, scaleXY, p);
return GetHullPlaneEq(boxX, boxY, boxZ, center, scaleXY, p);
}

6
ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/scrbound.compute


if(sideIndex<6 && lgtIndex<(int) g_iNrVisibLights) // mask 2 out of 8 threads
{
float3 q0, q1, q2, q3;
GetQuad(q0, q1, q2, q3, boxX, boxY, boxZ, center, scaleXY, sideIndex);
GetHullQuad(q0, q1, q2, q3, boxX, boxY, boxZ, center, scaleXY, sideIndex);
const float4 vP0 = mul(g_mProjection, float4(q0, 1));

for(f=0; f<6; f++)
{
float3 q0, q1, q2, q3;
GetQuad(q0, q1, q2, q3, boxX, boxY, boxZ, center, scaleXY, f);
GetHullQuad(q0, q1, q2, q3, boxX, boxY, boxZ, center, scaleXY, f);
// 4 vertices to a quad of the convex hull in post projection space
const float4 vP0 = mul(g_mProjection, float4(q0, 1));

for(f=0; f<6; f++)
{
float3 vP0, vN;
GetPlane(vP0, vN, boxX, boxY, boxZ, center, scaleXY, f);
GetHullPlane(vP0, vN, boxX, boxY, boxZ, center, scaleXY, f);
for(i=0; i<8; i++)
{

2
ScriptableRenderPipeline/HDRenderPipeline/Lighting/Volumetrics/VolumetricLighting.cs


return (globalFogComponent != null);
}
void VolumetricLightingPass(CommandBuffer cmd, HDCamera hdCamera)
void VolumetricLightingPass(HDCamera hdCamera, CommandBuffer cmd)
{
if (!SetGlobalVolumeProperties(m_VolumetricLightingEnabled, cmd, m_VolumetricLightingCS)) { return; }

42
ScriptableRenderPipeline/HDRenderPipeline/Material/LayeredLit/Editor/LayeredLitUI.cs


const string kHeightTransition = "_HeightTransition";
// UI
MaterialProperty showMaterialReferences = null;
const string kShowMaterialReferences = "_ShowMaterialReferences";
MaterialProperty[] showLayer = new MaterialProperty[kMaxLayerCount];
const string kShowLayer = "_ShowLayer";

useMainLayerInfluence = FindProperty(kkUseMainLayerInfluence, props);
useHeightBasedBlend = FindProperty(kUseHeightBasedBlend, props);
heightTransition = FindProperty(kHeightTransition, props);
showMaterialReferences = FindProperty(kShowMaterialReferences, props);
for (int i = 0; i < kMaxLayerCount; ++i)
{

bool DoMaterialReferencesGUI(AssetImporter materialImporter)
{
EditorGUILayout.LabelField(styles.materialReferencesText, EditorStyles.boldLabel);
EditorGUI.indentLevel++;
showMaterialReferences.floatValue = EditorGUILayout.Foldout(showMaterialReferences.floatValue != 0.0f, styles.materialReferencesText, styles.layerLabelColors[0]) ? 1.0f : 0.0f;
if (showMaterialReferences.floatValue == 0.0f)
return false;
bool layersChanged = false;
Material material = m_MaterialEditor.target as Material;

SynchronizeLayerProperties(material, m_MaterialLayers, layerIndex, false);
layersChanged = true;
}
}
GUILayout.BeginHorizontal();
{
GUILayout.FlexibleSpace();
if (GUILayout.Button(styles.syncAllButUVButtonText))
GUILayout.BeginHorizontal();
SynchronizeAllLayersProperties(true);
layersChanged = true;
}
if (GUILayout.Button(styles.syncAllButtonText))
{
SynchronizeAllLayersProperties(false);
layersChanged = true;
GUILayout.FlexibleSpace();
if (GUILayout.Button(styles.syncAllButUVButtonText))
{
SynchronizeLayerProperties(material, m_MaterialLayers, layerIndex, true);
layersChanged = true;
}
if (GUILayout.Button(styles.syncAllButtonText))
{
SynchronizeLayerProperties(material, m_MaterialLayers, layerIndex, false);
layersChanged = true;
}
GUILayout.EndHorizontal();
GUILayout.EndHorizontal();
EditorGUI.indentLevel--;
return layersChanged;
}

EditorGUILayout.Space();
layerChanged |= DoMaterialReferencesGUI(materialImporter);
EditorGUILayout.Space();
for (int i = 0; i < numLayer; i++)
{
layerChanged |= DoLayerGUI(materialImporter, i);

layerChanged |= DoMaterialReferencesGUI(materialImporter);
layerChanged |= GUI.changed;
GUI.changed = false;

1
ScriptableRenderPipeline/HDRenderPipeline/Material/LayeredLit/LayeredLit.shader


[HideInInspector] _UVDetailsMappingMask2("_UVDetailsMappingMask2", Color) = (1, 0, 0, 0)
[HideInInspector] _UVDetailsMappingMask3("_UVDetailsMappingMask3", Color) = (1, 0, 0, 0)
[HideInInspector] _ShowMaterialReferences("_ShowMaterialReferences", Float) = 0
[HideInInspector] _ShowLayer0("_ShowLayer0", Float) = 0
[HideInInspector] _ShowLayer1("_ShowLayer1", Float) = 0
[HideInInspector] _ShowLayer2("_ShowLayer2", Float) = 0

1
ScriptableRenderPipeline/HDRenderPipeline/Material/LayeredLit/LayeredLitTessellation.shader


[ToggleOff] _TessellationTilingScale("Tessellation tiling scale", Float) = 1.0
// TODO: Handle culling mode for backface culling
[HideInInspector] _ShowMaterialReferences("_ShowMaterialReferences", Float) = 0
[HideInInspector] _ShowLayer0("_ShowLayer0", Float) = 0
[HideInInspector] _ShowLayer1("_ShowLayer1", Float) = 0
[HideInInspector] _ShowLayer2("_ShowLayer2", Float) = 0

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


#define ATTRIBUTES_NEED_TANGENT
#endif
#ifdef _VERTEX_WIND
#define ATTRIBUTES_NEED_COLOR
#endif
// About UV
// If we have a lit shader, only the UV0 is available for opacity or heightmap
// If we have a layered shader, any UV can be use for this. To reduce the number of variant we groupt UV0/UV1 and UV2/UV3 instead of having variant for UV0/UV1/UV2/UV3

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


#define ATTRIBUTES_NEED_TANGENT
#endif
#ifdef _VERTEX_WIND
#define ATTRIBUTES_NEED_COLOR
#endif
// About UV
// If we have a lit shader, only the UV0 is available for opacity or heightmap
// If we have a layered shader, any UV can be use for this. To reduce the number of variant we groupt UV0/UV1 and UV2/UV3 instead of having variant for UV0/UV1/UV2/UV3

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


#define ATTRIBUTES_NEED_TEXCOORD1
#define ATTRIBUTES_NEED_TEXCOORD2
#ifdef _VERTEX_WIND
#define ATTRIBUTES_NEED_COLOR
#endif
#if defined(LAYERED_LIT_SHADER) && (defined(_LAYER_MASK_VERTEX_COLOR_MUL) || defined(_LAYER_MASK_VERTEX_COLOR_ADD))
#define ATTRIBUTES_NEED_COLOR
#endif

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


#define ATTRIBUTES_NEED_TANGENT
#endif
#ifdef _VERTEX_WIND
#define ATTRIBUTES_NEED_COLOR
#endif
// About UV
// If we have a lit shader, only the UV0 is available for opacity or heightmap
// If we have a layered shader, any UV can be use for this. To reduce the number of variant we groupt UV0/UV1 and UV2/UV3 instead of having variant for UV0/UV1/UV2/UV3

32
ScriptableRenderPipeline/HDRenderPipeline/Material/MaterialUtilities.hlsl


float3 bakeDiffuseLighting = float3(0.0, 0.0, 0.0);
#ifdef UNITY_LIGHTMAP_FULL_HDR
bool useRGBMLightmap = false;
#else
bool useRGBMLightmap = true;
#endif
uvStaticLightmap, unity_LightmapST, normalWS, true);
uvStaticLightmap, unity_LightmapST, normalWS, useRGBMLightmap);
bakeDiffuseLighting += SampleSingleLightmap(TEXTURE2D_PARAM(unity_Lightmap, samplerunity_Lightmap), uvStaticLightmap, unity_LightmapST, true);
bakeDiffuseLighting += SampleSingleLightmap(TEXTURE2D_PARAM(unity_Lightmap, samplerunity_Lightmap), uvStaticLightmap, unity_LightmapST, useRGBMLightmap);
#endif
#endif

return bakeDiffuseLighting;
#endif
}
float4 SampleShadowMask(float3 positionWS, float2 uvStaticLightmap) // normalWS not use for now
{
#if defined(LIGHTMAP_ON)
float2 uv = uvStaticLightmap * unity_LightmapST.xy + unity_LightmapST.zw;
float4 rawOcclusionMask = SAMPLE_TEXTURE2D(unity_ShadowMask, samplerunity_Lightmap, uv); // Reuse sampler from Lightmap
#else
float4 rawOcclusionMask;
if (unity_ProbeVolumeParams.x == 1.0)
{
// TODO: We use GetAbsolutePositionWS(positionWS) to handle the camera relative case here but this should be part of the unity_ProbeVolumeWorldToObject matrix on C++ side (sadly we can't modify it for HDRenderPipeline...)
rawOcclusionMask = SampleProbeOcclusion(TEXTURE3D_PARAM(unity_ProbeVolumeSH, samplerunity_ProbeVolumeSH), GetAbsolutePositionWS(positionWS), unity_ProbeVolumeWorldToObject,
unity_ProbeVolumeParams.y, unity_ProbeVolumeParams.z, unity_ProbeVolumeMin, unity_ProbeVolumeSizeInv);
}
else
{
rawOcclusionMask = unity_ProbesOcclusion;
}
#endif
return rawOcclusionMask;
}
float2 CalculateVelocity(float4 positionCS, float4 previousPositionCS)

4
ScriptableRenderPipeline/HDRenderPipeline/ShaderPass/VertMesh.hlsl


vertexColor = input.color;
#endif
#if _VERTEX_WIND
#ifdef _VERTEX_WIND
ApplyWind(positionWS, normalWS, rootWP, _Stiffness, _Drag, _ShiverDrag, _ShiverDirectionality, _InitialBend, vertexColor.a, _Time);
ApplyWind(positionWS, normalWS, rootWP, _Stiffness, _Drag, _ShiverDrag, _ShiverDirectionality, _InitialBend, input.color.a, _Time);
#endif
positionWS = GetCameraRelativePositionWS(positionWS);

15
TestbedPipelines/Fptl/FptlLighting.cs


light.sliceIndex = m_CubeCookieTexArray.FetchSlice(cl.light.cookie);
}
bound.center = worldToView.MultiplyPoint(lightPos);
bound.boxAxisX.Set(range, 0, 0);
bound.boxAxisY.Set(0, range, 0);
bound.boxAxisZ.Set(0, 0, isNegDeterminant ? (-range) : range); // transform to camera space (becomes a left hand coordinate frame in Unity since Determinant(worldToView)<0)
bound.scaleXY.Set(1.0f, 1.0f);
bound.radius = range;
// represents a left hand coordinate system in world space since det(worldToView)<0
bound.center = worldToView.MultiplyPoint(lightPos);
bound.boxAxisX = vx * range;
bound.boxAxisY = vy * range;
bound.boxAxisZ = vz * range;
bound.scaleXY.Set(1.0f, 1.0f);
bound.radius = range;
// fill up ldata
light.lightType = (uint)LightDefinitions.SPHERE_LIGHT;

20
TestbedPipelines/Fptl/LightingConvexHullUtils.hlsl


vE0 = p1-p0;
}
void GetQuad(out float3 p0, out float3 p1, out float3 p2, out float3 p3, const float3 boxX, const float3 boxY, const float3 boxZ, const float3 center, const float2 scaleXY, const int sideIndex)
void GetHullQuad(out float3 p0, out float3 p1, out float3 p2, out float3 p3, const float3 boxX, const float3 boxY, const float3 boxZ, const float3 center, const float2 scaleXY, const int sideIndex)
{
//const int iAbsSide = (sideIndex == 0 || sideIndex == 1) ? 0 : ((sideIndex == 2 || sideIndex == 3) ? 1 : 2);
const int iAbsSide = min(sideIndex>>1, 2);

p3 = center + (vA2 + vB2 + vC);
}
void GetPlane(out float3 p0, out float3 vN, const float3 boxX, const float3 boxY, const float3 boxZ, const float3 center, const float2 scaleXY, const int sideIndex)
void GetHullPlane(out float3 p0, out float3 n0, const float3 boxX, const float3 boxY, const float3 boxZ, const float3 center, const float2 scaleXY, const int sideIndex)
{
//const int iAbsSide = (sideIndex == 0 || sideIndex == 1) ? 0 : ((sideIndex == 2 || sideIndex == 3) ? 1 : 2);
const int iAbsSide = min(sideIndex>>1, 2);

if (bIsSideQuad) { vA2 *= (iAbsSide == 0 ? scaleXY.x : scaleXY.y); vB2 *= (iAbsSide == 0 ? scaleXY.y : scaleXY.x); }
p0 = center + (vA + vB - vC); // center + vA is center of face when scaleXY is 1.0
float3 vNout = cross( vB2, 0.5*(vA-vA2) - vC );
#if USE_LEFTHAND_CAMERASPACE
vNout = -vNout;
#endif
vN = vNout;
float3 vN = cross(vB2, 0.5 * (vA - vA2) - vC); // +/- normal
float3 v0 = vA + vB - vC; // vector from center to p0
p0 = center + v0; // center + vA is center of face when scaleXY is 1.0
n0 = dot(vN,v0) < 0.0 ? (-vN) : vN;
float4 GetPlaneEq(const float3 boxX, const float3 boxY, const float3 boxZ, const float3 center, const float2 scaleXY, const int sideIndex)
float4 GetHullPlaneEq(const float3 boxX, const float3 boxY, const float3 boxZ, const float3 center, const float2 scaleXY, const int sideIndex)
GetPlane(p0, vN, boxX, boxY, boxZ, center, scaleXY, sideIndex);
GetHullPlane(p0, vN, boxX, boxY, boxZ, center, scaleXY, sideIndex);
return float4(vN, -dot(vN,p0));
}

2
TestbedPipelines/Fptl/lightlistbuild-clustered.compute


const float radius = lgtDat.radius;
const float2 scaleXY = lgtDat.scaleXY;
return GetPlaneEq(boxX, boxY, boxZ, center, scaleXY, p);
return GetHullPlaneEq(boxX, boxY, boxZ, center, scaleXY, p);
}

6
TestbedPipelines/Fptl/scrbound.compute


if(sideIndex<6 && lgtIndex<(int) g_iNrVisibLights) // mask 2 out of 8 threads
{
float3 q0, q1, q2, q3;
GetQuad(q0, q1, q2, q3, boxX, boxY, boxZ, center, scaleXY, sideIndex);
GetHullQuad(q0, q1, q2, q3, boxX, boxY, boxZ, center, scaleXY, sideIndex);
const float4 vP0 = mul(g_mProjection, float4(q0, 1));

for(f=0; f<6; f++)
{
float3 q0, q1, q2, q3;
GetQuad(q0, q1, q2, q3, boxX, boxY, boxZ, center, scaleXY, f);
GetHullQuad(q0, q1, q2, q3, boxX, boxY, boxZ, center, scaleXY, f);
// 4 vertices to a quad of the convex hull in post projection space
const float4 vP0 = mul(g_mProjection, float4(q0, 1));

for(f=0; f<6; f++)
{
float3 vP0, vN;
GetPlane(vP0, vN, boxX, boxY, boxZ, center, scaleXY, f);
GetHullPlane(vP0, vN, boxX, boxY, boxZ, center, scaleXY, f);
for(i=0; i<8; i++)
{

10
ImageTemplates/Editor.meta


fileFormatVersion: 2
guid: fcefc1814ee144b5d944354bbf589702
folderAsset: yes
timeCreated: 1505900294
licenseType: Pro
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

214
ScriptableRenderPipeline/HDRenderPipeline/HDStringConstants.cs


namespace UnityEngine.Experimental.Rendering.HDPipeline
{
static class HDShaderPassNames
{
// ShaderPass name
internal static readonly ShaderPassName s_EmptyName = new ShaderPassName("");
internal static readonly ShaderPassName m_ForwardName = new ShaderPassName("Forward");
internal static readonly ShaderPassName m_ForwardDisplayDebugName = new ShaderPassName("ForwardDisplayDebug");
internal static readonly ShaderPassName m_DepthOnlyName = new ShaderPassName("DepthOnly");
internal static readonly ShaderPassName m_ForwardOnlyOpaqueDepthOnlyName = new ShaderPassName("ForwardOnlyOpaqueDepthOnly");
internal static readonly ShaderPassName m_ForwardOnlyOpaqueName = new ShaderPassName("ForwardOnlyOpaque");
internal static readonly ShaderPassName m_ForwardOnlyOpaqueDisplayDebugName = new ShaderPassName("ForwardOnlyOpaqueDisplayDebug");
internal static readonly ShaderPassName m_GBufferName = new ShaderPassName("GBuffer");
internal static readonly ShaderPassName m_GBufferDebugDisplayName = new ShaderPassName("GBufferDebugDisplay");
internal static readonly ShaderPassName m_SRPDefaultUnlitName = new ShaderPassName("SRPDefaultUnlit");
internal static readonly ShaderPassName m_MotionVectorsName = new ShaderPassName("MotionVectors");
internal static readonly ShaderPassName m_DistortionVectorsName = new ShaderPassName("DistortionVectors");
// Legacy name
internal static readonly ShaderPassName m_AlwaysName = new ShaderPassName("Always");
internal static readonly ShaderPassName m_ForwardBaseName = new ShaderPassName("ForwardBase");
internal static readonly ShaderPassName m_DeferredName = new ShaderPassName("Deferred");
internal static readonly ShaderPassName m_PrepassBaseName = new ShaderPassName("PrepassBase");
internal static readonly ShaderPassName m_VertexName = new ShaderPassName("Vertex");
internal static readonly ShaderPassName m_VertexLMRGBMName = new ShaderPassName("VertexLMRGBM");
internal static readonly ShaderPassName m_VertexLMName = new ShaderPassName("VertexLM");
}
// Pre-hashed shader ids - naming conventions are a bit off in this file as we use the same
// fields names as in the shaders for ease of use... Would be nice to clean this up at some
// point.
static class HDShaderIDs
{
internal static readonly int _ShadowDatasExp = Shader.PropertyToID("_ShadowDatasExp");
internal static readonly int _ShadowPayloads = Shader.PropertyToID("_ShadowPayloads");
internal static readonly int _ShadowmapExp_VSM_0 = Shader.PropertyToID("_ShadowmapExp_VSM_0");
internal static readonly int _ShadowmapExp_VSM_1 = Shader.PropertyToID("_ShadowmapExp_VSM_1");
internal static readonly int _ShadowmapExp_VSM_2 = Shader.PropertyToID("_ShadowmapExp_VSM_2");
internal static readonly int _ShadowmapExp_PCF = Shader.PropertyToID("_ShadowmapExp_PCF");
internal static readonly int g_LayeredSingleIdxBuffer = Shader.PropertyToID("g_LayeredSingleIdxBuffer");
internal static readonly int _EnvLightIndexShift = Shader.PropertyToID("_EnvLightIndexShift");
internal static readonly int g_isOrthographic = Shader.PropertyToID("g_isOrthographic");
internal static readonly int g_iNrVisibLights = Shader.PropertyToID("g_iNrVisibLights");
internal static readonly int g_mScrProjection = Shader.PropertyToID("g_mScrProjection");
internal static readonly int g_mInvScrProjection = Shader.PropertyToID("g_mInvScrProjection");
internal static readonly int g_iLog2NumClusters = Shader.PropertyToID("g_iLog2NumClusters");
internal static readonly int g_fNearPlane = Shader.PropertyToID("g_fNearPlane");
internal static readonly int g_fFarPlane = Shader.PropertyToID("g_fFarPlane");
internal static readonly int g_fClustScale = Shader.PropertyToID("g_fClustScale");
internal static readonly int g_fClustBase = Shader.PropertyToID("g_fClustBase");
internal static readonly int g_depth_tex = Shader.PropertyToID("g_depth_tex");
internal static readonly int g_vLayeredLightList = Shader.PropertyToID("g_vLayeredLightList");
internal static readonly int g_LayeredOffset = Shader.PropertyToID("g_LayeredOffset");
internal static readonly int g_vBigTileLightList = Shader.PropertyToID("g_vBigTileLightList");
internal static readonly int g_logBaseBuffer = Shader.PropertyToID("g_logBaseBuffer");
internal static readonly int g_vBoundsBuffer = Shader.PropertyToID("g_vBoundsBuffer");
internal static readonly int _LightVolumeData = Shader.PropertyToID("_LightVolumeData");
internal static readonly int g_data = Shader.PropertyToID("g_data");
internal static readonly int g_mProjection = Shader.PropertyToID("g_mProjection");
internal static readonly int g_mInvProjection = Shader.PropertyToID("g_mInvProjection");
internal static readonly int g_viDimensions = Shader.PropertyToID("g_viDimensions");
internal static readonly int g_vLightList = Shader.PropertyToID("g_vLightList");
internal static readonly int g_BaseFeatureFlags = Shader.PropertyToID("g_BaseFeatureFlags");
internal static readonly int g_TileFeatureFlags = Shader.PropertyToID("g_TileFeatureFlags");
internal static readonly int _GBufferTexture0 = Shader.PropertyToID("_GBufferTexture0");
internal static readonly int _GBufferTexture1 = Shader.PropertyToID("_GBufferTexture1");
internal static readonly int _GBufferTexture2 = Shader.PropertyToID("_GBufferTexture2");
internal static readonly int _GBufferTexture3 = Shader.PropertyToID("_GBufferTexture3");
internal static readonly int g_DispatchIndirectBuffer = Shader.PropertyToID("g_DispatchIndirectBuffer");
internal static readonly int g_TileList = Shader.PropertyToID("g_TileList");
internal static readonly int g_NumTiles = Shader.PropertyToID("g_NumTiles");
internal static readonly int g_NumTilesX = Shader.PropertyToID("g_NumTilesX");
internal static readonly int _NumTiles = Shader.PropertyToID("_NumTiles");
internal static readonly int _CookieTextures = Shader.PropertyToID("_CookieTextures");
internal static readonly int _CookieCubeTextures = Shader.PropertyToID("_CookieCubeTextures");
internal static readonly int _EnvTextures = Shader.PropertyToID("_EnvTextures");
internal static readonly int _DirectionalLightDatas = Shader.PropertyToID("_DirectionalLightDatas");
internal static readonly int _DirectionalLightCount = Shader.PropertyToID("_DirectionalLightCount");
internal static readonly int _LightDatas = Shader.PropertyToID("_LightDatas");
internal static readonly int _PunctualLightCount = Shader.PropertyToID("_PunctualLightCount");
internal static readonly int _AreaLightCount = Shader.PropertyToID("_AreaLightCount");
internal static readonly int g_vLightListGlobal = Shader.PropertyToID("g_vLightListGlobal");
internal static readonly int _EnvLightDatas = Shader.PropertyToID("_EnvLightDatas");
internal static readonly int _EnvLightCount = Shader.PropertyToID("_EnvLightCount");
internal static readonly int _ShadowDatas = Shader.PropertyToID("_ShadowDatas");
internal static readonly int _DirShadowSplitSpheres = Shader.PropertyToID("_DirShadowSplitSpheres");
internal static readonly int _NumTileFtplX = Shader.PropertyToID("_NumTileFtplX");
internal static readonly int _NumTileFtplY = Shader.PropertyToID("_NumTileFtplY");
internal static readonly int _NumTileClusteredX = Shader.PropertyToID("_NumTileClusteredX");
internal static readonly int _NumTileClusteredY = Shader.PropertyToID("_NumTileClusteredY");
internal static readonly int g_isLogBaseBufferEnabled = Shader.PropertyToID("g_isLogBaseBufferEnabled");
internal static readonly int g_vLayeredOffsetsBuffer = Shader.PropertyToID("g_vLayeredOffsetsBuffer");
internal static readonly int _ViewTilesFlags = Shader.PropertyToID("_ViewTilesFlags");
internal static readonly int _MousePixelCoord = Shader.PropertyToID("_MousePixelCoord");
internal static readonly int _DebugViewMaterial = Shader.PropertyToID("_DebugViewMaterial");
internal static readonly int _DebugLightingMode = Shader.PropertyToID("_DebugLightingMode");
internal static readonly int _DebugLightingAlbedo = Shader.PropertyToID("_DebugLightingAlbedo");
internal static readonly int _DebugLightingSmoothness = Shader.PropertyToID("_DebugLightingSmoothness");
internal static readonly int _AmbientOcclusionTexture = Shader.PropertyToID("_AmbientOcclusionTexture");
internal static readonly int _UseTileLightList = Shader.PropertyToID("_UseTileLightList");
internal static readonly int _Time = Shader.PropertyToID("_Time");
internal static readonly int _SinTime = Shader.PropertyToID("_SinTime");
internal static readonly int _CosTime = Shader.PropertyToID("_CosTime");
internal static readonly int unity_DeltaTime = Shader.PropertyToID("unity_DeltaTime");
internal static readonly int _EnvLightSkyEnabled = Shader.PropertyToID("_EnvLightSkyEnabled");
internal static readonly int _AmbientOcclusionDirectLightStrenght = Shader.PropertyToID("_AmbientOcclusionDirectLightStrenght");
internal static readonly int _SkyTexture = Shader.PropertyToID("_SkyTexture");
internal static readonly int _UseDisneySSS = Shader.PropertyToID("_UseDisneySSS");
internal static readonly int _EnableSSSAndTransmission = Shader.PropertyToID("_EnableSSSAndTransmission");
internal static readonly int _TexturingModeFlags = Shader.PropertyToID("_TexturingModeFlags");
internal static readonly int _TransmissionFlags = Shader.PropertyToID("_TransmissionFlags");
internal static readonly int _ThicknessRemaps = Shader.PropertyToID("_ThicknessRemaps");
internal static readonly int _ShapeParams = Shader.PropertyToID("_ShapeParams");
internal static readonly int _HalfRcpVariancesAndWeights = Shader.PropertyToID("_HalfRcpVariancesAndWeights");
internal static readonly int _TransmissionTints = Shader.PropertyToID("_TransmissionTints");
internal static readonly int specularLightingUAV = Shader.PropertyToID("specularLightingUAV");
internal static readonly int diffuseLightingUAV = Shader.PropertyToID("diffuseLightingUAV");
internal static readonly int g_TileListOffset = Shader.PropertyToID("g_TileListOffset");
internal static readonly int _LtcData = Shader.PropertyToID("_LtcData");
internal static readonly int _PreIntegratedFGD = Shader.PropertyToID("_PreIntegratedFGD");
internal static readonly int _LtcGGXMatrix = Shader.PropertyToID("_LtcGGXMatrix");
internal static readonly int _LtcDisneyDiffuseMatrix = Shader.PropertyToID("_LtcDisneyDiffuseMatrix");
internal static readonly int _LtcMultiGGXFresnelDisneyDiffuse = Shader.PropertyToID("_LtcMultiGGXFresnelDisneyDiffuse");
internal static readonly int _MainDepthTexture = Shader.PropertyToID("_MainDepthTexture");
internal static readonly int _DeferredShadowTexture = Shader.PropertyToID("_DeferredShadowTexture");
internal static readonly int _DeferredShadowTextureUAV = Shader.PropertyToID("_DeferredShadowTextureUAV");
internal static readonly int _DirectionalShadowIndex = Shader.PropertyToID("_DirectionalShadowIndex");
internal static readonly int unity_OrthoParams = Shader.PropertyToID("unity_OrthoParams");
internal static readonly int _ZBufferParams = Shader.PropertyToID("_ZBufferParams");
internal static readonly int _ScreenParams = Shader.PropertyToID("_ScreenParams");
internal static readonly int _ProjectionParams = Shader.PropertyToID("_ProjectionParams");
internal static readonly int _WorldSpaceCameraPos = Shader.PropertyToID("_WorldSpaceCameraPos");
internal static readonly int _StencilRef = Shader.PropertyToID("_StencilRef");
internal static readonly int _StencilCmp = Shader.PropertyToID("_StencilCmp");
internal static readonly int _SrcBlend = Shader.PropertyToID("_SrcBlend");
internal static readonly int _DstBlend = Shader.PropertyToID("_DstBlend");
internal static readonly int _HTile = Shader.PropertyToID("_HTile");
internal static readonly int _StencilTexture = Shader.PropertyToID("_StencilTexture");
internal static readonly int _ViewMatrix = Shader.PropertyToID("_ViewMatrix");
internal static readonly int _InvViewMatrix = Shader.PropertyToID("_InvViewMatrix");
internal static readonly int _ProjMatrix = Shader.PropertyToID("_ProjMatrix");
internal static readonly int _InvProjMatrix = Shader.PropertyToID("_InvProjMatrix");
internal static readonly int _NonJitteredViewProjMatrix = Shader.PropertyToID("_NonJitteredViewProjMatrix");
internal static readonly int _ViewProjMatrix = Shader.PropertyToID("_ViewProjMatrix");
internal static readonly int _InvViewProjMatrix = Shader.PropertyToID("_InvViewProjMatrix");
internal static readonly int _InvProjParam = Shader.PropertyToID("_InvProjParam");
internal static readonly int _ScreenSize = Shader.PropertyToID("_ScreenSize");
internal static readonly int _PrevViewProjMatrix = Shader.PropertyToID("_PrevViewProjMatrix");
internal static readonly int _FrustumPlanes = Shader.PropertyToID("_FrustumPlanes");
internal static readonly int _DepthTexture = Shader.PropertyToID("_DepthTexture");
internal static readonly int _CameraColorTexture = Shader.PropertyToID("_CameraColorTexture");
internal static readonly int _CameraSssDiffuseLightingBuffer = Shader.PropertyToID("_CameraSssDiffuseLightingTexture");
internal static readonly int _CameraFilteringBuffer = Shader.PropertyToID("_CameraFilteringTexture");
internal static readonly int _IrradianceSource = Shader.PropertyToID("_IrradianceSource");
internal static readonly int _VelocityTexture = Shader.PropertyToID("_VelocityTexture");
internal static readonly int _DistortionTexture = Shader.PropertyToID("_DistortionTexture");
internal static readonly int _DebugFullScreenTexture = Shader.PropertyToID("_DebugFullScreenTexture");
internal static readonly int _WorldScales = Shader.PropertyToID("_WorldScales");
internal static readonly int _FilterKernels = Shader.PropertyToID("_FilterKernels");
internal static readonly int _FilterKernelsBasic = Shader.PropertyToID("_FilterKernelsBasic");
internal static readonly int _HalfRcpWeightedVariances = Shader.PropertyToID("_HalfRcpWeightedVariances");
internal static readonly int _CameraPosDiff = Shader.PropertyToID("_CameraPosDiff");
internal static readonly int _CameraDepthTexture = Shader.PropertyToID("_CameraDepthTexture");
internal static readonly int _CameraMotionVectorsTexture = Shader.PropertyToID("_CameraMotionVectorsTexture");
internal static readonly int _FullScreenDebugMode = Shader.PropertyToID("_FullScreenDebugMode");
internal static readonly int _InputCubemap = Shader.PropertyToID("_InputCubemap");
internal static readonly int _Mipmap = Shader.PropertyToID("_Mipmap");
internal static readonly int _MaxRadius = Shader.PropertyToID("_MaxRadius");
internal static readonly int _ShapeParam = Shader.PropertyToID("_ShapeParam");
internal static readonly int _StdDev1 = Shader.PropertyToID("_StdDev1");
internal static readonly int _StdDev2 = Shader.PropertyToID("_StdDev2");
internal static readonly int _LerpWeight = Shader.PropertyToID("_LerpWeight");
internal static readonly int _HalfRcpVarianceAndWeight1 = Shader.PropertyToID("_HalfRcpVarianceAndWeight1");
internal static readonly int _HalfRcpVarianceAndWeight2 = Shader.PropertyToID("_HalfRcpVarianceAndWeight2");
internal static readonly int _TransmissionTint = Shader.PropertyToID("_TransmissionTint");
internal static readonly int _ThicknessRemap = Shader.PropertyToID("_ThicknessRemap");
internal static readonly int _Cubemap = Shader.PropertyToID("_Cubemap");
internal static readonly int _SkyParam = Shader.PropertyToID("_SkyParam");
internal static readonly int _PixelCoordToViewDirWS = Shader.PropertyToID("_PixelCoordToViewDirWS");
internal static readonly int _GlobalFog_Extinction = Shader.PropertyToID("_GlobalFog_Extinction");
internal static readonly int _GlobalFog_Asymmetry = Shader.PropertyToID("_GlobalFog_Asymmetry");
internal static readonly int _GlobalFog_Scattering = Shader.PropertyToID("_GlobalFog_Scattering");
}
}

189
ScriptableRenderPipeline/HDRenderPipeline/HDShaderIDs.cs


namespace UnityEngine.Experimental.Rendering.HDPipeline
{
// Pre-hashed shader ids - naming conventions are a bit off in this file as we use the same
// fields names as in the shaders for ease of use... Would be nice to clean this up at some
// point.
static class HDShaderIDs
{
internal static readonly int _ShadowDatasExp = Shader.PropertyToID("_ShadowDatasExp");
internal static readonly int _ShadowPayloads = Shader.PropertyToID("_ShadowPayloads");
internal static readonly int _ShadowmapExp_VSM_0 = Shader.PropertyToID("_ShadowmapExp_VSM_0");
internal static readonly int _ShadowmapExp_VSM_1 = Shader.PropertyToID("_ShadowmapExp_VSM_1");
internal static readonly int _ShadowmapExp_VSM_2 = Shader.PropertyToID("_ShadowmapExp_VSM_2");
internal static readonly int _ShadowmapExp_PCF = Shader.PropertyToID("_ShadowmapExp_PCF");
internal static readonly int g_LayeredSingleIdxBuffer = Shader.PropertyToID("g_LayeredSingleIdxBuffer");
internal static readonly int _EnvLightIndexShift = Shader.PropertyToID("_EnvLightIndexShift");
internal static readonly int g_isOrthographic = Shader.PropertyToID("g_isOrthographic");
internal static readonly int g_iNrVisibLights = Shader.PropertyToID("g_iNrVisibLights");
internal static readonly int g_mScrProjection = Shader.PropertyToID("g_mScrProjection");
internal static readonly int g_mInvScrProjection = Shader.PropertyToID("g_mInvScrProjection");
internal static readonly int g_iLog2NumClusters = Shader.PropertyToID("g_iLog2NumClusters");
internal static readonly int g_fNearPlane = Shader.PropertyToID("g_fNearPlane");
internal static readonly int g_fFarPlane = Shader.PropertyToID("g_fFarPlane");
internal static readonly int g_fClustScale = Shader.PropertyToID("g_fClustScale");
internal static readonly int g_fClustBase = Shader.PropertyToID("g_fClustBase");
internal static readonly int g_depth_tex = Shader.PropertyToID("g_depth_tex");
internal static readonly int g_vLayeredLightList = Shader.PropertyToID("g_vLayeredLightList");
internal static readonly int g_LayeredOffset = Shader.PropertyToID("g_LayeredOffset");
internal static readonly int g_vBigTileLightList = Shader.PropertyToID("g_vBigTileLightList");
internal static readonly int g_logBaseBuffer = Shader.PropertyToID("g_logBaseBuffer");
internal static readonly int g_vBoundsBuffer = Shader.PropertyToID("g_vBoundsBuffer");
internal static readonly int _LightVolumeData = Shader.PropertyToID("_LightVolumeData");
internal static readonly int g_data = Shader.PropertyToID("g_data");
internal static readonly int g_mProjection = Shader.PropertyToID("g_mProjection");
internal static readonly int g_mInvProjection = Shader.PropertyToID("g_mInvProjection");
internal static readonly int g_viDimensions = Shader.PropertyToID("g_viDimensions");
internal static readonly int g_vLightList = Shader.PropertyToID("g_vLightList");
internal static readonly int g_BaseFeatureFlags = Shader.PropertyToID("g_BaseFeatureFlags");
internal static readonly int g_TileFeatureFlags = Shader.PropertyToID("g_TileFeatureFlags");
internal static readonly int _GBufferTexture0 = Shader.PropertyToID("_GBufferTexture0");
internal static readonly int _GBufferTexture1 = Shader.PropertyToID("_GBufferTexture1");
internal static readonly int _GBufferTexture2 = Shader.PropertyToID("_GBufferTexture2");
internal static readonly int _GBufferTexture3 = Shader.PropertyToID("_GBufferTexture3");
internal static readonly int g_DispatchIndirectBuffer = Shader.PropertyToID("g_DispatchIndirectBuffer");
internal static readonly int g_TileList = Shader.PropertyToID("g_TileList");
internal static readonly int g_NumTiles = Shader.PropertyToID("g_NumTiles");
internal static readonly int g_NumTilesX = Shader.PropertyToID("g_NumTilesX");
internal static readonly int _NumTiles = Shader.PropertyToID("_NumTiles");
internal static readonly int _CookieTextures = Shader.PropertyToID("_CookieTextures");
internal static readonly int _CookieCubeTextures = Shader.PropertyToID("_CookieCubeTextures");
internal static readonly int _EnvTextures = Shader.PropertyToID("_EnvTextures");
internal static readonly int _DirectionalLightDatas = Shader.PropertyToID("_DirectionalLightDatas");
internal static readonly int _DirectionalLightCount = Shader.PropertyToID("_DirectionalLightCount");
internal static readonly int _LightDatas = Shader.PropertyToID("_LightDatas");
internal static readonly int _PunctualLightCount = Shader.PropertyToID("_PunctualLightCount");
internal static readonly int _AreaLightCount = Shader.PropertyToID("_AreaLightCount");
internal static readonly int g_vLightListGlobal = Shader.PropertyToID("g_vLightListGlobal");
internal static readonly int _EnvLightDatas = Shader.PropertyToID("_EnvLightDatas");
internal static readonly int _EnvLightCount = Shader.PropertyToID("_EnvLightCount");
internal static readonly int _ShadowDatas = Shader.PropertyToID("_ShadowDatas");
internal static readonly int _DirShadowSplitSpheres = Shader.PropertyToID("_DirShadowSplitSpheres");
internal static readonly int _NumTileFtplX = Shader.PropertyToID("_NumTileFtplX");
internal static readonly int _NumTileFtplY = Shader.PropertyToID("_NumTileFtplY");
internal static readonly int _NumTileClusteredX = Shader.PropertyToID("_NumTileClusteredX");
internal static readonly int _NumTileClusteredY = Shader.PropertyToID("_NumTileClusteredY");
internal static readonly int g_isLogBaseBufferEnabled = Shader.PropertyToID("g_isLogBaseBufferEnabled");
internal static readonly int g_vLayeredOffsetsBuffer = Shader.PropertyToID("g_vLayeredOffsetsBuffer");
internal static readonly int _ViewTilesFlags = Shader.PropertyToID("_ViewTilesFlags");
internal static readonly int _MousePixelCoord = Shader.PropertyToID("_MousePixelCoord");
internal static readonly int _DebugViewMaterial = Shader.PropertyToID("_DebugViewMaterial");
internal static readonly int _DebugLightingMode = Shader.PropertyToID("_DebugLightingMode");
internal static readonly int _DebugLightingAlbedo = Shader.PropertyToID("_DebugLightingAlbedo");
internal static readonly int _DebugLightingSmoothness = Shader.PropertyToID("_DebugLightingSmoothness");
internal static readonly int _AmbientOcclusionTexture = Shader.PropertyToID("_AmbientOcclusionTexture");
internal static readonly int _UseTileLightList = Shader.PropertyToID("_UseTileLightList");
internal static readonly int _Time = Shader.PropertyToID("_Time");
internal static readonly int _SinTime = Shader.PropertyToID("_SinTime");
internal static readonly int _CosTime = Shader.PropertyToID("_CosTime");
internal static readonly int unity_DeltaTime = Shader.PropertyToID("unity_DeltaTime");
internal static readonly int _EnvLightSkyEnabled = Shader.PropertyToID("_EnvLightSkyEnabled");
internal static readonly int _AmbientOcclusionDirectLightStrenght = Shader.PropertyToID("_AmbientOcclusionDirectLightStrenght");
internal static readonly int _SkyTexture = Shader.PropertyToID("_SkyTexture");
internal static readonly int _UseDisneySSS = Shader.PropertyToID("_UseDisneySSS");
internal static readonly int _EnableSSSAndTransmission = Shader.PropertyToID("_EnableSSSAndTransmission");
internal static readonly int _TexturingModeFlags = Shader.PropertyToID("_TexturingModeFlags");
internal static readonly int _TransmissionFlags = Shader.PropertyToID("_TransmissionFlags");
internal static readonly int _ThicknessRemaps = Shader.PropertyToID("_ThicknessRemaps");
internal static readonly int _ShapeParams = Shader.PropertyToID("_ShapeParams");
internal static readonly int _HalfRcpVariancesAndWeights = Shader.PropertyToID("_HalfRcpVariancesAndWeights");
internal static readonly int _TransmissionTints = Shader.PropertyToID("_TransmissionTints");
internal static readonly int specularLightingUAV = Shader.PropertyToID("specularLightingUAV");
internal static readonly int diffuseLightingUAV = Shader.PropertyToID("diffuseLightingUAV");
internal static readonly int g_TileListOffset = Shader.PropertyToID("g_TileListOffset");
internal static readonly int _LtcData = Shader.PropertyToID("_LtcData");
internal static readonly int _PreIntegratedFGD = Shader.PropertyToID("_PreIntegratedFGD");
internal static readonly int _LtcGGXMatrix = Shader.PropertyToID("_LtcGGXMatrix");
internal static readonly int _LtcDisneyDiffuseMatrix = Shader.PropertyToID("_LtcDisneyDiffuseMatrix");
internal static readonly int _LtcMultiGGXFresnelDisneyDiffuse = Shader.PropertyToID("_LtcMultiGGXFresnelDisneyDiffuse");
internal static readonly int _MainDepthTexture = Shader.PropertyToID("_MainDepthTexture");
internal static readonly int _DeferredShadowTexture = Shader.PropertyToID("_DeferredShadowTexture");
internal static readonly int _DeferredShadowTextureUAV = Shader.PropertyToID("_DeferredShadowTextureUAV");
internal static readonly int _DirectionalShadowIndex = Shader.PropertyToID("_DirectionalShadowIndex");
internal static readonly int unity_OrthoParams = Shader.PropertyToID("unity_OrthoParams");
internal static readonly int _ZBufferParams = Shader.PropertyToID("_ZBufferParams");
internal static readonly int _ScreenParams = Shader.PropertyToID("_ScreenParams");
internal static readonly int _ProjectionParams = Shader.PropertyToID("_ProjectionParams");
internal static readonly int _WorldSpaceCameraPos = Shader.PropertyToID("_WorldSpaceCameraPos");
internal static readonly int _StencilRef = Shader.PropertyToID("_StencilRef");
internal static readonly int _StencilCmp = Shader.PropertyToID("_StencilCmp");
internal static readonly int _SrcBlend = Shader.PropertyToID("_SrcBlend");
internal static readonly int _DstBlend = Shader.PropertyToID("_DstBlend");
internal static readonly int _HTile = Shader.PropertyToID("_HTile");
internal static readonly int _StencilTexture = Shader.PropertyToID("_StencilTexture");
internal static readonly int _ViewMatrix = Shader.PropertyToID("_ViewMatrix");
internal static readonly int _InvViewMatrix = Shader.PropertyToID("_InvViewMatrix");
internal static readonly int _ProjMatrix = Shader.PropertyToID("_ProjMatrix");
internal static readonly int _InvProjMatrix = Shader.PropertyToID("_InvProjMatrix");
internal static readonly int _NonJitteredViewProjMatrix = Shader.PropertyToID("_NonJitteredViewProjMatrix");
internal static readonly int _ViewProjMatrix = Shader.PropertyToID("_ViewProjMatrix");
internal static readonly int _InvViewProjMatrix = Shader.PropertyToID("_InvViewProjMatrix");
internal static readonly int _InvProjParam = Shader.PropertyToID("_InvProjParam");
internal static readonly int _ScreenSize = Shader.PropertyToID("_ScreenSize");
internal static readonly int _PrevViewProjMatrix = Shader.PropertyToID("_PrevViewProjMatrix");
internal static readonly int _FrustumPlanes = Shader.PropertyToID("_FrustumPlanes");
internal static readonly int _DepthTexture = Shader.PropertyToID("_DepthTexture");
internal static readonly int _CameraColorTexture = Shader.PropertyToID("_CameraColorTexture");
internal static readonly int _CameraSssDiffuseLightingBuffer = Shader.PropertyToID("_CameraSssDiffuseLightingTexture");
internal static readonly int _CameraFilteringBuffer = Shader.PropertyToID("_CameraFilteringTexture");
internal static readonly int _IrradianceSource = Shader.PropertyToID("_IrradianceSource");
internal static readonly int _VelocityTexture = Shader.PropertyToID("_VelocityTexture");
internal static readonly int _DistortionTexture = Shader.PropertyToID("_DistortionTexture");
internal static readonly int _DebugFullScreenTexture = Shader.PropertyToID("_DebugFullScreenTexture");
internal static readonly int _WorldScales = Shader.PropertyToID("_WorldScales");
internal static readonly int _FilterKernels = Shader.PropertyToID("_FilterKernels");
internal static readonly int _FilterKernelsBasic = Shader.PropertyToID("_FilterKernelsBasic");
internal static readonly int _HalfRcpWeightedVariances = Shader.PropertyToID("_HalfRcpWeightedVariances");
internal static readonly int _CameraPosDiff = Shader.PropertyToID("_CameraPosDiff");
internal static readonly int _CameraDepthTexture = Shader.PropertyToID("_CameraDepthTexture");
internal static readonly int _CameraMotionVectorsTexture = Shader.PropertyToID("_CameraMotionVectorsTexture");
internal static readonly int _FullScreenDebugMode = Shader.PropertyToID("_FullScreenDebugMode");
internal static readonly int _InputCubemap = Shader.PropertyToID("_InputCubemap");
internal static readonly int _Mipmap = Shader.PropertyToID("_Mipmap");
internal static readonly int _MaxRadius = Shader.PropertyToID("_MaxRadius");
internal static readonly int _ShapeParam = Shader.PropertyToID("_ShapeParam");
internal static readonly int _StdDev1 = Shader.PropertyToID("_StdDev1");
internal static readonly int _StdDev2 = Shader.PropertyToID("_StdDev2");
internal static readonly int _LerpWeight = Shader.PropertyToID("_LerpWeight");
internal static readonly int _HalfRcpVarianceAndWeight1 = Shader.PropertyToID("_HalfRcpVarianceAndWeight1");
internal static readonly int _HalfRcpVarianceAndWeight2 = Shader.PropertyToID("_HalfRcpVarianceAndWeight2");
internal static readonly int _TransmissionTint = Shader.PropertyToID("_TransmissionTint");
internal static readonly int _ThicknessRemap = Shader.PropertyToID("_ThicknessRemap");
internal static readonly int _Cubemap = Shader.PropertyToID("_Cubemap");
internal static readonly int _SkyParam = Shader.PropertyToID("_SkyParam");
internal static readonly int _PixelCoordToViewDirWS = Shader.PropertyToID("_PixelCoordToViewDirWS");
internal static readonly int _GlobalFog_Extinction = Shader.PropertyToID("_GlobalFog_Extinction");
internal static readonly int _GlobalFog_Asymmetry = Shader.PropertyToID("_GlobalFog_Asymmetry");
internal static readonly int _GlobalFog_Scattering = Shader.PropertyToID("_GlobalFog_Scattering");
}
}

/ScriptableRenderPipeline/HDRenderPipeline/HDShaderIDs.cs.meta → /ScriptableRenderPipeline/HDRenderPipeline/HDStringConstants.cs.meta

/ImageTemplates/TemplatePreprocessor.cs → /ImageTemplates/Editor/TemplatePreprocessor.cs

/ImageTemplates/TemplatePreprocessor.cs.meta → /ImageTemplates/Editor/TemplatePreprocessor.cs.meta

正在加载...
取消
保存