Evgenii Golubev 8 年前
当前提交
a5c5f339
共有 73 个文件被更改,包括 1221 次插入653 次删除
  1. 2
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Editor/HDRenderPipelineMenuItems.cs
  2. 182
      Assets/ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipeline.cs
  3. 16
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/LayeredLit/Editor/LayeredLitUI.cs
  4. 18
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/LayeredLit/LayeredLit.shader
  5. 18
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/LayeredLit/LayeredLitTessellation.shader
  6. 18
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Editor/LitUI.cs
  7. 5
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.shader
  8. 306
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LitData.hlsl
  9. 146
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LitDataInternal.hlsl
  10. 3
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LitProperties.hlsl
  11. 1
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LitTessellation.hlsl
  12. 3
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LitTessellation.shader
  13. 1
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/ShaderPass/LitDepthPass.hlsl
  14. 1
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/ShaderPass/LitDistortionPass.hlsl
  15. 1
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/ShaderPass/LitVelocityPass.hlsl
  16. 34
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/MaterialUtilities.hlsl
  17. 8
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Unlit/Editor/BaseUnlitUI.cs
  18. 20
      Assets/ScriptableRenderPipeline/HDRenderPipeline/ShaderPass/FragInputs.hlsl
  19. 34
      Assets/ScriptableRenderPipeline/HDRenderPipeline/ShaderPass/VaryingMesh.hlsl
  20. 46
      Assets/ScriptableRenderPipeline/HDRenderPipeline/ShaderVariables.hlsl
  21. 2
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Sky/HDRISky/Resources/SkyHDRI.shader
  22. 1
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Sky/ProceduralSky/Resources/SkyProcedural.shader
  23. 8
      Assets/ScriptableRenderPipeline/ShaderLibrary/CommonLighting.hlsl
  24. 9
      Assets/ScriptableRenderPipeline/ShaderLibrary/CommonMaterial.hlsl
  25. 35
      Assets/TestScenes/HDTest/CascadedShadowsTest.unity
  26. 18
      Assets/TestScenes/HDTest/CascadedShadowsTest/Lit_Gray.mat
  27. 25
      Assets/TestScenes/HDTest/GlobalIlluminationTest/Material/Chrome.mat
  28. 6
      Assets/TestScenes/HDTest/GlobalIlluminationTest/Material/Lit_Green.mat
  29. 6
      Assets/TestScenes/HDTest/GlobalIlluminationTest/Material/Lit_Grey.mat
  30. 21
      Assets/TestScenes/HDTest/GlobalIlluminationTest/Material/Lit_Red.mat
  31. 13
      Assets/TestScenes/HDTest/LayeredLitTest/Material/Layered_BlendColor.mat
  32. 13
      Assets/TestScenes/HDTest/LayeredLitTest/Material/Layered_BlendMask.mat
  33. 16
      Assets/TestScenes/HDTest/LayeredLitTest/Material/Layered_HeightBased.mat
  34. 11
      Assets/TestScenes/HDTest/LayeredLitTest/Material/Layered_Layer0_Planar.mat
  35. 9
      Assets/TestScenes/HDTest/LayeredLitTest/Material/Layered_Layer0_Triplanar.mat
  36. 8
      Assets/TestScenes/HDTest/LayeredLitTest/Material/Layered_Layer0_UV0.mat
  37. 10
      Assets/TestScenes/HDTest/LayeredLitTest/Material/Layered_Layer1_Planar.mat
  38. 8
      Assets/TestScenes/HDTest/LayeredLitTest/Material/Layered_Layer1_Triplanar.mat
  39. 10
      Assets/TestScenes/HDTest/LayeredLitTest/Material/Layered_Layer1_UV0.mat
  40. 10
      Assets/TestScenes/HDTest/LayeredLitTest/Material/Layered_Layer1_UV1.mat
  41. 10
      Assets/TestScenes/HDTest/LayeredLitTest/Material/Layered_Layer1_UV2.mat
  42. 10
      Assets/TestScenes/HDTest/LayeredLitTest/Material/Layered_Layer1_UV3.mat
  43. 10
      Assets/TestScenes/HDTest/LayeredLitTest/Material/Layered_Layer2_Planar.mat
  44. 9
      Assets/TestScenes/HDTest/LayeredLitTest/Material/Layered_Layer2_Triplanar.mat
  45. 11
      Assets/TestScenes/HDTest/LayeredLitTest/Material/Layered_Layer2_UV0.mat
  46. 11
      Assets/TestScenes/HDTest/LayeredLitTest/Material/Layered_Layer2_UV1.mat
  47. 12
      Assets/TestScenes/HDTest/LayeredLitTest/Material/Layered_Layer2_UV2.mat
  48. 12
      Assets/TestScenes/HDTest/LayeredLitTest/Material/Layered_Layer2_UV3.mat
  49. 10
      Assets/TestScenes/HDTest/LayeredLitTest/Material/Layered_Layer3_Planar.mat
  50. 9
      Assets/TestScenes/HDTest/LayeredLitTest/Material/Layered_Layer3_Triplanar.mat
  51. 8
      Assets/TestScenes/HDTest/LayeredLitTest/Material/Layered_Layer3_UV0.mat
  52. 8
      Assets/TestScenes/HDTest/LayeredLitTest/Material/Layered_Layer3_UV1.mat
  53. 10
      Assets/TestScenes/HDTest/LayeredLitTest/Material/Layered_Layer3_UV2.mat
  54. 10
      Assets/TestScenes/HDTest/LayeredLitTest/Material/Layered_Layer3_UV3.mat
  55. 38
      Assets/TestScenes/HDTest/LayeredLitTest/Material/Lit_UVChart_Layer0_Detail.mat
  56. 37
      Assets/TestScenes/HDTest/LayeredLitTest/Material/Lit_UVChart_Layer1_Detail.mat
  57. 31
      Assets/TestScenes/HDTest/LayeredLitTest/Material/Lit_UVChart_Layer2_Detail.mat
  58. 37
      Assets/TestScenes/HDTest/LayeredLitTest/Material/Lit_UVChart_Layer3_Detail.mat
  59. 28
      Assets/TestScenes/HDTest/LayeredLitTest/Material/Lit_White_Detail.mat
  60. 6
      Assets/TestScenes/HDTest/Material/HDRenderLoopMaterials/Lit_Emissive_Blue.mat
  61. 12
      Assets/TestScenes/HDTest/Material/HDRenderLoopMaterials/test details.mat
  62. 2
      ProjectSettings/ProjectVersion.txt
  63. 88
      Assets/ScriptableRenderPipeline/ShaderLibrary/NormalSurfaceGradient.hlsl
  64. 9
      Assets/ScriptableRenderPipeline/ShaderLibrary/NormalSurfaceGradient.hlsl.meta
  65. 70
      Assets/ScriptableRenderPipeline/ShaderLibrary/SampleUVMapping.hlsl
  66. 57
      Assets/ScriptableRenderPipeline/ShaderLibrary/SampleUVMappingInternal.hlsl
  67. 55
      Assets/ScriptableRenderPipeline/ShaderLibrary/SampleUVMappingNormalInternal.hlsl
  68. 9
      Assets/ScriptableRenderPipeline/ShaderLibrary/SampleUVMappingNormalInternal.hlsl.meta
  69. 93
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/SampleLayerInternal.hlsl
  70. 51
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/SampleLayer.hlsl
  71. 9
      Assets/TestScenes/HDTest/LayeredLitTest/Mesh/Materials.meta
  72. 0
      /Assets/ScriptableRenderPipeline/ShaderLibrary/SampleUVMapping.hlsl.meta
  73. 0
      /Assets/ScriptableRenderPipeline/ShaderLibrary/SampleUVMappingInternal.hlsl.meta

2
Assets/ScriptableRenderPipeline/HDRenderPipeline/Editor/HDRenderPipelineMenuItems.cs


LayeredLitGUI.SynchronizeAllLayers(mat);
EditorUtility.SetDirty(mat);
}
}
}
static void RemoveMaterialKeywords(Material material)
{

182
Assets/ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipeline.cs


public Matrix4x4 viewProjectionMatrix;
public Matrix4x4 invViewProjectionMatrix;
public Matrix4x4 invProjectionMatrix;
}
public class GBufferManager
{
public const int MaxGbuffer = 8;
public void SetBufferDescription(int index, string stringId, RenderTextureFormat inFormat, RenderTextureReadWrite inSRGBWrite)
{
IDs[index] = Shader.PropertyToID(stringId);
RTIDs[index] = new RenderTargetIdentifier(IDs[index]);
formats[index] = inFormat;
sRGBWrites[index] = inSRGBWrite;
public class GBufferManager
public void InitGBuffers(int width, int height, CommandBuffer cmd)
public const int MaxGbuffer = 8;
public void SetBufferDescription(int index, string stringId, RenderTextureFormat inFormat, RenderTextureReadWrite inSRGBWrite)
for (int index = 0; index < gbufferCount; index++)
IDs[index] = Shader.PropertyToID(stringId);
RTIDs[index] = new RenderTargetIdentifier(IDs[index]);
formats[index] = inFormat;
sRGBWrites[index] = inSRGBWrite;
/* RTs[index] = */
cmd.GetTemporaryRT(IDs[index], width, height, 0, FilterMode.Point, formats[index], sRGBWrites[index]);
}
public void InitGBuffers(int width, int height, CommandBuffer cmd)
public RenderTargetIdentifier[] GetGBuffers()
{
var colorMRTs = new RenderTargetIdentifier[gbufferCount];
for (int index = 0; index < gbufferCount; index++)
for (int index = 0; index < gbufferCount; index++)
{
/* RTs[index] = */
cmd.GetTemporaryRT(IDs[index], width, height, 0, FilterMode.Point, formats[index], sRGBWrites[index]);
}
colorMRTs[index] = RTIDs[index];
public RenderTargetIdentifier[] GetGBuffers()
{
var colorMRTs = new RenderTargetIdentifier[gbufferCount];
for (int index = 0; index < gbufferCount; index++)
{
colorMRTs[index] = RTIDs[index];
}
return colorMRTs;
}
return colorMRTs;
}
/*
public void BindBuffers(Material mat)
/*
public void BindBuffers(Material mat)
{
for (int index = 0; index < gbufferCount; index++)
for (int index = 0; index < gbufferCount; index++)
{
mat.SetTexture(IDs[index], RTs[index]);
}
mat.SetTexture(IDs[index], RTs[index]);
*/
}
*/
public int gbufferCount { get; set; }
int[] IDs = new int[MaxGbuffer];
RenderTargetIdentifier[] RTIDs = new RenderTargetIdentifier[MaxGbuffer];
RenderTextureFormat[] formats = new RenderTextureFormat[MaxGbuffer];
RenderTextureReadWrite[] sRGBWrites = new RenderTextureReadWrite[MaxGbuffer];
}
public int gbufferCount { get; set; }
int[] IDs = new int[MaxGbuffer];
RenderTargetIdentifier[] RTIDs = new RenderTargetIdentifier[MaxGbuffer];
RenderTextureFormat[] formats = new RenderTextureFormat[MaxGbuffer];
RenderTextureReadWrite[] sRGBWrites = new RenderTextureReadWrite[MaxGbuffer];
}
{
{
private readonly HDRenderPipeline m_Owner;
// TODO: Find a way to automatically create/iterate through deferred material

}
else
{
using (new Utilities.ProfilingSample("Shadow Pass", renderContext))
{
m_ShadowPass.Render(renderContext, cullResults, out m_ShadowsResult);
}
using (new Utilities.ProfilingSample("Shadow Pass", renderContext))
{
m_ShadowPass.Render(renderContext, cullResults, out m_ShadowsResult);
}
renderContext.SetupCameraProperties(camera); // Need to recall SetupCameraProperties after m_ShadowPass.Render
renderContext.SetupCameraProperties(camera); // Need to recall SetupCameraProperties after m_ShadowPass.Render
if (m_LightLoop != null)
{
using (new Utilities.ProfilingSample("Build Light list", renderContext))
if (m_LightLoop != null)
m_LightLoop.PrepareLightsForGPU(m_Owner.shadowSettings, cullResults, camera, ref m_ShadowsResult);
m_LightLoop.RenderShadows(renderContext, cullResults);
renderContext.SetupCameraProperties(camera); // Need to recall SetupCameraProperties after m_ShadowPass.Render
m_LightLoop.BuildGPULightLists(camera, renderContext, m_CameraDepthStencilBufferRT); // TODO: Use async compute here to run light culling during shadow
using (new Utilities.ProfilingSample("Build Light list", renderContext))
{
m_LightLoop.PrepareLightsForGPU(m_Owner.shadowSettings, cullResults, camera, ref m_ShadowsResult);
m_LightLoop.RenderShadows(renderContext, cullResults);
renderContext.SetupCameraProperties(camera); // Need to recall SetupCameraProperties after m_ShadowPass.Render
m_LightLoop.BuildGPULightLists(camera, renderContext, m_CameraDepthStencilBufferRT); // TODO: Use async compute here to run light culling during shadow
}
}
PushGlobalParams(hdCamera, renderContext, m_Owner.sssParameters);
PushGlobalParams(hdCamera, renderContext, m_Owner.sssParameters);
// 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, renderContext);
// 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, renderContext);
RenderDeferredLighting(hdCamera, renderContext, m_Owner.sssParameters.enableSSS);
RenderDeferredLighting(hdCamera, renderContext, m_Owner.sssParameters.enableSSS);
// We compute subsurface scattering here. Therefore, no objects rendered afterwards will exhibit SSS.
// Currently, there is no efficient way to switch between SRT and MRT for the forward pass;
// therefore, forward-rendered objects do not output split lighting required for the SSS pass.
CombineSubsurfaceScattering(hdCamera, renderContext, m_Owner.sssParameters);
// We compute subsurface scattering here. Therefore, no objects rendered afterwards will exhibit SSS.
// Currently, there is no efficient way to switch between SRT and MRT for the forward pass;
// therefore, forward-rendered objects do not output split lighting required for the SSS pass.
CombineSubsurfaceScattering(hdCamera, renderContext, m_Owner.sssParameters);
// 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(cullResults, camera, renderContext, true); // Render deferred or forward opaque
RenderForwardOnlyOpaque(cullResults, camera, renderContext);
// 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(cullResults, camera, renderContext, true); // Render deferred or forward opaque
RenderForwardOnlyOpaque(cullResults, camera, renderContext);
// 'm_CameraDepthStencilBufferCopyRT' is a temporary copy of the depth textureand should be removed
// once we are able to read from the depth buffer during transparent pass.
using (new Utilities.ProfilingSample("Copy depth-stencil buffer after all opaque", renderContext))
{
var cmd = new CommandBuffer();
cmd.CopyTexture(m_CameraDepthStencilBufferRT, m_CameraDepthStencilBufferCopyRT);
renderContext.ExecuteCommandBuffer(cmd);
cmd.Dispose();
}
// 'm_CameraDepthStencilBufferCopyRT' is a temporary copy of the depth texture and should be removed
// once we are able to read from the depth buffer during transparent pass.
using (new Utilities.ProfilingSample("Copy depth-stencil buffer after all opaque", renderContext))
{
var cmd = new CommandBuffer();
cmd.CopyTexture(m_CameraDepthStencilBufferRT, m_CameraDepthStencilBufferCopyRT);
renderContext.ExecuteCommandBuffer(cmd);
cmd.Dispose();
}
RenderSky(hdCamera, renderContext);
RenderSky(hdCamera, renderContext);
// Render all type of transparent forward (unlit, lit, complex (hair...)) to keep the sorting between transparent objects.
RenderForward(cullResults, camera, renderContext, false);
// Render all type of transparent forward (unlit, lit, complex (hair...)) to keep the sorting between transparent objects.
RenderForward(cullResults, camera, renderContext, false);
RenderVelocity(cullResults, camera, renderContext); // Note we may have to render velocity earlier if we do temporalAO, temporal volumetric etc... Mean we will not take into account forward opaque in case of deferred rendering ?
// Planar and real time cubemap doesn't need post process and render in FP16
if (camera.cameraType == CameraType.Reflection)
{
// Simple blit
var cmd = new CommandBuffer { name = "Blit to final RT" };
cmd.Blit(m_CameraColorBufferRT, BuiltinRenderTextureType.CameraTarget);
renderContext.ExecuteCommandBuffer(cmd);
cmd.Dispose();
}
else
{
RenderVelocity(cullResults, camera, renderContext); // Note we may have to render velocity earlier if we do temporalAO, temporal volumetric etc... Mean we will not take into account forward opaque in case of deferred rendering ?
// 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. This
RenderDistortion(cullResults, camera, renderContext);
// 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. This
RenderDistortion(cullResults, camera, renderContext);
FinalPass(camera, renderContext);
FinalPass(camera, renderContext);
}
}
RenderDebugOverlay(camera, renderContext);

16
Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/LayeredLit/Editor/LayeredLitUI.cs


const string kObjectScaleAffectTile = "_ObjectScaleAffectTile";
MaterialProperty UVBlendMask = null;
const string kUVBlendMask = "_UVBlendMask";
MaterialProperty UVMappingPlanarBlendMask = null;
const string kUVMappingPlanarBlendMask = "_UVMappingPlanarBlendMask";
MaterialProperty layerTilingBlendMask = null;
const string kLayerTilingBlendMask = "_LayerTilingBlendMask";
MaterialProperty texWorldScaleBlendMask = null;

MaterialProperty[] layerTexWorldScale = new MaterialProperty[kMaxLayerCount];
MaterialProperty[] layerUVBase = new MaterialProperty[kMaxLayerCount];
MaterialProperty[] layerUVMappingMask = new MaterialProperty[kMaxLayerCount];
MaterialProperty[] layerUVMappingPlanar = new MaterialProperty[kMaxLayerCount];
MaterialProperty[] layerUVDetail = new MaterialProperty[kMaxLayerCount];
MaterialProperty[] layerUVDetailsMappingMask = new MaterialProperty[kMaxLayerCount];
// This one is specific to layer lit

vertexColorMode = FindProperty(kVertexColorMode, props);
objectScaleAffectTile = FindProperty(kObjectScaleAffectTile, props);
UVBlendMask = FindProperty(kUVBlendMask, props);
UVMappingPlanarBlendMask = FindProperty(kUVMappingPlanarBlendMask, props);
layerTilingBlendMask = FindProperty(kLayerTilingBlendMask, props);
texWorldScaleBlendMask = FindProperty(kTexWorldScaleBlendMask, props);

layerTexWorldScale[i] = FindProperty(string.Format("{0}{1}", kTexWorldScale, i), props);
layerUVBase[i] = FindProperty(string.Format("{0}{1}", kUVBase, i), props);
layerUVMappingMask[i] = FindProperty(string.Format("{0}{1}", kUVMappingMask, i), props);
layerUVMappingPlanar[i] = FindProperty(string.Format("{0}{1}", kUVMappingPlanar, i), props);
layerUVDetail[i] = FindProperty(string.Format("{0}{1}", kUVDetail, i), props);
layerUVDetailsMappingMask[i] = FindProperty(string.Format("{0}{1}", kUVDetailsMappingMask, i), props);
layerTiling[i] = FindProperty(string.Format("{0}{1}", kLayerTiling, i), props);

// put the name in the exclusionList below
static void SynchronizeLayerProperties(Material material, Material[] layers, int layerIndex)
{
string[] exclusionList = { kTexWorldScale, kUVBase, kUVMappingMask, kUVMappingPlanar, kUVDetail, kUVDetailsMappingMask };
string[] exclusionList = { kTexWorldScale, kUVBase, kUVMappingMask, kUVDetail, kUVDetailsMappingMask };
Material layerMaterial = layers[layerIndex];

}
}
UVMappingPlanarBlendMask.floatValue = ((LayerUVBaseMapping)UVBlendMask.floatValue == LayerUVBaseMapping.Planar) ? 1.0f : 0.0f;
// We setup the masking map based on the enum for each layer.
// using mapping mask allow to reduce the number of generated combination for a very small increase in ALU
LayerUVBaseMapping layerUVBaseMapping = (LayerUVBaseMapping)layerUVBase[layerIndex].floatValue;

Z = (layerUVBaseMapping == LayerUVBaseMapping.UV2) ? 1.0f : 0.0f;
W = (layerUVBaseMapping == LayerUVBaseMapping.UV3) ? 1.0f : 0.0f;
layerUVMappingMask[layerIndex].colorValue = (layerIndex == 0) ? new Color(1.0f, 0.0f, 0.0f, 0.0f) : new Color(X, Y, Z, W); // Special case for Main Layer and Blend Mask, only UV0. As Layer0 is share by both here, need to force X to 1.0 in all case
layerUVMappingPlanar[layerIndex].floatValue = (layerUVBaseMapping == LayerUVBaseMapping.Planar) ? 1.0f : 0.0f; // Planar have priority on UV0
UVDetailMapping layerUVDetailMapping = (UVDetailMapping)layerUVDetail[layerIndex].floatValue;
X = (layerUVDetailMapping == UVDetailMapping.UV0) ? 1.0f : 0.0f;

SetKeyword(material, "_LAYER_TILING_UNIFORM_SCALE", material.GetFloat(kObjectScaleAffectTile) > 0.0f);
// Blend mask
LayerUVBaseMapping UVBlendMaskMapping = (LayerUVBaseMapping)material.GetFloat(kUVBlendMask);
LayerUVBaseMapping UVBlendMaskMapping = (LayerUVBaseMapping)material.GetFloat(kUVBlendMask);
SetKeyword(material, "_LAYER_MAPPING_PLANAR_BLENDMASK", UVBlendMaskMapping == LayerUVBaseMapping.Planar);
SetKeyword(material, "_LAYER_MAPPING_TRIPLANAR_BLENDMASK", UVBlendMaskMapping == LayerUVBaseMapping.Triplanar);
int numLayer = (int)material.GetFloat(kLayerCount);

SetKeyword(material, "_LAYEREDLIT_3_LAYERS", false);
}
const string kLayerMappingPlanar = "_LAYER_MAPPING_PLANAR";
const string kLayerMappingTriplanar = "_LAYER_MAPPING_TRIPLANAR";
// We have to check for each layer if the UV2 or UV3 is needed.

{
string layerUVBaseParam = string.Format("{0}{1}", kUVBase, i);
LayerUVBaseMapping layerUVBaseMapping = (LayerUVBaseMapping)material.GetFloat(layerUVBaseParam);
string currentLayerMappingPlanar = string.Format("{0}{1}", kLayerMappingPlanar, i);
SetKeyword(material, currentLayerMappingPlanar, layerUVBaseMapping == LayerUVBaseMapping.Planar);
string currentLayerMappingTriplanar = string.Format("{0}{1}", kLayerMappingTriplanar, i);
SetKeyword(material, currentLayerMappingTriplanar, layerUVBaseMapping == LayerUVBaseMapping.Triplanar);

18
Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/LayeredLit/LayeredLit.shader


[ToggleOff] _ObjectScaleAffectTile("_ObjectScaleAffectTile", Float) = 0.0
[Enum(UV0, 0, Planar, 4, Triplanar, 5)] _UVBlendMask("UV Set for blendMask", Float) = 0
[HideInInspector] _UVMappingPlanarBlendMask("_UVMappingPlanarBlendMask", Float) = 0.0
_TexWorldScaleBlendMask("Tiling", Float) = 1.0
// Following are builtin properties

[HideInInspector] _UVMappingMask0("_UVMappingMask0", Color) = (1, 0, 0, 0)
[HideInInspector] _UVMappingMask1("_UVMappingMask1", Color) = (1, 0, 0, 0)
[HideInInspector] _UVMappingMask2("_UVMappingMask2", Color) = (1, 0, 0, 0)
[HideInInspector] _UVMappingMask3("_UVMappingMask3", Color) = (1, 0, 0, 0)
[HideInInspector] _UVMappingPlanar0("_UVMappingPlanar0", Float) = 0.0
[HideInInspector] _UVMappingPlanar1("_UVMappingPlanar1", Float) = 0.0
[HideInInspector] _UVMappingPlanar2("_UVMappingPlanar2", Float) = 0.0
[HideInInspector] _UVMappingPlanar3("_UVMappingPlanar3", Float) = 0.0
[HideInInspector] _UVMappingMask3("_UVMappingMask3", Color) = (1, 0, 0, 0)
[Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3)] _UVDetail0("UV Set for detail0", Float) = 0
[Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3)] _UVDetail1("UV Set for detail1", Float) = 0

#pragma shader_feature _PER_PIXEL_DISPLACEMENT
#pragma shader_feature _LAYER_TILING_UNIFORM_SCALE
#pragma shader_feature _LAYER_MAPPING_TRIPLANAR_BLENDMASK
#pragma shader_feature _LAYER_MAPPING_TRIPLANAR0
#pragma shader_feature _LAYER_MAPPING_TRIPLANAR1
#pragma shader_feature _LAYER_MAPPING_TRIPLANAR2
#pragma shader_feature _LAYER_MAPPING_TRIPLANAR3
#pragma shader_feature _ _LAYER_MAPPING_PLANAR_BLENDMASK _LAYER_MAPPING_TRIPLANAR_BLENDMASK
#pragma shader_feature _ _LAYER_MAPPING_PLANAR0 _LAYER_MAPPING_TRIPLANAR0
#pragma shader_feature _ _LAYER_MAPPING_PLANAR1 _LAYER_MAPPING_TRIPLANAR1
#pragma shader_feature _ _LAYER_MAPPING_PLANAR2 _LAYER_MAPPING_TRIPLANAR2
#pragma shader_feature _ _LAYER_MAPPING_PLANAR3 _LAYER_MAPPING_TRIPLANAR3
#pragma shader_feature _NORMALMAP_TANGENT_SPACE0
#pragma shader_feature _NORMALMAP_TANGENT_SPACE1
#pragma shader_feature _NORMALMAP_TANGENT_SPACE2

18
Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/LayeredLit/LayeredLitTessellation.shader


[ToggleOff] _ObjectScaleAffectTile("_ObjectScaleAffectTile", Float) = 0.0
[Enum(UV0, 0, Planar, 4, Triplanar, 5)] _UVBlendMask("UV Set for blendMask", Float) = 0
[HideInInspector] _UVMappingPlanarBlendMask("_UVMappingPlanarBlendMask", Float) = 0.0
_TexWorldScaleBlendMask("Tiling", Float) = 1.0
// Following are builtin properties

[HideInInspector] _UVMappingMask0("_UVMappingMask0", Color) = (1, 0, 0, 0)
[HideInInspector] _UVMappingMask1("_UVMappingMask1", Color) = (1, 0, 0, 0)
[HideInInspector] _UVMappingMask2("_UVMappingMask2", Color) = (1, 0, 0, 0)
[HideInInspector] _UVMappingMask3("_UVMappingMask3", Color) = (1, 0, 0, 0)
[HideInInspector] _UVMappingPlanar0("_UVMappingPlanar0", Float) = 0.0
[HideInInspector] _UVMappingPlanar1("_UVMappingPlanar1", Float) = 0.0
[HideInInspector] _UVMappingPlanar2("_UVMappingPlanar2", Float) = 0.0
[HideInInspector] _UVMappingPlanar3("_UVMappingPlanar3", Float) = 0.0
[HideInInspector] _UVMappingMask3("_UVMappingMask3", Color) = (1, 0, 0, 0)
[Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3)] _UVDetail0("UV Set for detail0", Float) = 0
[Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3)] _UVDetail1("UV Set for detail1", Float) = 0

#pragma shader_feature _TESSELLATION_OBJECT_SCALE
#pragma shader_feature _LAYER_TILING_UNIFORM_SCALE
#pragma shader_feature _LAYER_MAPPING_TRIPLANAR_BLENDMASK
#pragma shader_feature _LAYER_MAPPING_TRIPLANAR0
#pragma shader_feature _LAYER_MAPPING_TRIPLANAR1
#pragma shader_feature _LAYER_MAPPING_TRIPLANAR2
#pragma shader_feature _LAYER_MAPPING_TRIPLANAR3
#pragma shader_feature _ _LAYER_MAPPING_PLANAR_BLENDMASK _LAYER_MAPPING_TRIPLANAR_BLENDMASK
#pragma shader_feature _ _LAYER_MAPPING_PLANAR0 _LAYER_MAPPING_TRIPLANAR0
#pragma shader_feature _ _LAYER_MAPPING_PLANAR1 _LAYER_MAPPING_TRIPLANAR1
#pragma shader_feature _ _LAYER_MAPPING_PLANAR2 _LAYER_MAPPING_TRIPLANAR2
#pragma shader_feature _ _LAYER_MAPPING_PLANAR3 _LAYER_MAPPING_TRIPLANAR3
#pragma shader_feature _NORMALMAP_TANGENT_SPACE0
#pragma shader_feature _NORMALMAP_TANGENT_SPACE1
#pragma shader_feature _NORMALMAP_TANGENT_SPACE2

18
Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Editor/LitUI.cs


public static GUIContent emissiveText = new GUIContent("Emissive Color", "Emissive");
public static GUIContent emissiveIntensityText = new GUIContent("Emissive Intensity", "Emissive");
public static GUIContent emissiveColorModeText = new GUIContent("Emissive Color Usage", "Use emissive color or emissive mask");
public static GUIContent normalMapSpaceWarning = new GUIContent("Object space normal can't be use with triplanar mapping.");
}
public enum UVBaseMapping

protected const string kTexWorldScale = "_TexWorldScale";
protected MaterialProperty UVMappingMask = null;
protected const string kUVMappingMask = "_UVMappingMask";
protected MaterialProperty UVMappingPlanar = null;
protected const string kUVMappingPlanar = "_UVMappingPlanar";
protected MaterialProperty baseColor = null;
protected const string kBaseColor = "_BaseColor";

UVBase = FindProperty(kUVBase, props);
TexWorldScale = FindProperty(kTexWorldScale, props);
UVMappingMask = FindProperty(kUVMappingMask, props);
UVMappingPlanar = FindProperty(kUVMappingPlanar, props);
baseColor = FindProperty(kBaseColor, props);
baseColorMap = FindProperty(kBaseColorMap, props);

m_MaterialEditor.ShaderProperty(horizonFade, Styles.horizonFadeText);
m_MaterialEditor.ShaderProperty(normalMapSpace, Styles.normalMapSpaceText);
// Triplanar only work with tangent space normal
if ((NormalMapSpace)normalMapSpace.floatValue == NormalMapSpace.ObjectSpace && ((UVBaseMapping)UVBase.floatValue == UVBaseMapping.Triplanar))
{
EditorGUILayout.HelpBox(Styles.normalMapSpaceWarning.text, MessageType.Error);
}
m_MaterialEditor.TexturePropertySingleLine(Styles.normalMapText, normalMap, normalScale);
m_MaterialEditor.TexturePropertySingleLine(Styles.heightMapText, heightMap);

GUILayout.Label(" " + Styles.textureControlText, EditorStyles.label);
m_MaterialEditor.ShaderProperty(UVBase, Styles.UVBaseMappingText);
// UVSet0 is always set, planar and triplanar will override it.
UVMappingMask.colorValue = new Color(1.0f, 0.0f, 0.0f, 0.0f); // This is override in the shader anyway but just in case.
UVMappingPlanar.floatValue = ((UVBaseMapping)UVBase.floatValue == UVBaseMapping.Planar) ? 1.0f : 0.0f;
UVMappingMask.colorValue = new Color(1.0f, 0.0f, 0.0f, 0.0f); // This is override in the shader anyway but just in case.
if (((UVBaseMapping)UVBase.floatValue == UVBaseMapping.Planar) || ((UVBaseMapping)UVBase.floatValue == UVBaseMapping.Triplanar))
{
m_MaterialEditor.ShaderProperty(TexWorldScale, Styles.texWorldScaleText);

GUILayout.Label(" " + Styles.UVDetailMappingText.text + ": Triplanar");
}
// IF planar/triplanar is not chose, setup the UVSet chosen
// Setup the UVSet for detail, if planar/triplanar is use for base, it will override the mapping of detail (See shader code)
float X, Y, Z, W;
X = ((UVDetailMapping)UVDetail.floatValue == UVDetailMapping.UV0) ? 1.0f : 0.0f;
Y = ((UVDetailMapping)UVDetail.floatValue == UVDetailMapping.UV1) ? 1.0f : 0.0f;

// Note: keywords must be based on Material value not on MaterialProperty due to multi-edit & material animation
// (MaterialProperty value might come from renderer material property block)
SetKeyword(material, "_MAPPING_PLANAR", ((UVBaseMapping)material.GetFloat(kUVBase)) == UVBaseMapping.Planar);
SetKeyword(material, "_MAPPING_TRIPLANAR", ((UVBaseMapping)material.GetFloat(kUVBase)) == UVBaseMapping.Triplanar);
SetKeyword(material, "_NORMALMAP_TANGENT_SPACE", ((NormalMapSpace)material.GetFloat(kNormalMapSpace)) == NormalMapSpace.TangentSpace);
SetKeyword(material, "_EMISSIVE_COLOR", ((EmissiveColorMode)material.GetFloat(kEmissiveColorMode)) == EmissiveColorMode.UseEmissiveColor);

5
Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.shader


[Enum(UV0, 0, Planar, 1, TriPlanar, 2)] _UVBase("UV Set for base", Float) = 0
_TexWorldScale("Scale to apply on world coordinate", Float) = 1.0
[HideInInspector] _UVMappingMask("_UVMappingMask", Color) = (1, 0, 0, 0)
[HideInInspector] _UVMappingPlanar("_UVMappingPlanar", Float) = 0
[Enum(TangentSpace, 0, ObjectSpace, 1)] _NormalMapSpace("NormalMap space", Float) = 0
[Enum(Standard, 0, Subsurface Scattering, 1, Clear Coat, 2, Specular Color, 3)] _MaterialID("MaterialId", Int) = 0

#pragma target 4.5
#pragma only_renderers d3d11 ps4 metal // TEMP: until we go futher in dev
// #pragma enable_d3d11_debug_symbols
//#pragma enable_d3d11_debug_symbols
//-------------------------------------------------------------------------------------
// Variant

#pragma shader_feature _DOUBLESIDED_ON
#pragma shader_feature _PER_PIXEL_DISPLACEMENT
#pragma shader_feature _MAPPING_TRIPLANAR
#pragma shader_feature _ _MAPPING_PLANAR _MAPPING_TRIPLANAR
#pragma shader_feature _NORMALMAP_TANGENT_SPACE
#pragma shader_feature _ _REQUIRE_UV2 _REQUIRE_UV3
#pragma shader_feature _EMISSIVE_COLOR

306
Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LitData.hlsl


//-------------------------------------------------------------------------------------
// Fill SurfaceData/Builtin data function
//-------------------------------------------------------------------------------------
#include "ShaderLibrary/SampleUVMapping.hlsl"
#include "../SampleLayer.hlsl"
void GetBuiltinData(FragInputs input, SurfaceData surfaceData, float alpha, float depthOffset, out BuiltinData builtinData)
{

builtinData.depthOffset = depthOffset;
}
// Struct that gather UVMapping info of all layers + common calculation
// This is use to abstract the mapping that can differ on layers
LayerUV base;
LayerUV details;
UVMapping base;
UVMapping details;
LayerUV base0;
LayerUV base1;
LayerUV base2;
LayerUV base3;
UVMapping base0;
UVMapping base1;
UVMapping base2;
UVMapping base3;
LayerUV details0;
LayerUV details1;
LayerUV details2;
LayerUV details3;
UVMapping details0;
UVMapping details1;
UVMapping details2;
UVMapping details3;
LayerUV blendMask;
UVMapping blendMask;
// triplanar weight
float3 triplanarWeights;
// Store information that will be share by all UVMapping
float3 vertexNormalWS; // TODO: store also object normal map for object triplanar
float3 triplanarWeights;
#ifdef SURFACE_GRADIENT
// tangent basis for each UVSet - up to 4 for now
float3 vertexTangentWS0, vertexBitangentWS0;
float3 vertexTangentWS1, vertexBitangentWS1;
float3 vertexTangentWS2, vertexBitangentWS2;
float3 vertexTangentWS3, vertexBitangentWS3;
#endif
#ifdef SURFACE_GRADIENT
void GenerateLayerTexCoordBasisTB(FragInputs input, inout LayerTexCoord layerTexCoord)
{
float3 vertexNormalWS = input.worldToTangent[2];
layerTexCoord.vertexTangentWS0 = input.worldToTangent[0];
layerTexCoord.vertexBitangentWS0 = input.worldToTangent[1];
// TODO: We should use relative camera position here - This will be automatic when we will move to camera relative space.
float3 dPdx = ddx_fine(input.positionWS);
float3 dPdy = ddy_fine(input.positionWS);
float3 sigmaX = dPdx - dot(dPdx, vertexNormalWS) * vertexNormalWS;
float3 sigmaY = dPdy - dot(dPdy, vertexNormalWS) * vertexNormalWS;
//float flipSign = dot(sigmaY, cross(nrmVertexNormal, sigmaX) ) ? -1.0 : 1.0;
float flipSign = dot(dPdy, cross(vertexNormalWS, dPdx)) < 0.0 ? -1.0 : 1.0; // gives same as the commented out line above
// TODO: Optimize! The compiler will not be able to remove the tangent space that are not use because it can't know due to our UVMapping constant we use for both base and details
// To solve this we should track which UVSet is use for normal mapping... Maybe not as simple as it sounds
SurfaceGradientGenBasisTB(vertexNormalWS, sigmaX, sigmaY, flipSign, input.texCoord1, layerTexCoord.vertexTangentWS1, layerTexCoord.vertexBitangentWS1);
#if defined(_REQUIRE_UV2) || defined(_REQUIRE_UV3)
SurfaceGradientGenBasisTB(vertexNormalWS, sigmaX, sigmaY, flipSign, input.texCoord2, layerTexCoord.vertexTangentWS2, layerTexCoord.vertexBitangentWS2);
#endif
#if defined(_REQUIRE_UV3)
SurfaceGradientGenBasisTB(vertexNormalWS, sigmaX, sigmaY, flipSign, input.texCoord3, layerTexCoord.vertexTangentWS3, layerTexCoord.vertexBitangentWS3);
#endif
}
#endif
#ifndef LAYERED_LIT_SHADER
#define SAMPLER_NORMALMAP_IDX sampler_NormalMap

#endif
#include "LitDataInternal.hlsl"
// This maybe call directly by tessellation (domain) shader, thus all part regarding surface gradient must be done
// in function with FragInputs input as parameters
// layerTexCoord must have been initialize to 0 outside of this function
float3 positionWS, float3 normalWS, out LayerTexCoord layerTexCoord)
float3 positionWS, float3 vertexNormalWS, inout LayerTexCoord layerTexCoord)
ZERO_INITIALIZE(LayerTexCoord, layerTexCoord);
layerTexCoord.vertexNormalWS = vertexNormalWS;
layerTexCoord.triplanarWeights = ComputeTriplanarWeights(vertexNormalWS);
bool isTriplanar = false;
#ifdef _MAPPING_TRIPLANAR
// one weight for each direction XYZ - Use vertex normal for triplanar
layerTexCoord.triplanarWeights = ComputeTriplanarWeights(normalWS);
isTriplanar = true;
int mappingType = UV_MAPPING_UVSET;
#if defined(_MAPPING_PLANAR)
mappingType = UV_MAPPING_PLANAR;
#elif defined(_MAPPING_TRIPLANAR)
mappingType = UV_MAPPING_TRIPLANAR;
// Be sure that the compiler is aware that we don't touch UV1 to UV3 for main layer so it can optimize code
// Also we have always UVset to 1, if planar/triplanar is enable, it will override it.
// Be sure that the compiler is aware that we don't use UV1 to UV3 for main layer so it can optimize code
positionWS, normalWS, _UVMappingPlanar > 0.0, isTriplanar, _TexWorldScale, layerTexCoord);
positionWS, mappingType, _TexWorldScale, layerTexCoord);
}
// This is call only in this file
// layerTexCoord must have been initialize to 0 outside of this function
void GetLayerTexCoord(FragInputs input, inout LayerTexCoord layerTexCoord)
{
#ifdef SURFACE_GRADIENT
GenerateLayerTexCoordBasisTB(input, layerTexCoord);
#endif
GetLayerTexCoord( input.texCoord0, input.texCoord1, input.texCoord2, input.texCoord3,
input.positionWS, input.worldToTangent[2].xyz, layerTexCoord);
}
float GetMaxDisplacement()

float2 minUvSize = float2(FLT_MAX, FLT_MAX);
#if defined(_HEIGHTMAP)
if (layerTexCoord.base.isTriplanar)
if (layerTexCoord.base.mappingType == UV_MAPPING_TRIPLANAR)
{
minUvSize = min(layerTexCoord.base.uvZY * _HeightMap_TexelSize.zw, minUvSize);
minUvSize = min(layerTexCoord.base.uvXZ * _HeightMap_TexelSize.zw, minUvSize);

#if defined(_PER_PIXEL_DISPLACEMENT) && defined(_HEIGHTMAP)
ppdEnable = true;
isPlanar = layerTexCoord.base.isPlanar;
isTriplanar = layerTexCoord.base.isTriplanar;
isPlanar = layerTexCoord.base.mappingType == UV_MAPPING_PLANAR;
isTriplanar = layerTexCoord.base.mappingType == UV_MAPPING_TRIPLANAR;
#endif
if (ppdEnable)

{
ppdParam.uv = layerTexCoord.base.uv;
#ifdef SURFACE_GRADIENT
// The TBN is not normalize, normalize it to do per pixel displacement
float3x3 worldToTangent = input.worldToTangent;
worldToTangent[1] = normalize(worldToTangent[1]);
worldToTangent[2] = normalize(worldToTangent[2]);
#else
float3x3 worldToTangent = input.worldToTangent;
#endif
float3 viewDirTS = isPlanar ? float3(-V.xz, V.y) : TransformWorldToTangent(V, input.tangentToWorld);
float3 viewDirTS = isPlanar ? float3(-V.xz, V.y) : TransformWorldToTangent(V, worldToTangent);
int numSteps = (int)lerp(_PPDMaxSamples, _PPDMinSamples, viewDirTS.z);
float2 offset = ParallaxOcclusionMapping(lod, _PPDLodThreshold, numSteps, viewDirTS, maxHeight, ppdParam);

// Calculate displacement for per vertex displacement mapping
float ComputePerVertexDisplacement(LayerTexCoord layerTexCoord, float4 vertexColor, float lod)
{
return (SAMPLE_LAYER_TEXTURE2D_LOD(_HeightMap, sampler_HeightMap, layerTexCoord.base, lod).r - _HeightCenter) * _HeightAmplitude;
return (SAMPLE_UVMAPPING_TEXTURE2D_LOD(_HeightMap, sampler_HeightMap, layerTexCoord.base, lod).r - _HeightCenter) * _HeightAmplitude;
ApplyDoubleSidedFlipOrMirror(input); // Apply double sided flip on the vertex normal
GetLayerTexCoord(input.texCoord0, input.texCoord1, input.texCoord2, input.texCoord3,
input.positionWS, input.tangentToWorld[2].xyz, layerTexCoord);
ZERO_INITIALIZE(LayerTexCoord, layerTexCoord);
GetLayerTexCoord(input, layerTexCoord);
ApplyPerPixelDisplacement(input, V, layerTexCoord);

float alpha = GetSurfaceData(input, layerTexCoord, surfaceData, normalTS);
GetNormalAndTangentWS(input, V, normalTS, surfaceData.normalWS, surfaceData.tangentWS);
// Done one time for all layered - cumulate with spec occ alpha for now
surfaceData.specularOcclusion *= GetHorizonOcclusion(V, surfaceData.normalWS, input.tangentToWorld[2].xyz, _HorizonFade);
surfaceData.specularOcclusion *= GetHorizonOcclusion(V, surfaceData.normalWS, input.worldToTangent[2].xyz, _HorizonFade);
// Caution: surfaceData must be fully initialize before calling GetBuiltinData
GetBuiltinData(input, surfaceData, alpha, depthOffset, builtinData);

#define PROP_BLEND_SCALAR(name, mask) BlendLayeredScalar(name##0, name##1, name##2, name##3, mask);
void GetLayerTexCoord(float2 texCoord0, float2 texCoord1, float2 texCoord2, float2 texCoord3,
float3 positionWS, float3 normalWS, out LayerTexCoord layerTexCoord)
float3 positionWS, float3 vertexNormalWS, inout LayerTexCoord layerTexCoord)
ZERO_INITIALIZE(LayerTexCoord, layerTexCoord);
layerTexCoord.vertexNormalWS = vertexNormalWS;
layerTexCoord.triplanarWeights = ComputeTriplanarWeights(vertexNormalWS);
#if defined(_LAYER_MAPPING_TRIPLANAR_BLENDMASK) || defined(_LAYER_MAPPING_TRIPLANAR0) || defined(_LAYER_MAPPING_TRIPLANAR1) || defined(_LAYER_MAPPING_TRIPLANAR2) || defined(_LAYER_MAPPING_TRIPLANAR3)
// one weight for each direction XYZ - Use vertex normal for triplanar
layerTexCoord.triplanarWeights = ComputeTriplanarWeights(normalWS);
int mappingType = UV_MAPPING_UVSET;
#if defined(_LAYER_MAPPING_PLANAR_BLENDMASK)
mappingType = UV_MAPPING_PLANAR;
#elif defined(_LAYER_MAPPING_TRIPLANAR_BLENDMASK)
mappingType = UV_MAPPING_TRIPLANAR;
bool isTriplanar = false;
#ifdef _LAYER_MAPPING_TRIPLANAR_BLENDMASK
isTriplanar = true;
#endif
// Be sure that the compiler is aware that we don't use UV1 to UV3 for main layer and blend mask so it can optimize code
// Note: Blend mask have its dedicated mapping and tiling. And as Main layer it only use UV0
_UVMappingMask0 = float4(1.0, 0.0, 0.0, 0.0);
// Be sure that the compiler is aware that we don't touch UV1 to UV3 for main layer so it can optimize code
_UVMappingMask0.yzw = float3(0.0, 0.0, 0.0);
// Note: Blend mask have its dedicated mapping adn tiling. And as Main layer it only use UV0
// To share code, we simply call the regular code from the main layer for it save the result, then do regular call for all layers.
// To share code, we simply call the regular code from the main layer for it then save the result, then do regular call for all layers.
positionWS, normalWS, _UVMappingPlanarBlendMask > 0.0, isTriplanar, _TexWorldScaleBlendMask, layerTexCoord, _LayerTilingBlendMask);
positionWS, mappingType, _TexWorldScaleBlendMask, layerTexCoord, _LayerTilingBlendMask);
layerTexCoord.blendMask = layerTexCoord.base0;

tileObjectScale = length(float3(worldTransform._m00, worldTransform._m01, worldTransform._m02));
#endif
isTriplanar = false;
#ifdef _LAYER_MAPPING_TRIPLANAR0
isTriplanar = true;
mappingType = UV_MAPPING_UVSET;
#if defined(_LAYER_MAPPING_PLANAR0)
mappingType = UV_MAPPING_PLANAR;
#elif defined(_LAYER_MAPPING_TRIPLANAR0)
mappingType = UV_MAPPING_TRIPLANAR;
positionWS, normalWS, _UVMappingPlanar0 > 0.0, isTriplanar, _TexWorldScale0, layerTexCoord, _LayerTiling0
positionWS, mappingType, _TexWorldScale0, layerTexCoord, _LayerTiling0
isTriplanar = false;
#ifdef _LAYER_MAPPING_TRIPLANAR1
isTriplanar = true;
mappingType = UV_MAPPING_UVSET;
#if defined(_LAYER_MAPPING_PLANAR1)
mappingType = UV_MAPPING_PLANAR;
#elif defined(_LAYER_MAPPING_TRIPLANAR1)
mappingType = UV_MAPPING_TRIPLANAR;
positionWS, normalWS, _UVMappingPlanar1 > 0.0, isTriplanar, _TexWorldScale1, layerTexCoord, _LayerTiling1 * tileObjectScale);
positionWS, mappingType, _TexWorldScale1, layerTexCoord, _LayerTiling1 * tileObjectScale);
isTriplanar = false;
#ifdef _LAYER_MAPPING_TRIPLANAR2
isTriplanar = true;
mappingType = UV_MAPPING_UVSET;
#if defined(_LAYER_MAPPING_PLANAR2)
mappingType = UV_MAPPING_PLANAR;
#elif defined(_LAYER_MAPPING_TRIPLANAR2)
mappingType = UV_MAPPING_TRIPLANAR;
positionWS, normalWS, _UVMappingPlanar2 > 0.0, isTriplanar, _TexWorldScale2, layerTexCoord, _LayerTiling2 * tileObjectScale);
positionWS, mappingType, _TexWorldScale2, layerTexCoord, _LayerTiling2 * tileObjectScale);
isTriplanar = false;
#ifdef _LAYER_MAPPING_TRIPLANAR3
isTriplanar = true;
mappingType = UV_MAPPING_UVSET;
#if defined(_LAYER_MAPPING_PLANAR3)
mappingType = UV_MAPPING_PLANAR;
#elif defined(_LAYER_MAPPING_TRIPLANAR3)
mappingType = UV_MAPPING_TRIPLANAR;
positionWS, normalWS, _UVMappingPlanar3 > 0.0, isTriplanar, _TexWorldScale3, layerTexCoord, _LayerTiling3 * tileObjectScale);
positionWS, mappingType, _TexWorldScale3, layerTexCoord, _LayerTiling3 * tileObjectScale);
}
// This is call only in this file
// layerTexCoord must have been initialize to 0 outside of this function
void GetLayerTexCoord(FragInputs input, inout LayerTexCoord layerTexCoord)
{
#ifdef SURFACE_GRADIENT
GenerateLayerTexCoordBasisTB(input, layerTexCoord);
#endif
GetLayerTexCoord( input.texCoord0, input.texCoord1, input.texCoord2, input.texCoord3,
input.positionWS, input.worldToTangent[2].xyz, layerTexCoord);
}
// This function is just syntaxic sugar to nullify height not used based on heightmap avaibility and layer

// Blend mask are Main Layer A - Layer 1 R - Layer 2 G - Layer 3 B
// Value for main layer is not use for blending itself but for alternate weighting like density.
// Settings this specific Main layer blend mask in alpha allow to be transparent in case we don't use it and 1 is provide by default.
float4 blendMasks = useLodSampling ? SAMPLE_LAYER_TEXTURE2D_LOD(_LayerMaskMap, sampler_LayerMaskMap, layerTexCoord.blendMask, lod) : SAMPLE_LAYER_TEXTURE2D(_LayerMaskMap, sampler_LayerMaskMap, layerTexCoord.blendMask);
float4 blendMasks = useLodSampling ? SAMPLE_UVMAPPING_TEXTURE2D_LOD(_LayerMaskMap, sampler_LayerMaskMap, layerTexCoord.blendMask, lod) : SAMPLE_UVMAPPING_TEXTURE2D(_LayerMaskMap, sampler_LayerMaskMap, layerTexCoord.blendMask);
#if defined(_LAYER_MASK_VERTEX_COLOR_MUL)
blendMasks *= vertexColor;

float2 minUvSize = float2(FLT_MAX, FLT_MAX);
#if defined(_HEIGHTMAP0)
if (layerTexCoord.base0.isTriplanar)
if (layerTexCoord.base0.mappingType == UV_MAPPING_TRIPLANAR)
{
minUvSize = min(layerTexCoord.base0.uvZY * _HeightMap0_TexelSize.zw, minUvSize);
minUvSize = min(layerTexCoord.base0.uvXZ * _HeightMap0_TexelSize.zw, minUvSize);

#endif
#if defined(_HEIGHTMAP1)
if (layerTexCoord.base1.isTriplanar)
if (layerTexCoord.base1.mappingType == UV_MAPPING_TRIPLANAR)
{
minUvSize = min(layerTexCoord.base1.uvZY * _HeightMap1_TexelSize.zw, minUvSize);
minUvSize = min(layerTexCoord.base1.uvXZ * _HeightMap1_TexelSize.zw, minUvSize);

#if _LAYER_COUNT >= 3
#if defined(_HEIGHTMAP2)
if (layerTexCoord.base2.isTriplanar)
if (layerTexCoord.base2.mappingType == UV_MAPPING_TRIPLANAR)
{
minUvSize = min(layerTexCoord.base2.uvZY * _HeightMap2_TexelSize.zw, minUvSize);
minUvSize = min(layerTexCoord.base2.uvXZ * _HeightMap2_TexelSize.zw, minUvSize);

#if _LAYER_COUNT >= 4
#if defined(_HEIGHTMAP3)
if (layerTexCoord.base3.isTriplanar)
if (layerTexCoord.base3.mappingType == UV_MAPPING_TRIPLANAR)
{
minUvSize = min(layerTexCoord.base3.uvZY * _HeightMap3_TexelSize.zw, minUvSize);
minUvSize = min(layerTexCoord.base3.uvXZ * _HeightMap3_TexelSize.zw, minUvSize);

// To know if we are planar or triplanar just need to check if any of the active heightmap layer is true as they are enforce to be the same mapping
#if defined(_HEIGHTMAP0)
ppdEnable = true;
isPlanar = layerTexCoord.base0.isPlanar;
isTriplanar = layerTexCoord.base0.isTriplanar;
isPlanar = layerTexCoord.base0.mappingType == UV_MAPPING_PLANAR;
isTriplanar = layerTexCoord.base0.mappingType == UV_MAPPING_TRIPLANAR;
isPlanar = layerTexCoord.base1.isPlanar;
isTriplanar = layerTexCoord.base1.isTriplanar;
isPlanar = layerTexCoord.base1.mappingType == UV_MAPPING_PLANAR;
isTriplanar = layerTexCoord.base1.mappingType == UV_MAPPING_TRIPLANAR;
isPlanar = layerTexCoord.base2.isPlanar;
isTriplanar = layerTexCoord.base2.isTriplanar;
isPlanar = layerTexCoord.base2.mappingType == UV_MAPPING_PLANAR;
isTriplanar = layerTexCoord.base2.mappingType == UV_MAPPING_TRIPLANAR;
#endif
#endif

isPlanar = layerTexCoord.base3.isPlanar;
isTriplanar = layerTexCoord.base3.isTriplanar;
isPlanar = layerTexCoord.base3.mappingType == UV_MAPPING_PLANAR;
isTriplanar = layerTexCoord.base3.mappingType == UV_MAPPING_TRIPLANAR;
#endif
#endif

ppdParam.uv[2] = layerTexCoord.base2.uv;
ppdParam.uv[3] = layerTexCoord.base3.uv;
#ifdef SURFACE_GRADIENT
// The TBN is not normalize, normalize it to do per pixel displacement
float3x3 worldToTangent = input.worldToTangent;
worldToTangent[1] = normalize(worldToTangent[1]);
worldToTangent[2] = normalize(worldToTangent[2]);
#else
float3x3 worldToTangent = input.worldToTangent;
#endif
float3 viewDirTS = isPlanar ? float3(-V.xz, V.y) : TransformWorldToTangent(V, input.tangentToWorld);
float3 viewDirTS = isPlanar ? float3(-V.xz, V.y) : TransformWorldToTangent(V, worldToTangent);
// Apply offset to all planar uvset
// _UVMappingPlanar0 will be 1.0 is planar is used - _UVMappingMask0.x will be 1.0 is UVSet0 is used;
float4 offsetWeights = isPlanar ? float4(_UVMappingPlanar0, _UVMappingPlanar1, _UVMappingPlanar2, _UVMappingPlanar3) : float4(_UVMappingMask0.x, _UVMappingMask1.x, _UVMappingMask2.x, _UVMappingMask3.x);
// Apply offset to all planar UV if applicable
float4 planarWeight = float4( layerTexCoord.base0.mappingType == UV_MAPPING_PLANAR ? 1.0 : 0.0,
layerTexCoord.base1.mappingType == UV_MAPPING_PLANAR ? 1.0 : 0.0,
layerTexCoord.base2.mappingType == UV_MAPPING_PLANAR ? 1.0 : 0.0,
layerTexCoord.base3.mappingType == UV_MAPPING_PLANAR ? 1.0 : 0.0);
// _UVMappingMask0.x will be 1.0 is UVSet0 is used;
float4 offsetWeights = isPlanar ? planarWeight : float4(_UVMappingMask0.x, _UVMappingMask1.x, _UVMappingMask2.x, _UVMappingMask3.x);
layerTexCoord.base0.uv += offsetWeights.x * offset;
layerTexCoord.base1.uv += offsetWeights.y * offset;

offsetWeights = isPlanar ? float4(_UVMappingPlanar0, _UVMappingPlanar1, _UVMappingPlanar2, _UVMappingPlanar3) : float4(_UVDetailsMappingMask0.x, _UVDetailsMappingMask1.x, _UVDetailsMappingMask2.x, _UVDetailsMappingMask3.x);
offsetWeights = isPlanar ? planarWeight : float4(_UVDetailsMappingMask0.x, _UVDetailsMappingMask1.x, _UVDetailsMappingMask2.x, _UVDetailsMappingMask3.x);
layerTexCoord.details0.uv += offsetWeights.x * offset;
layerTexCoord.details1.uv += offsetWeights.y * offset;

ComputeMaskWeights(blendMasks, weights);
#if defined(_HEIGHTMAP0) || defined(_HEIGHTMAP1) || defined(_HEIGHTMAP2) || defined(_HEIGHTMAP3)
float height0 = (SAMPLE_LAYER_TEXTURE2D_LOD(_HeightMap0, SAMPLER_HEIGHTMAP_IDX, layerTexCoord.base0, lod).r - _LayerCenterOffset0) * _LayerHeightAmplitude0;
float height1 = (SAMPLE_LAYER_TEXTURE2D_LOD(_HeightMap1, SAMPLER_HEIGHTMAP_IDX, layerTexCoord.base1, lod).r - _LayerCenterOffset1) * _LayerHeightAmplitude1;
float height2 = (SAMPLE_LAYER_TEXTURE2D_LOD(_HeightMap2, SAMPLER_HEIGHTMAP_IDX, layerTexCoord.base2, lod).r - _LayerCenterOffset2) * _LayerHeightAmplitude2;
float height3 = (SAMPLE_LAYER_TEXTURE2D_LOD(_HeightMap3, SAMPLER_HEIGHTMAP_IDX, layerTexCoord.base3, lod).r - _LayerCenterOffset3) * _LayerHeightAmplitude3;
float height0 = (SAMPLE_UVMAPPING_TEXTURE2D_LOD(_HeightMap0, SAMPLER_HEIGHTMAP_IDX, layerTexCoord.base0, lod).r - _LayerCenterOffset0) * _LayerHeightAmplitude0;
float height1 = (SAMPLE_UVMAPPING_TEXTURE2D_LOD(_HeightMap1, SAMPLER_HEIGHTMAP_IDX, layerTexCoord.base1, lod).r - _LayerCenterOffset1) * _LayerHeightAmplitude1;
float height2 = (SAMPLE_UVMAPPING_TEXTURE2D_LOD(_HeightMap2, SAMPLER_HEIGHTMAP_IDX, layerTexCoord.base2, lod).r - _LayerCenterOffset2) * _LayerHeightAmplitude2;
float height3 = (SAMPLE_UVMAPPING_TEXTURE2D_LOD(_HeightMap3, SAMPLER_HEIGHTMAP_IDX, layerTexCoord.base3, lod).r - _LayerCenterOffset3) * _LayerHeightAmplitude3;
SetEnabledHeightByLayer(height0, height1, height2, height3);
float heightResult = BlendLayeredScalar(height0, height1, height2, height3, weights);

#if defined(_HEIGHT_BASED_BLEND)
#if defined(_HEIGHTMAP0) || defined(_HEIGHTMAP1) || defined(_HEIGHTMAP2) || defined(_HEIGHTMAP3)
float height0 = (SAMPLE_LAYER_TEXTURE2D(_HeightMap0, SAMPLER_HEIGHTMAP_IDX, layerTexCoord.base0).r - _LayerCenterOffset0) * _LayerHeightAmplitude0;
float height1 = (SAMPLE_LAYER_TEXTURE2D(_HeightMap1, SAMPLER_HEIGHTMAP_IDX, layerTexCoord.base1).r - _LayerCenterOffset1) * _LayerHeightAmplitude1;
float height2 = (SAMPLE_LAYER_TEXTURE2D(_HeightMap2, SAMPLER_HEIGHTMAP_IDX, layerTexCoord.base2).r - _LayerCenterOffset2) * _LayerHeightAmplitude2;
float height3 = (SAMPLE_LAYER_TEXTURE2D(_HeightMap3, SAMPLER_HEIGHTMAP_IDX, layerTexCoord.base3).r - _LayerCenterOffset3) * _LayerHeightAmplitude3;
float height0 = (SAMPLE_UVMAPPING_TEXTURE2D(_HeightMap0, SAMPLER_HEIGHTMAP_IDX, layerTexCoord.base0).r - _LayerCenterOffset0) * _LayerHeightAmplitude0;
float height1 = (SAMPLE_UVMAPPING_TEXTURE2D(_HeightMap1, SAMPLER_HEIGHTMAP_IDX, layerTexCoord.base1).r - _LayerCenterOffset1) * _LayerHeightAmplitude1;
float height2 = (SAMPLE_UVMAPPING_TEXTURE2D(_HeightMap2, SAMPLER_HEIGHTMAP_IDX, layerTexCoord.base2).r - _LayerCenterOffset2) * _LayerHeightAmplitude2;
float height3 = (SAMPLE_UVMAPPING_TEXTURE2D(_HeightMap3, SAMPLER_HEIGHTMAP_IDX, layerTexCoord.base3).r - _LayerCenterOffset3) * _LayerHeightAmplitude3;
SetEnabledHeightByLayer(height0, height1, height2, height3);
float4 heights = float4(height0, height1, height2, height3);

float3 mainNormalTS = GetNormalTS0(input, layerTexCoord, float3(0.0, 0.0, 1.0), 0.0, true, maxMipBias * (1.0 - influenceFactor));
// Add on our regular normal a bit of Main Layer normal base on influence factor. Note that this affect only the "visible" normal.
#ifdef SURFACE_GRADIENT
return normalTS + influenceFactor * mainNormalTS;
#else
#endif
}
float3 ComputeMainBaseColorInfluence(float3 baseColor0, float3 baseColor1, float3 baseColor2, float3 baseColor3, float compoMask, LayerTexCoord layerTexCoord, float weights[_MAX_LAYER])

// We want to calculate the mean color of the texture. For this we will sample a low mipmap
float textureBias = 15.0; // Use maximum bias
float3 baseMeanColor0 = SAMPLE_LAYER_TEXTURE2D_BIAS(_BaseColorMap0, sampler_BaseColorMap0, layerTexCoord.base0, textureBias).rgb *_BaseColor0.rgb;
float3 baseMeanColor1 = SAMPLE_LAYER_TEXTURE2D_BIAS(_BaseColorMap1, sampler_BaseColorMap0, layerTexCoord.base1, textureBias).rgb *_BaseColor1.rgb;
float3 baseMeanColor2 = SAMPLE_LAYER_TEXTURE2D_BIAS(_BaseColorMap2, sampler_BaseColorMap0, layerTexCoord.base2, textureBias).rgb *_BaseColor2.rgb;
float3 baseMeanColor3 = SAMPLE_LAYER_TEXTURE2D_BIAS(_BaseColorMap3, sampler_BaseColorMap0, layerTexCoord.base3, textureBias).rgb *_BaseColor3.rgb;
float3 baseMeanColor0 = SAMPLE_UVMAPPING_TEXTURE2D_BIAS(_BaseColorMap0, sampler_BaseColorMap0, layerTexCoord.base0, textureBias).rgb *_BaseColor0.rgb;
float3 baseMeanColor1 = SAMPLE_UVMAPPING_TEXTURE2D_BIAS(_BaseColorMap1, sampler_BaseColorMap0, layerTexCoord.base1, textureBias).rgb *_BaseColor1.rgb;
float3 baseMeanColor2 = SAMPLE_UVMAPPING_TEXTURE2D_BIAS(_BaseColorMap2, sampler_BaseColorMap0, layerTexCoord.base2, textureBias).rgb *_BaseColor2.rgb;
float3 baseMeanColor3 = SAMPLE_UVMAPPING_TEXTURE2D_BIAS(_BaseColorMap3, sampler_BaseColorMap0, layerTexCoord.base3, textureBias).rgb *_BaseColor3.rgb;
float3 meanColor = BlendLayeredVector3(baseMeanColor0, baseMeanColor1, baseMeanColor2, baseMeanColor3, weights);

void GetSurfaceAndBuiltinData(FragInputs input, float3 V, inout PositionInputs posInput, out SurfaceData surfaceData, out BuiltinData builtinData)
{
ApplyDoubleSidedFlipOrMirror(input); // Apply double sided flip on the vertex normal
GetLayerTexCoord(input.texCoord0, input.texCoord1, input.texCoord2, input.texCoord3,
input.positionWS, input.tangentToWorld[2].xyz, layerTexCoord);
ZERO_INITIALIZE(LayerTexCoord, layerTexCoord);
GetLayerTexCoord(input, layerTexCoord);
ApplyPerPixelDisplacement(input, V, layerTexCoord);

surfaceData.perceptualSmoothness = SURFACEDATA_BLEND_SCALAR(surfaceData, perceptualSmoothness, weights);
surfaceData.ambientOcclusion = SURFACEDATA_BLEND_SCALAR(surfaceData, ambientOcclusion, weights);
surfaceData.metallic = SURFACEDATA_BLEND_SCALAR(surfaceData, metallic, weights);
// Init other unused parameter
surfaceData.tangentWS = input.tangentToWorld[0].xyz;
#ifdef SURFACE_GRADIENT
surfaceData.tangentWS = normalize(input.worldToTangent[0].xyz); // The tangent is not normalize in worldToTangent when using surface gradient
#else
surfaceData.tangentWS = input.worldToTangent[0].xyz;
#endif
// Init other parameters
surfaceData.materialId = 0;
surfaceData.anisotropy = 0;
surfaceData.specular = 0.04;

GetNormalAndTangentWS(input, V, normalTS, surfaceData.normalWS, surfaceData.tangentWS);
// Done one time for all layered - cumulate with spec occ alpha for now
surfaceData.specularOcclusion = SURFACEDATA_BLEND_SCALAR(surfaceData, specularOcclusion, weights);
surfaceData.specularOcclusion *= GetHorizonOcclusion(V, surfaceData.normalWS, input.tangentToWorld[2].xyz, _HorizonFade);
surfaceData.specularOcclusion *= GetHorizonOcclusion(V, surfaceData.normalWS, input.worldToTangent[2].xyz, _HorizonFade);
GetBuiltinData(input, surfaceData, alpha, depthOffset, builtinData);
}

146
Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LitDataInternal.hlsl


void ADD_IDX(ComputeLayerTexCoord)( float2 texCoord0, float2 texCoord1, float2 texCoord2, float2 texCoord3,
float3 positionWS, float3 vertexNormalWS, bool isPlanar, bool isTriplanar, float worldScale, inout LayerTexCoord layerTexCoord, float additionalTiling = 1.0)
float3 positionWS, int mappingType, float worldScale, inout LayerTexCoord layerTexCoord, float additionalTiling = 1.0)
{
// Handle uv0, uv1, uv2, uv3 based on _UVMappingMask weight (exclusif 0..1)
float2 uvBase = ADD_IDX(_UVMappingMask).x * texCoord0 +

ADD_IDX(_UVDetailsMappingMask).w * texCoord3;
// If base is planar/triplanar then detail map is forced to be planar/triplanar
ADD_IDX(layerTexCoord.base).isPlanar = isPlanar;
ADD_IDX(layerTexCoord.base).isTriplanar = isTriplanar;
ADD_IDX(layerTexCoord.details).isPlanar = isPlanar;
ADD_IDX(layerTexCoord.details).isTriplanar = isTriplanar;
ADD_IDX(layerTexCoord.details).mappingType = ADD_IDX(layerTexCoord.base).mappingType = mappingType;
ADD_IDX(layerTexCoord.details).normalWS = ADD_IDX(layerTexCoord.base).normalWS = layerTexCoord.vertexNormalWS;
// Copy data for the uvmapping
ADD_IDX(layerTexCoord.details).triplanarWeights = ADD_IDX(layerTexCoord.base).triplanarWeights = layerTexCoord.triplanarWeights;
// TODO: Currently we only handle world planar/triplanar but we may want local planar/triplanar.
// In this case both position and normal need to be convert to object space.

float2 uvXY;
float2 uvZY;
GetTriplanarCoordinate(positionWS * worldScale, vertexNormalWS, uvXZ, uvXY, uvZY);
GetTriplanarCoordinate(positionWS * worldScale, layerTexCoord.vertexNormalWS, uvXZ, uvXY, uvZY);
if (isPlanar)
// Planar is just XZ of triplanar
if (mappingType == UV_MAPPING_PLANAR)
{
uvBase = uvDetails = uvXZ;
}

ADD_IDX(layerTexCoord.details).uvXZ = TRANSFORM_TEX(uvXZ, ADD_IDX(_DetailMap));
ADD_IDX(layerTexCoord.details).uvXY = TRANSFORM_TEX(uvXY, ADD_IDX(_DetailMap));
ADD_IDX(layerTexCoord.details).uvZY = TRANSFORM_TEX(uvZY, ADD_IDX(_DetailMap));
#ifdef SURFACE_GRADIENT
// This part is only relevant for normal mapping with UV_MAPPING_UVSET
// Note: This code work only in pixel shader (as we rely on ddx), it should not be use in other context
ADD_IDX(layerTexCoord.base).tangentWS = ADD_IDX(_UVMappingMask).x * layerTexCoord.vertexTangentWS0 +
ADD_IDX(_UVMappingMask).y * layerTexCoord.vertexTangentWS1 +
ADD_IDX(_UVMappingMask).z * layerTexCoord.vertexTangentWS2 +
ADD_IDX(_UVMappingMask).w * layerTexCoord.vertexTangentWS3;
ADD_IDX(layerTexCoord.base).bitangentWS = ADD_IDX(_UVMappingMask).x * layerTexCoord.vertexBitangentWS0 +
ADD_IDX(_UVMappingMask).y * layerTexCoord.vertexBitangentWS1 +
ADD_IDX(_UVMappingMask).z * layerTexCoord.vertexBitangentWS2 +
ADD_IDX(_UVMappingMask).w * layerTexCoord.vertexBitangentWS3;
ADD_IDX(layerTexCoord.details).tangentWS = ADD_IDX(_UVDetailsMappingMask).x * layerTexCoord.vertexTangentWS0 +
ADD_IDX(_UVDetailsMappingMask).y * layerTexCoord.vertexTangentWS1 +
ADD_IDX(_UVDetailsMappingMask).z * layerTexCoord.vertexTangentWS2 +
ADD_IDX(_UVDetailsMappingMask).w * layerTexCoord.vertexTangentWS3;
ADD_IDX(layerTexCoord.details).bitangentWS = ADD_IDX(_UVDetailsMappingMask).x * layerTexCoord.vertexBitangentWS0 +
ADD_IDX(_UVDetailsMappingMask).y * layerTexCoord.vertexBitangentWS1 +
ADD_IDX(_UVDetailsMappingMask).z * layerTexCoord.vertexBitangentWS2 +
ADD_IDX(_UVDetailsMappingMask).w * layerTexCoord.vertexBitangentWS3;
#endif
}
float3 ADD_IDX(GetNormalTS)(FragInputs input, LayerTexCoord layerTexCoord, float3 detailNormalTS, float detailMask, bool useBias, float bias)

#ifdef _NORMALMAP_TANGENT_SPACE_IDX
if (useBias)
{
normalTS = SAMPLE_LAYER_NORMALMAP_BIAS(ADD_IDX(_NormalMap), SAMPLER_NORMALMAP_IDX, ADD_IDX(layerTexCoord.base), ADD_IDX(_NormalScale), bias);
normalTS = SAMPLE_UVMAPPING_NORMALMAP_BIAS(ADD_IDX(_NormalMap), SAMPLER_NORMALMAP_IDX, ADD_IDX(layerTexCoord.base), ADD_IDX(_NormalScale), bias);
normalTS = SAMPLE_LAYER_NORMALMAP(ADD_IDX(_NormalMap), SAMPLER_NORMALMAP_IDX, ADD_IDX(layerTexCoord.base), ADD_IDX(_NormalScale));
normalTS = SAMPLE_UVMAPPING_NORMALMAP(ADD_IDX(_NormalMap), SAMPLER_NORMALMAP_IDX, ADD_IDX(layerTexCoord.base), ADD_IDX(_NormalScale));
// to be able to combine object space normal with detail map we transform it to tangent space (object space normal composition is complex operation).
// to be able to combine object space normal with detail map or to apply a "scale" we transform it to tangent space (object space normal composition is complex operation).
// Note: There is no such a thing like triplanar with object space normal, so we call directly 2D function
float3 normalOS = SAMPLE_LAYER_NORMALMAP_RGB_BIAS(ADD_IDX(_NormalMap), SAMPLER_NORMALMAP_IDX, ADD_IDX(layerTexCoord.base), ADD_IDX(_NormalScale), bias).rgb;
normalTS = TransformObjectToTangent(normalOS, input.tangentToWorld);
#ifdef SURFACE_GRADIENT
// /We need to decompress the normal ourselve here as UnpackNormalRGB will return a surface gradient
float3 normalOS = SAMPLE_TEXTURE2D_BIAS(ADD_IDX(_NormalMap), SAMPLER_NORMALMAP_IDX, ADD_IDX(layerTexCoord.base).uv, bias).xyz * 2.0 - 1.0;
// normalize(normalOS) // TO CHECK: SurfaceGradientFromPerturbedNormal doesn't require normalOS to be normalize, to check
normalTS = SurfaceGradientFromPerturbedNormal(input.worldToTangent[2], normalOS);
normalTS *= ADD_IDX(_NormalScale);
#else
float3 normalOS = UnpackNormalRGB(SAMPLE_TEXTURE2D_BIAS(ADD_IDX(_NormalMap), SAMPLER_NORMALMAP_IDX, ADD_IDX(layerTexCoord.base).uv, bias), 1.0);
normalTS = TransformObjectToTangent(normalOS, input.worldToTangent);
normalTS.xy *= ADD_IDX(_NormalScale); // Scale in tangent space
normalTS = (normalTS);
#endif
float3 normalOS = SAMPLE_LAYER_NORMALMAP_RGB(ADD_IDX(_NormalMap), SAMPLER_NORMALMAP_IDX, ADD_IDX(layerTexCoord.base), ADD_IDX(_NormalScale)).rgb;
normalTS = TransformObjectToTangent(normalOS, input.tangentToWorld);
#ifdef SURFACE_GRADIENT
// /We need to decompress the normal ourselve here as UnpackNormalRGB will return a surface gradient
float3 normalOS = SAMPLE_TEXTURE2D(ADD_IDX(_NormalMap), SAMPLER_NORMALMAP_IDX, ADD_IDX(layerTexCoord.base).uv).xyz * 2.0 - 1.0;
// normalize(normalOS) // TO CHECK: SurfaceGradientFromPerturbedNormal doesn't require normalOS to be normalize, to check
normalTS = SurfaceGradientFromPerturbedNormal(input.worldToTangent[2], normalOS);
normalTS *= ADD_IDX(_NormalScale);
#else
float3 normalOS = UnpackNormalRGB(SAMPLE_TEXTURE2D(ADD_IDX(_NormalMap), SAMPLER_NORMALMAP_IDX, ADD_IDX(layerTexCoord.base).uv), 1.0);
normalTS = TransformObjectToTangent(normalOS, input.worldToTangent);
normalTS.xy *= ADD_IDX(_NormalScale); // Scale in tangent space
normalTS = (normalTS);
#endif
normalTS = lerp(normalTS, BlendNormalRNM(normalTS, detailNormalTS), detailMask);
#ifdef SURFACE_GRADIENT
normalTS += detailNormalTS;
#else
normalTS = lerp(normalTS, BlendNormalRNM(normalTS, detailNormalTS), detailMask);
#endif
#ifdef SURFACE_GRADIENT
normalTS = float3(0.0, 0.0, 0.0); // No gradient
#else
#endif
#ifdef _DOUBLESIDED_ON
// _DoubleSidedMode is float3(-1, -1, -1) in flip mode and float3(1, 1, -1) in mirror mode (Mirror the normal with the plane define by vertex normal)
float3 oppositeNormalTS = normalTS * _DoubleSidedConstants.xyz;
// TODO : Test if GetOddNegativeScale() is necessary here in case of normal map, as GetOddNegativeScale is take into account in CreateTangentToWorld();
normalTS = input.isFrontFace ? (GetOddNegativeScale() >= 0.0 ? normalTS : oppositeNormalTS) : (-GetOddNegativeScale() >= 0.0 ? normalTS : oppositeNormalTS);
#endif
#endif
return normalTS;

float ADD_IDX(GetSurfaceData)(FragInputs input, LayerTexCoord layerTexCoord, out SurfaceData surfaceData, out float3 normalTS)
{
float alpha = SAMPLE_LAYER_TEXTURE2D(ADD_IDX(_BaseColorMap), ADD_ZERO_IDX(sampler_BaseColorMap), ADD_IDX(layerTexCoord.base)).a * ADD_IDX(_BaseColor).a;
float alpha = SAMPLE_UVMAPPING_TEXTURE2D(ADD_IDX(_BaseColorMap), ADD_ZERO_IDX(sampler_BaseColorMap), ADD_IDX(layerTexCoord.base)).a * ADD_IDX(_BaseColor).a;
// Perform alha test very early to save performance (a killed pixel will not sample textures)
#if defined(_ALPHATEST_ON) && !defined(LAYERED_LIT_SHADER)

float3 detailNormalTS = float3(0.0, 0.0, 0.0);
float detailMask = 0.0;
#ifdef _DETAIL_MAP_IDX
detailMask = SAMPLE_LAYER_TEXTURE2D(ADD_IDX(_DetailMask), SAMPLER_DETAILMASK_IDX, ADD_IDX(layerTexCoord.base)).g;
float2 detailAlbedoAndSmoothness = SAMPLE_LAYER_TEXTURE2D(ADD_IDX(_DetailMap), SAMPLER_DETAILMAP_IDX, ADD_IDX(layerTexCoord.details)).rb;
detailMask = SAMPLE_UVMAPPING_TEXTURE2D(ADD_IDX(_DetailMask), SAMPLER_DETAILMASK_IDX, ADD_IDX(layerTexCoord.base)).g;
float2 detailAlbedoAndSmoothness = SAMPLE_UVMAPPING_TEXTURE2D(ADD_IDX(_DetailMap), SAMPLER_DETAILMAP_IDX, ADD_IDX(layerTexCoord.details)).rb;
detailNormalTS = SAMPLE_LAYER_NORMALMAP_AG(ADD_IDX(_DetailMap), SAMPLER_DETAILMAP_IDX, ADD_IDX(layerTexCoord.details), ADD_ZERO_IDX(_DetailNormalScale));
detailNormalTS = SAMPLE_UVMAPPING_NORMALMAP_AG(ADD_IDX(_DetailMap), SAMPLER_DETAILMAP_IDX, ADD_IDX(layerTexCoord.details), ADD_ZERO_IDX(_DetailNormalScale));
surfaceData.baseColor = SAMPLE_LAYER_TEXTURE2D(ADD_IDX(_BaseColorMap), ADD_ZERO_IDX(sampler_BaseColorMap), ADD_IDX(layerTexCoord.base)).rgb * ADD_IDX(_BaseColor).rgb;
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
surfaceData.baseColor *= LerpWhiteTo(2.0 * saturate(detailAlbedo * ADD_IDX(_DetailAlbedoScale)), detailMask);
#endif

surfaceData.specularOcclusion = SAMPLE_LAYER_TEXTURE2D(ADD_IDX(_SpecularOcclusionMap), SAMPLER_SPECULAROCCLUSIONMAP_IDX, ADD_IDX(layerTexCoord.base)).a;
surfaceData.specularOcclusion = SAMPLE_UVMAPPING_TEXTURE2D(ADD_IDX(_SpecularOcclusionMap), SAMPLER_SPECULAROCCLUSIONMAP_IDX, ADD_IDX(layerTexCoord.base)).a;
#else
// The specular occlusion will be perform outside the internal loop
surfaceData.specularOcclusion = 1.0;

normalTS = ADD_IDX(GetNormalTS)(input, layerTexCoord, detailNormalTS, detailMask, false, 0.0);
#if defined(_MASKMAP_IDX)
surfaceData.perceptualSmoothness = SAMPLE_LAYER_TEXTURE2D(ADD_IDX(_MaskMap), SAMPLER_MASKMAP_IDX, ADD_IDX(layerTexCoord.base)).a;
surfaceData.perceptualSmoothness = SAMPLE_UVMAPPING_TEXTURE2D(ADD_IDX(_MaskMap), SAMPLER_MASKMAP_IDX, ADD_IDX(layerTexCoord.base)).a;
#else
surfaceData.perceptualSmoothness = 1.0;
#endif

// MaskMap is RGBA: Metallic, Ambient Occlusion (Optional), emissive Mask (Optional), Smoothness
#ifdef _MASKMAP_IDX
surfaceData.metallic = SAMPLE_LAYER_TEXTURE2D(ADD_IDX(_MaskMap), SAMPLER_MASKMAP_IDX, ADD_IDX(layerTexCoord.base)).r;
surfaceData.ambientOcclusion = SAMPLE_LAYER_TEXTURE2D(ADD_IDX(_MaskMap), SAMPLER_MASKMAP_IDX, ADD_IDX(layerTexCoord.base)).g;
surfaceData.metallic = SAMPLE_UVMAPPING_TEXTURE2D(ADD_IDX(_MaskMap), SAMPLER_MASKMAP_IDX, ADD_IDX(layerTexCoord.base)).r;
surfaceData.ambientOcclusion = SAMPLE_UVMAPPING_TEXTURE2D(ADD_IDX(_MaskMap), SAMPLER_MASKMAP_IDX, ADD_IDX(layerTexCoord.base)).g;
#else
surfaceData.metallic = 1.0;
surfaceData.ambientOcclusion = 1.0;

// TODO: think about using BC5
#ifdef _TANGENTMAP
#ifdef _NORMALMAP_TANGENT_SPACE_IDX // Normal and tangent use same space
float3 tangentTS = SAMPLE_LAYER_NORMALMAP(ADD_IDX(_TangentMap), ADD_ZERO_IDX(sampler_TangentMap), ADD_IDX(layerTexCoord.base), 1.0);
surfaceData.tangentWS = TransformTangentToWorld(tangentTS, input.tangentToWorld);
#else // Object space
float3 tangentOS = SAMPLE_LAYER_NORMALMAP_RGB(ADD_IDX(_TangentMap), ADD_ZERO_IDX(sampler_TangentMap), ADD_IDX(layerTexCoord.base), 1.0).rgb;
#ifdef _NORMALMAP_TANGENT_SPACE_IDX // Normal and tangent use same space
float3 tangentTS = SAMPLE_UVMAPPING_NORMALMAP(_TangentMap, sampler_TangentMap, layerTexCoord.base, 1.0);
surfaceData.tangentWS = TransformTangentToWorld(tangentTS, input.worldToTangent);
#else // Object space
// Note: There is no such a thing like triplanar with object space normal, so we call directly 2D function
float3 tangentOS = UnpackNormalRGB(SAMPLE_TEXTURE2D(_TangentMap, sampler_TangentMap, layerTexCoord.base.uv), 1.0);
#endif
#endif
surfaceData.tangentWS = input.tangentToWorld[0].xyz;
#ifdef SURFACE_GRADIENT
surfaceData.tangentWS = normalize(input.worldToTangent[0].xyz); // The tangent is not normalize in worldToTangent when using surface gradient
#else
surfaceData.tangentWS = input.worldToTangent[0].xyz;
#endif
// TODO: Is there anything todo regarding flip normal but for the tangent ?
surfaceData.anisotropy = SAMPLE_LAYER_TEXTURE2D(ADD_IDX(_AnisotropyMap), ADD_ZERO_IDX(sampler_AnisotropyMap), ADD_IDX(layerTexCoord.base)).b;
surfaceData.anisotropy = SAMPLE_UVMAPPING_TEXTURE2D(_AnisotropyMap, sampler_AnisotropyMap, layerTexCoord.base).b;
#else
surfaceData.anisotropy = 1.0;
#endif

surfaceData.subsurfaceProfile = _SubsurfaceProfile;
#ifdef _SUBSURFACE_RADIUS_MAP
surfaceData.subsurfaceRadius = SAMPLE_LAYER_TEXTURE2D(ADD_IDX(_SubsurfaceRadiusMap), ADD_ZERO_IDX(sampler_SubsurfaceRadiusMap), ADD_IDX(layerTexCoord.base)).r * _SubsurfaceRadius;
surfaceData.subsurfaceRadius = SAMPLE_UVMAPPING_TEXTURE2D(_SubsurfaceRadiusMap, sampler_SubsurfaceRadiusMap, layerTexCoord.base).r * _SubsurfaceRadius;
surfaceData.thickness = SAMPLE_LAYER_TEXTURE2D(ADD_IDX(_ThicknessMap), ADD_ZERO_IDX(sampler_ThicknessMap), ADD_IDX(layerTexCoord.base)).r;
surfaceData.thickness = SAMPLE_UVMAPPING_TEXTURE2D(_ThicknessMap, sampler_ThicknessMap, layerTexCoord.base).r;
#else
surfaceData.thickness = _Thickness;
#endif

// Layered shader only support materialId 0
surfaceData.materialId = 0;
surfaceData.tangentWS = input.tangentToWorld[0].xyz;
surfaceData.anisotropy = 0;
surfaceData.specular = 0.04;
// All these parameters are ignore as they are re-setup outside of the layers function
surfaceData.tangentWS = float3(0.0, 0.0, 0.0);
surfaceData.anisotropy = 0.0;
surfaceData.specular = 0.0;
surfaceData.subsurfaceRadius = 1.0;
surfaceData.subsurfaceRadius = 0.0;
surfaceData.coatPerceptualSmoothness = 1.0;
surfaceData.coatPerceptualSmoothness = 0.0;
surfaceData.specularColor = float3(0.0, 0.0, 0.0);
#endif // #if !defined(LAYERED_LIT_SHADER)

3
Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LitProperties.hlsl


//SAMPLER2D(sampler_CoatRoughnessMap);
float _TexWorldScale;
float _UVMappingPlanar;
float4 _UVMappingMask;
float4 _UVDetailsMappingMask;

float _TexWorldScaleBlendMask;
PROP_DECL(float, _TexWorldScale);
float _UVMappingPlanarBlendMask;
PROP_DECL(float, _UVMappingPlanar);
PROP_DECL(float4, _UVMappingMask);
PROP_DECL(float4, _UVDetailsMappingMask);

1
Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LitTessellation.hlsl


{
// This call will work for both LayeredLit and Lit shader
LayerTexCoord layerTexCoord;
ZERO_INITIALIZE(LayerTexCoord, layerTexCoord);
GetLayerTexCoord(
#ifdef VARYINGS_DS_NEED_TEXCOORD0
input.texCoord0,

3
Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LitTessellation.shader


[Enum(UV0, 0, Planar, 1, TriPlanar, 2)] _UVBase("UV Set for base", Float) = 0
_TexWorldScale("Scale to apply on world coordinate", Float) = 1.0
[HideInInspector] _UVMappingMask("_UVMappingMask", Color) = (1, 0, 0, 0)
[HideInInspector] _UVMappingPlanar("_UVMappingPlanar", Float) = 0
[Enum(TangentSpace, 0, ObjectSpace, 1)] _NormalMapSpace("NormalMap space", Float) = 0
[Enum(Standard, 0, Subsurface Scattering, 1, Clear Coat, 2, Specular Color, 3)] _MaterialID("MaterialId", Int) = 0

#pragma shader_feature _ _TESSELLATION_DISPLACEMENT _TESSELLATION_DISPLACEMENT_PHONG
#pragma shader_feature _TESSELLATION_OBJECT_SCALE
#pragma shader_feature _MAPPING_TRIPLANAR
#pragma shader_feature _ _MAPPING_PLANAR _MAPPING_TRIPLANAR
#pragma shader_feature _NORMALMAP_TANGENT_SPACE
#pragma shader_feature _ _REQUIRE_UV2 _REQUIRE_UV3
#pragma shader_feature _EMISSIVE_COLOR

1
Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/ShaderPass/LitDepthPass.hlsl


// Varying - Use for pixel shader
// This second set of define allow to say which varyings will be output in the vertex (no more tesselation)
#if REQUIRE_TANGENT_TO_WORLD
#define VARYINGS_NEED_POSITION_WS // Required to get view vector
#define VARYINGS_NEED_TANGENT_TO_WORLD
#endif

1
Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/ShaderPass/LitDistortionPass.hlsl


// Varying - Use for pixel shader
// This second set of define allow to say which varyings will be output in the vertex (no more tesselation)
#if REQUIRE_TANGENT_TO_WORLD
#define VARYINGS_NEED_POSITION_WS // Required to get view vector
#define VARYINGS_NEED_TANGENT_TO_WORLD
#endif

1
Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/ShaderPass/LitVelocityPass.hlsl


#define VARYINGS_NEED_POSITION_WS
#if REQUIRE_TANGENT_TO_WORLD
#define VARYINGS_NEED_POSITION_WS // Required to get view vector
#define VARYINGS_NEED_TANGENT_TO_WORLD
#endif

34
Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/MaterialUtilities.hlsl


#endif
}
// Flipping or mirroring a normal can be done directly on the tangent space. This has the benefit to apply to the whole process either in surface gradient or not.
// This function will modify FragInputs and this is not propagate outside of GetSurfaceAndBuiltinData(). This is ok as tangent space is not use outside of GetSurfaceAndBuiltinData().
void ApplyDoubleSidedFlipOrMirror(inout FragInputs input)
{
#ifdef _DOUBLESIDED_ON
// _DoubleSidedConstants is float3(-1, -1, -1) in flip mode and float3(1, 1, -1) in mirror mode
// To get a flipped normal with the tangent space, we must flip bitangent (because it is construct from the normal) and normal
// To get a mirror normal with the tangent space, we only need to flip the normal and not the tangent
float2 flipSign = input.isFrontFace ? float2(1.0, 1.0) : _DoubleSidedConstants.yz; // TOCHECK : GetOddNegativeScale() is not necessary here as it is apply for tangent space creation.
input.worldToTangent[1] = flipSign.x * input.worldToTangent[1]; // bitangent
input.worldToTangent[2] = flipSign.y * input.worldToTangent[2]; // normal
#ifdef SURFACE_GRADIENT
// TOCHECK: seems that we don't need to invert any genBasisTB(), sign cancel. Which is expected as we deal with surface gradient.
#endif
#endif
}
void GetNormalAndTangentWS(FragInputs input, float3 V, float3 normalTS, inout float3 normalWS, inout float3 tangentWS, bool twoSided = false)
void GetNormalAndTangentWS(FragInputs input, float3 V, float3 normalTS, inout float3 normalWS, inout float3 tangentWS, bool wantNegativeNormal = false)
normalWS = TransformTangentToWorld(normalTS, input.tangentToWorld);
#ifdef SURFACE_GRADIENT
normalWS = SurfaceGradientResolveNormal(input.worldToTangent[2], normalTS);
#else
normalWS = TransformTangentToWorld(normalTS, input.worldToTangent);
#endif
// NdotV should not be negative for visible pixels, but it can happen due to the
// perspective projection and the normal mapping + decals. In that case, the normal
// should be modified to become valid (i.e facing the camera) to avoid weird artifacts.
// Note: certain applications (e.g. SpeedTree) require to still have negative normal to perform their own two sided lighting
// This will potentially reduce the length of the normal at edges of geometry.
GetShiftedNdotV(normalWS, V, twoSided);
GetShiftedNdotV(normalWS, V, wantNegativeNormal);
// This is use with anisotropic material
tangentWS = normalize(tangentWS - dot(tangentWS, normalWS));
}

8
Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Unlit/Editor/BaseUnlitUI.cs


public static GUIContent distortionEnableText = new GUIContent("Distortion", "Enable distortion on this shader");
public static GUIContent distortionOnlyText = new GUIContent("Distortion Only", "This shader will only be use to render distortion");
public static GUIContent distortionDepthTestText = new GUIContent("Distortion Depth Test", "Enable the depth test for distortion");
public static GUIContent emissiveWarning = new GUIContent("Emissive value is animated but the material has not been configured to support emissive. Please make sure the material itself has some amount of emissive.");
public static GUIContent emissiveColorWarning = new GUIContent("Ensure emissive color is non-black for emission to have effect.");
}
public enum SurfaceType

}
SetKeyword(material, "_DISTORTION_ON", distortionEnable);
// A material's GI flag internally keeps track of whether emission is enabled at all, it's enabled but has no effect
// or is enabled and may be modified at runtime. This state depends on the values of the current flag and emissive color.
// The fixup routine makes sure that the material is in the correct state if/when changes are made to the mode or color.
MaterialEditor.FixupEmissiveFlag(material);
}
static public void SetupBaseUnlitMaterialPass(Material material)

20
Assets/ScriptableRenderPipeline/HDRenderPipeline/ShaderPass/FragInputs.hlsl


float2 texCoord1;
float2 texCoord2;
float2 texCoord3;
float3 tangentToWorld[3]; // These 3 vectors are normalized (no need for the material to normalize) and these are only for UVSet 0
// TODO: confirm with Morten following statement
// Our TBN is orthogonal but is maybe not orthonormal in order to be compliant with external bakers (Like xnormal that use mikktspace).
// (xnormal for example take into account the interpolation when baking the normal and normalizing the tangent basis could cause distortion).
// When using worldToTangent with surface gradient, it doesn't normalize the tangent/bitangent vector (We instead use exact same scale as applied to interpolated vertex normal to avoid breaking compliance).
// this mean that any usage of worldToTangent[1] or worldToTangent[2] outside of the context of normal map (like for POM) must normalize the TBN (TCHECK if this make any difference ?)
// When not using surface gradient, each vector of worldToTangent are normalize (TODO: Maybe they should not even in case of no surface gradient ? Ask Morten)
float3x3 worldToTangent;
// For two sided lighting
bool isFrontFace;

FragInputs output;
ZERO_INITIALIZE(FragInputs, output);
output.tangentToWorld[0] = float3(0.0, 0.0, 1.0);
output.tangentToWorld[2] = float3(0.0, 0.0, 1.0);
// Init to some default value to make the computer quiet (else it output "divide by zero" warning even if value is not used).
output.worldToTangent[0] = float3(0.0, 0.0, 1.0);
output.worldToTangent[2] = float3(0.0, 0.0, 1.0);
return output;
}

result = float3(input.texCoord3, 0.0);
break;
case DEBUGVIEWVARYING_VERTEX_TANGENT_WS:
result = input.tangentToWorld[0].xyz * 0.5 + 0.5;
result = input.worldToTangent[0].xyz * 0.5 + 0.5;
result = input.tangentToWorld[1].xyz * 0.5 + 0.5;
result = input.worldToTangent[1].xyz * 0.5 + 0.5;
result = input.tangentToWorld[2].xyz * 0.5 + 0.5;
result = input.worldToTangent[2].xyz * 0.5 + 0.5;
break;
case DEBUGVIEWVARYING_VERTEX_COLOR:
result = input.color.rgb; needLinearToSRGB = true;

34
Assets/ScriptableRenderPipeline/HDRenderPipeline/ShaderPass/VaryingMesh.hlsl


#endif
#ifdef VARYINGS_NEED_TANGENT_TO_WORLD
// Normalize the normal/tangent after interpolation
float4 tangentWS = float4(input.interpolators2.xyz, input.interpolators2.w > 0.0 ? 1.0 : -1.0);
// TODO: We should be able to not make distinction between the two path, but it mean material need to be aware to normalize the TBN when required, like for example for POM.
// For now do some test by keeping code consistent with previous visual.
#ifdef SURFACE_GRADIENT
// Normalize normalWS vector but keep the renormFactor to apply it to bitangent and tangent
float renormFactor = 1.0 / length(input.interpolators1);
float3 normalWS = renormFactor * input.interpolators1;
// no normalizes is mandatory for tangentWS
// bitangent on the fly option in xnormal to reduce vertex shader outputs.
float3x3 worldToTangent = CreateWorldToTangent(normalWS, tangentWS.xyz, tangentWS.w);
output.worldToTangent[0] = worldToTangent[0];
// prepare for surfgrad formulation without breaking compliance (use exact same scale as applied to interpolated vertex normal to avoid breaking compliance).
output.worldToTangent[1] = worldToTangent[1] * renormFactor;
output.worldToTangent[2] = worldToTangent[2] * renormFactor;
#else
// TODO: Check if we must do like for surface gradient (i.e not normalize ?) For now, for consistency with previous code we normalize
// Normalize after the interpolation
float4 tangentWS = float4(normalize(input.interpolators2.xyz), input.interpolators2.w);
float3x3 tangentToWorld = CreateTangentToWorld(normalWS, tangentWS.xyz, tangentWS.w);
output.tangentToWorld[0] = tangentToWorld[0];
output.tangentToWorld[1] = tangentToWorld[1];
output.tangentToWorld[2] = tangentToWorld[2];
tangentWS.xyz = normalize(tangentWS.xyz);
// bitangent on the fly option in xnormal to reduce vertex shader outputs.
float3x3 worldToTangent = CreateWorldToTangent(normalWS, tangentWS.xyz, tangentWS.w);
output.worldToTangent[0] = worldToTangent[0];
output.worldToTangent[1] = worldToTangent[1];
output.worldToTangent[2] = worldToTangent[2];
#endif // VARYINGS_NEED_TANGENT_TO_WORLD
#ifdef VARYINGS_NEED_TEXCOORD0
output.texCoord0 = input.interpolators3.xy;

46
Assets/ScriptableRenderPipeline/HDRenderPipeline/ShaderVariables.hlsl


return mul(GetWorldToHClipMatrix(), float4(positionWS, 1.0));
}
float3x3 CreateTangentToWorld(float3 normal, float3 tangent, float tangentSign)
{
// For odd-negative scale transforms we need to flip the sign
float sgn = tangentSign * GetOddNegativeScale();
float3 bitangent = cross(normal, tangent) * sgn;
return float3x3(tangent, bitangent, normal);
}
// Computes world space view direction, from object space position
float3 GetWorldSpaceNormalizeViewDir(float3 positionWS)
{

return normalize(V);
}
float3 TransformTangentToWorld(float3 dirTS, float3 tangentToWorld[3])
float3x3 CreateWorldToTangent(float3 normal, float3 tangent, float flipSign)
// TODO check: do we need to normalize ?
return normalize(mul(dirTS, float3x3(tangentToWorld[0].xyz, tangentToWorld[1].xyz, tangentToWorld[2].xyz)));
// For odd-negative scale transforms we need to flip the sign
float sgn = flipSign * GetOddNegativeScale();
float3 bitangent = cross(normal, tangent) * sgn;
return float3x3(tangent, bitangent, normal);
// Assume TBN is orthonormal.
float3 TransformWorldToTangent(float3 dirWS, float3 tangentToWorld[3])
float3 TransformTangentToWorld(float3 dirTS, float3x3 worldToTangent)
// TODO check: do we need to normalize ?
return normalize(mul(float3x3(tangentToWorld[0].xyz, tangentToWorld[1].xyz, tangentToWorld[2].xyz), dirWS));
// Use transpose transformation to go from tangent to world as the matrix is orthogonal
return mul(dirTS, worldToTangent);
float3 TransformTangentToObject(float3 dirTS, float3 worldToTangent[3])
float3 TransformWorldToTangent(float3 dirWS, float3x3 worldToTangent)
// TODO check: do we need to normalize ?
// worldToTangent is orthonormal so inverse <==> transpose
float3x3 mWorldToTangent = float3x3(worldToTangent[0].xyz, worldToTangent[1].xyz, worldToTangent[2].xyz);
float3 normalWS = mul(dirTS, mWorldToTangent);
return normalize(mul((float3x3)unity_WorldToObject, normalWS));
return mul(worldToTangent, dirWS);
}
float3 TransformTangentToObject(float3 dirTS, float3x3 worldToTangent)
{
// Use transpose transformation to go from tangent to world as the matrix is orthogonal
float3 normalWS = mul(dirTS, worldToTangent);
return mul((float3x3)unity_WorldToObject, normalWS);
// Assume TBN is orthonormal.
float3 TransformObjectToTangent(float3 dirOS, float3 worldToTangent[3])
float3 TransformObjectToTangent(float3 dirOS, float3x3 worldToTangent)
// TODO check: do we need to normalize ?
return normalize(mul(float3x3(worldToTangent[0].xyz, worldToTangent[1].xyz, worldToTangent[2].xyz), mul((float3x3)unity_ObjectToWorld, dirOS)));
return mul(worldToTangent, mul((float3x3)unity_ObjectToWorld, dirOS));
}
#endif // UNITY_SHADER_VARIABLES_INCLUDED

2
Assets/ScriptableRenderPipeline/HDRenderPipeline/Sky/HDRISky/Resources/SkyHDRI.shader


ZWrite Off
ZTest Always
Blend One Zero
Cull Off
HLSLPROGRAM
ENDHLSL

ZWrite Off
ZTest LEqual
Blend One Zero
Cull Off
HLSLPROGRAM
ENDHLSL

1
Assets/ScriptableRenderPipeline/HDRenderPipeline/Sky/ProceduralSky/Resources/SkyProcedural.shader


ZWrite Off
ZTest Always
Blend One OneMinusSrcAlpha, Zero One
Cull Off
HLSLPROGRAM
#pragma target 4.5

8
Assets/ScriptableRenderPipeline/ShaderLibrary/CommonLighting.hlsl


// NdotV should not be negative for visible pixels, but it can happen due to the
// perspective projection and the normal mapping + decals. In that case, the normal
// should be modified to become valid (i.e facing the camera) to avoid weird artifacts.
// Note: certain applications (e.g. SpeedTree) require to still have negative normal to perform their own two sided lighting
// This will potentially reduce the length of the normal at edges of geometry.
float GetShiftedNdotV(inout float3 N, float3 V, bool twoSided)
// Note: certain applications (e.g. SpeedTree) require to still have negative normal to perform their own two sided lighting, they can use wantNegativeNormal
// This will potentially reduce the length of the normal at edges of geometry.
float GetShiftedNdotV(inout float3 N, float3 V, bool wantNegativeNormal)
if (!twoSided && NdotV < limit)
if (!wantNegativeNormal && NdotV < limit)
{
// We do not renormalize the normal because { abs(length(N) - 1.0) < limit }.
N += (-NdotV + limit) * V;

9
Assets/ScriptableRenderPipeline/ShaderLibrary/CommonMaterial.hlsl


// Parallax mapping
// ----------------------------------------------------------------------------
float2 ParallaxOffset(float3 viewDirTS, float height)
{
// Parallax mapping with offset limiting to reduce weird artifcat (i.e do not divide by z), also save performance
return viewDirTS.xy * height;
}
// ref https://www.gamedev.net/topic/678043-how-to-blend-world-space-normals/#entry5287707
// assume compositing in world space
// Note: Using vtxNormal = float3(0, 0, 1) give the BlendNormalRNM formulation.

return normalize(float3(n1.xy * n2.z + n2.xy * n1.z, n1.z * n2.z));
}
// Ref: http://http.developer.nvidia.com/GPUGems3/gpugems3_ch01.html
// Ref: http://http.developer.nvidia.com/GPUGems3/gpugems3_ch01.html / http://www.slideshare.net/icastano/cascades-demo-secrets
float3 ComputeTriplanarWeights(float3 normal)
{
// Determine the blend weights for the 3 planar projections.

blendWeights = blendWeights * blendWeights * blendWeights; // pow(blendWeights, 3);
// Force weights to sum to 1.0 (very important!)
blendWeights = max(blendWeights, float3(0.0, 0.0, 0.0));
blendWeights /= dot(blendWeights, 1.0);

35
Assets/TestScenes/HDTest/CascadedShadowsTest.unity


m_EnableBakedLightmaps: 0
m_EnableRealtimeLightmaps: 0
m_LightmapEditorSettings:
serializedVersion: 6
serializedVersion: 8
m_Resolution: 2
m_BakeResolution: 40
m_TextureWidth: 1024

m_FinalGatherFiltering: 1
m_FinalGatherRayCount: 256
m_ReflectionCompression: 2
m_StationaryBakeMode: 3
m_MixedBakeMode: 3
m_BakeBackend: 0
m_PVRSampling: 1
m_PVRSampleCount: 500
m_PVRBounces: 2
m_PVRFiltering: 0
m_PVRFilteringMode: 1
m_PVRCulling: 1
m_PVRFilteringGaussRadiusDirect: 1
m_PVRFilteringGaussRadiusIndirect: 5
m_PVRFilteringGaussRadiusAO: 2
m_PVRFilteringAtrousColorSigma: 1
m_PVRFilteringAtrousNormalSigma: 1
m_PVRFilteringAtrousPositionSigma: 1
m_RuntimeCPUUsage: 25
m_ShadowMaskMode: 2
--- !u!196 &4
NavMeshSettings:

m_Lightmapping: 4
m_AreaSize: {x: 1, y: 1}
m_BounceIntensity: 1
m_CCT: 6500
m_ColorTemperature: 6570
m_UseColorTemperature: 0
m_ShadowRadius: 0
m_ShadowAngle: 0
--- !u!4 &1612942797

m_Name:
m_EditorClassIdentifier:
shadowResolution: 1024
m_innerSpotPercent: 0
shadowDimmer: 1
affectDiffuse: 1
affectSpecular: 1

m_Script: {fileID: 11500000, guid: bc357c46587fc9d4cb8f311794d7d2f3, type: 3}
m_Name:
m_EditorClassIdentifier:
m_SkyRendererTypeName: UnityEngine.Experimental.ScriptableRenderLoop.HDRISkyRenderer
m_ShadowMaxDistance: 1000
m_ShadowCascadeCount: 4
m_ShadowCascadeSplit0: 0.015
m_ShadowCascadeSplit1: 0.05
m_ShadowCascadeSplit2: 0.15
m_Settings:
m_ShadowMaxDistance: 1000
m_ShadowCascadeCount: 4
m_ShadowCascadeSplit0: 0.05
m_ShadowCascadeSplit1: 0.2
m_ShadowCascadeSplit2: 0.3
m_ShadowNearPlaneOffset: 5
--- !u!4 &2100643540
Transform:
m_ObjectHideFlags: 0

18
Assets/TestScenes/HDTest/CascadedShadowsTest/Lit_Gray.mat


m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SubsurfaceRadiusMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ThicknessMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}

- _DistortionDepthTest: 0
- _DistortionEnable: 0
- _DistortionOnly: 0
- _DoubleSidedEnable: 0
- _DoubleSidedMirrorEnable: 1
- _DoubleSidedMode: 0
- _DstBlend: 0
- _EmissiveColorMode: 1

- _GlossyReflections: 1
- _HeightAmplitude: 0.01
- _HeightCenter: 0.5
- _HorizonFade: 1
- _StencilRef: 1
- _PPDLodThreshold: 5
- _PPDMaxSamples: 15
- _PPDMinSamples: 5
- _Parallax: 0.02

- _SrcBlend: 1
- _StencilRef: 2
- _SubsurfaceProfile: 0
- _SubsurfaceRadius: 1
- _Thickness: 1
- _UVBase: 0
- _UVDetail: 0
- _UVMappingPlanar: 0

m_Colors:
- _BaseColor: {r: 0.49803922, g: 0.49803922, b: 0.49803922, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _EmissiveColor: {r: 0, g: 0, b: 0, a: 1}
- _UVDetailsMappingMask: {r: 1, g: 0, b: 0, a: 0}

25
Assets/TestScenes/HDTest/GlobalIlluminationTest/Material/Chrome.mat


m_PrefabInternal: {fileID: 0}
m_Name: Chrome
m_Shader: {fileID: 4800000, guid: 6e4ae4064600d784cac1e41a9e6f2e59, type: 3}
m_ShaderKeywords: _ALPHACUTOFFENABLE_OFF _DEPTHOFFSETENABLE_OFF _DETAIL_MAP_WITH_NORMAL
_DISTORTIONDEPTHTEST_OFF _DISTORTIONENABLE_OFF _DISTORTIONONLY_OFF _ENABLEPERPIXELDISPLACEMENT_OFF
_NORMALMAP_TANGENT_SPACE
m_ShaderKeywords: _NORMALMAP_TANGENT_SPACE
m_EnableInstancingVariants: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses:

m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SubsurfaceRadiusMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ThicknessMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}

- _DistortionDepthTest: 0
- _DistortionEnable: 0
- _DistortionOnly: 0
- _DoubleSidedEnable: 0
- _DoubleSidedMirrorEnable: 1
- _DoubleSidedMode: 0
- _DstBlend: 0
- _EmissiveColorMode: 1

- _GlossyReflections: 1
- _HeightAmplitude: 0.01
- _HeightCenter: 0.5
- _HorizonFade: 1
- _StencilRef: 1
- _PPDLodThreshold: 5
- _PPDMaxSamples: 15
- _PPDMinSamples: 5
- _StencilRef: 2
- _SubsurfaceProfile: 0
- _SubsurfaceRadius: 1
- _Thickness: 1
- _UVBase: 0
- _UVDetail: 0
- _UVMappingPlanar: 0

m_Colors:
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _EmissiveColor: {r: 0, g: 0, b: 0, a: 1}
- _UVDetailsMappingMask: {r: 1, g: 0, b: 0, a: 0}

6
Assets/TestScenes/HDTest/GlobalIlluminationTest/Material/Lit_Green.mat


m_PrefabInternal: {fileID: 0}
m_Name: Lit_Green
m_Shader: {fileID: 4800000, guid: 6e4ae4064600d784cac1e41a9e6f2e59, type: 3}
m_ShaderKeywords: _ALPHACUTOFFENABLE_OFF _DISTORTIONDEPTHTEST_OFF _DISTORTIONONLY_OFF
_EMISSION _NORMALMAP_TANGENT_SPACE _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
m_ShaderKeywords: _NORMALMAP_TANGENT_SPACE
m_LightmapFlags: 1
m_EnableInstancingVariants: 0
m_CustomRenderQueue: -1

- _SmoothnessTextureChannel: 1
- _SpecularHighlights: 1
- _SrcBlend: 1
- _StencilRef: 1
- _StencilRef: 2
- _SubSurfaceRadius: 0
- _SubsurfaceProfile: 0
- _SubsurfaceRadius: 1

m_Colors:
- _BaseColor: {r: 0, g: 1, b: 0, a: 1}
- _Color: {r: 0, g: 1, b: 0, a: 1}
- _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _EmissiveColor: {r: 0, g: 0, b: 0, a: 1}
- _UVDetailsMappingMask: {r: 1, g: 0, b: 0, a: 0}

6
Assets/TestScenes/HDTest/GlobalIlluminationTest/Material/Lit_Grey.mat


m_PrefabInternal: {fileID: 0}
m_Name: Lit_Grey
m_Shader: {fileID: 4800000, guid: 6e4ae4064600d784cac1e41a9e6f2e59, type: 3}
m_ShaderKeywords: _ALPHACUTOFFENABLE_OFF _DEPTHOFFSETENABLE_OFF _DISTORTIONDEPTHTEST_OFF
_DISTORTIONENABLE_OFF _DISTORTIONONLY_OFF _ENABLEPERPIXELDISPLACEMENT_OFF _NORMALMAP_TANGENT_SPACE
m_ShaderKeywords: _NORMALMAP_TANGENT_SPACE
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_CustomRenderQueue: -1

- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _StencilRef: 1
- _StencilRef: 2
- _SubSurfaceRadius: 0
- _SubsurfaceProfile: 0
- _SubsurfaceRadius: 1

m_Colors:
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _EmissiveColor: {r: 0, g: 0, b: 0, a: 1}
- _UVDetailsMappingMask: {r: 1, g: 0, b: 0, a: 0}

21
Assets/TestScenes/HDTest/GlobalIlluminationTest/Material/Lit_Red.mat


m_PrefabInternal: {fileID: 0}
m_Name: Lit_Red
m_Shader: {fileID: 4800000, guid: 6e4ae4064600d784cac1e41a9e6f2e59, type: 3}
m_ShaderKeywords: _ALPHACUTOFFENABLE_OFF _DETAIL_MAP_WITH_NORMAL _DISTORTIONDEPTHTEST_OFF
_DISTORTIONONLY_OFF _EMISSION _NORMALMAP_TANGENT_SPACE
m_ShaderKeywords: _NORMALMAP_TANGENT_SPACE
m_LightmapFlags: 1
m_EnableInstancingVariants: 0
m_CustomRenderQueue: -1

m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SubsurfaceRadiusMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ThicknessMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}

- _DistortionEnable: 0
- _DistortionOnly: 0
- _DoubleSided: 1
- _DoubleSidedEnable: 0
- _DoubleSidedMirrorEnable: 1
- _DoubleSidedMode: 0
- _DstBlend: 0
- _EmissiveColorMode: 1

- _HeightCenter: 0.5
- _HeightMapMode: 0
- _HeightScale: 1
- _HorizonFade: 1
- _StencilRef: 1
- _Metalic: 0
- _Metallic: 0
- _Mode: 0

- _PPDLodThreshold: 5
- _PPDMaxSamples: 15
- _PPDMinSamples: 5
- _Parallax: 0.02

- _SrcBlend: 1
- _StencilRef: 2
- _SubsurfaceProfile: 0
- _SubsurfaceRadius: 1
- _Thickness: 1
- _UVBase: 0
- _UVDetail: 0
- _UVMappingPlanar: 0

m_Colors:
- _BaseColor: {r: 1, g: 0, b: 0, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _EmissiveColor: {r: 0, g: 0, b: 0, a: 1}
- _UVDetailsMappingMask: {r: 1, g: 0, b: 0, a: 0}

13
Assets/TestScenes/HDTest/LayeredLitTest/Material/Layered_BlendColor.mat


m_PrefabInternal: {fileID: 0}
m_Name: Layered_BlendColor
m_Shader: {fileID: 4800000, guid: 81d02e8644315b742b154842a3a2f98c, type: 3}
m_ShaderKeywords: _ALPHACUTOFFENABLE_OFF _DETAIL_MAP_WITH_NORMAL _DISTORTIONDEPTHTEST_OFF
_DISTORTIONONLY_OFF _EMISSION _EMISSIVE_COLOR _LAYEREDLIT_4_LAYER _LAYEREDLIT_4_LAYERS
_LAYERMASKMAP _LAYER_MAPPING_PLANAR0 _LAYER_MAPPING_PLANAR_0 _LAYER_MAPPING_PLANAR_1
_LAYER_MAPPING_PLANAR_2 _LAYER_MAPPING_PLANAR_3 _LAYER_MASK_VERTEX_COLOR _LAYER_MASK_VERTEX_COLOR_MUL
_NORMALMAP_TANGENT_SPACE _NORMALMAP_TANGENT_SPACE0 _NORMALMAP_TANGENT_SPACE1 _NORMALMAP_TANGENT_SPACE2
_NORMALMAP_TANGENT_SPACE3
m_ShaderKeywords: _LAYEREDLIT_4_LAYERS _LAYER_MASK_VERTEX_COLOR_MUL _NORMALMAP_TANGENT_SPACE0
_NORMALMAP_TANGENT_SPACE1 _NORMALMAP_TANGENT_SPACE2 _NORMALMAP_TANGENT_SPACE3
m_LightmapFlags: 1
m_EnableInstancingVariants: 0
m_CustomRenderQueue: -1

- _DistortionDepthTest: 0
- _DistortionEnable: 0
- _DistortionOnly: 0
- _DoubleSidedEnable: 0
- _DoubleSidedMirrorEnable: 1
- _DoubleSidedMode: 0
- _DstBlend: 0
- _EmissiveColorMode: 0

- _LayerTiling3: 1
- _LayerTilingBlendMask: 1
- _MaterialID: 0
- _StencilRef: 1
- _Metalic: 0
- _Metalic0: 0
- _Metalic1: 0

- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _StencilRef: 2
- _SurfaceType: 0
- _TexWorldScale: 1
- _TexWorldScale0: 1

- _BaseColor2: {r: 0, g: 1, b: 0, a: 1}
- _BaseColor3: {r: 0, g: 0, b: 1, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _EmissiveColor: {r: 0, g: 0, b: 0, a: 1}
- _EmissiveColor0: {r: 0, g: 0, b: 0, a: 1}

13
Assets/TestScenes/HDTest/LayeredLitTest/Material/Layered_BlendMask.mat


m_PrefabInternal: {fileID: 0}
m_Name: Layered_BlendMask
m_Shader: {fileID: 4800000, guid: 81d02e8644315b742b154842a3a2f98c, type: 3}
m_ShaderKeywords: _ALPHACUTOFFENABLE_OFF _DETAIL_MAP_WITH_NORMAL _DISTORTIONDEPTHTEST_OFF
_DISTORTIONONLY_OFF _EMISSION _EMISSIVE_COLOR _LAYEREDLIT_4_LAYER _LAYEREDLIT_4_LAYERS
_LAYERMASKMAP _LAYERMASKVERTEXCOLOR_OFF _LAYER_MAPPING_PLANAR0 _LAYER_MAPPING_PLANAR_0
_LAYER_MAPPING_PLANAR_1 _LAYER_MAPPING_PLANAR_2 _LAYER_MAPPING_PLANAR_3 _NORMALMAP_TANGENT_SPACE
_NORMALMAP_TANGENT_SPACE0 _NORMALMAP_TANGENT_SPACE1 _NORMALMAP_TANGENT_SPACE2
_NORMALMAP_TANGENT_SPACE3
m_ShaderKeywords: _LAYEREDLIT_4_LAYERS _NORMALMAP_TANGENT_SPACE0 _NORMALMAP_TANGENT_SPACE1
_NORMALMAP_TANGENT_SPACE2 _NORMALMAP_TANGENT_SPACE3
m_LightmapFlags: 1
m_EnableInstancingVariants: 0
m_CustomRenderQueue: -1

- _DistortionDepthTest: 0
- _DistortionEnable: 0
- _DistortionOnly: 0
- _DoubleSidedEnable: 0
- _DoubleSidedMirrorEnable: 1
- _DoubleSidedMode: 0
- _DstBlend: 0
- _EmissiveColorMode: 0

- _LayerTiling3: 1
- _LayerTilingBlendMask: 1
- _MaterialID: 0
- _StencilRef: 1
- _Metalic: 0
- _Metalic0: 0
- _Metalic1: 0

- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _StencilRef: 2
- _SurfaceType: 0
- _TexWorldScale: 1
- _TexWorldScale0: 1

- _BaseColor2: {r: 0, g: 1, b: 0, a: 1}
- _BaseColor3: {r: 0, g: 0, b: 1, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _EmissiveColor: {r: 0, g: 0, b: 0, a: 1}
- _EmissiveColor0: {r: 0, g: 0, b: 0, a: 1}

16
Assets/TestScenes/HDTest/LayeredLitTest/Material/Layered_HeightBased.mat


m_PrefabInternal: {fileID: 0}
m_Name: Layered_HeightBased
m_Shader: {fileID: 4800000, guid: 81d02e8644315b742b154842a3a2f98c, type: 3}
m_ShaderKeywords: _ALPHACUTOFFENABLE_OFF _DEPTHOFFSETENABLE_OFF _DETAIL_MAP_WITH_NORMAL
_DISTORTIONDEPTHTEST_OFF _DISTORTIONENABLE_OFF _DISTORTIONONLY_OFF _HEIGHTMAP
_HEIGHTMAP0 _HEIGHTMAP00 _HEIGHTMAP01 _HEIGHTMAP02 _HEIGHTMAP03 _HEIGHTMAP1 _HEIGHTMAP2
_HEIGHTMAP3 _LAYEREDLIT_4_LAYERS _LAYERMASKVERTEXCOLOR_OFF _LAYER_MASK_VERTEX_COLOR_MUL
_MASKMAP _MASKMAP0 _MASKMAP1 _MASKMAP2 _MASKMAP3 _NORMALMAP _NORMALMAP0 _NORMALMAP1
_NORMALMAP2 _NORMALMAP3 _NORMALMAP_TANGENT_SPACE _NORMALMAP_TANGENT_SPACE0 _NORMALMAP_TANGENT_SPACE1
_NORMALMAP_TANGENT_SPACE2 _NORMALMAP_TANGENT_SPACE3
m_ShaderKeywords: _HEIGHTMAP0 _HEIGHTMAP1 _HEIGHTMAP2 _HEIGHTMAP3 _LAYEREDLIT_4_LAYERS
_LAYER_MAPPING_PLANAR1 _LAYER_MAPPING_PLANAR2 _LAYER_MAPPING_PLANAR3 _LAYER_MASK_VERTEX_COLOR_MUL
_MASKMAP0 _MASKMAP1 _MASKMAP2 _MASKMAP3 _NORMALMAP0 _NORMALMAP1 _NORMALMAP2 _NORMALMAP3
_NORMALMAP_TANGENT_SPACE0 _NORMALMAP_TANGENT_SPACE1 _NORMALMAP_TANGENT_SPACE2
_NORMALMAP_TANGENT_SPACE3
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_CustomRenderQueue: -1

- _DistortionDepthTest: 0
- _DistortionEnable: 0
- _DistortionOnly: 0
- _DoubleSidedEnable: 0
- _DoubleSidedMirrorEnable: 1
- _DoubleSidedMode: 0
- _DstBlend: 0
- _EmissiveColorMode: 0

- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _StencilRef: 2
- _SurfaceType: 0
- _TexWorldScale0: 0.1
- _TexWorldScale1: 0.1

- _BaseColor2: {r: 1, g: 1, b: 1, a: 1}
- _BaseColor3: {r: 1, g: 1, b: 1, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _EmissiveColor: {r: 0, g: 0, b: 0, a: 1}
- _UVDetailsMappingMask0: {r: 1, g: 0, b: 0, a: 0}

11
Assets/TestScenes/HDTest/LayeredLitTest/Material/Layered_Layer0_Planar.mat


m_PrefabInternal: {fileID: 0}
m_Name: Layered_Layer0_Planar
m_Shader: {fileID: 4800000, guid: 81d02e8644315b742b154842a3a2f98c, type: 3}
m_ShaderKeywords: _ALPHACUTOFFENABLE_OFF _DETAIL_MAP _DETAIL_MAP0 _DETAIL_MAP1 _DETAIL_MAP_WITH_NORMAL
_DISTORTIONDEPTHTEST_OFF _DISTORTIONONLY_OFF _EMISSION _EMISSIVE_COLOR _LAYER_MASK_VERTEX_COLOR
_LAYER_MASK_VERTEX_COLOR_MUL _NORMALMAP_TANGENT_SPACE _NORMALMAP_TANGENT_SPACE0
_NORMALMAP_TANGENT_SPACE1 _NORMALMAP_TANGENT_SPACE2 _NORMALMAP_TANGENT_SPACE3
m_ShaderKeywords: _DETAIL_MAP0 _DETAIL_MAP1 _LAYER_MAPPING_PLANAR0 _LAYER_MASK_VERTEX_COLOR_MUL
_NORMALMAP_TANGENT_SPACE0 _NORMALMAP_TANGENT_SPACE1 _NORMALMAP_TANGENT_SPACE2
_NORMALMAP_TANGENT_SPACE3
m_LightmapFlags: 1
m_EnableInstancingVariants: 0
m_CustomRenderQueue: -1

- _DistortionDepthTest: 0
- _DistortionEnable: 0
- _DistortionOnly: 0
- _DoubleSidedEnable: 0
- _DoubleSidedMirrorEnable: 1
- _DoubleSidedMode: 0
- _DstBlend: 0
- _EmissiveColorMode: 0

- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _StencilRef: 2
- _SurfaceType: 0
- _TexWorldScale: 1
- _TexWorldScale0: 0.2

- _BaseColor2: {r: 1, g: 1, b: 1, a: 1}
- _BaseColor3: {r: 1, g: 1, b: 1, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _EmissiveColor: {r: 0, g: 0, b: 0, a: 1}
- _UVDetailsMappingMask: {r: 1, g: 0, b: 0, a: 0}

9
Assets/TestScenes/HDTest/LayeredLitTest/Material/Layered_Layer0_Triplanar.mat


m_PrefabInternal: {fileID: 0}
m_Name: Layered_Layer0_Triplanar
m_Shader: {fileID: 4800000, guid: 81d02e8644315b742b154842a3a2f98c, type: 3}
m_ShaderKeywords: _ALPHACUTOFFENABLE_OFF _DETAIL_MAP _DETAIL_MAP0 _DETAIL_MAP1 _DETAIL_MAP_WITH_NORMAL
_DISTORTIONDEPTHTEST_OFF _DISTORTIONONLY_OFF _DOUBLESIDED _EMISSION _EMISSIVE_COLOR
_LAYER_MAPPING_TRIPLANAR0 _LAYER_MAPPING_TRIPLANAR_0 _LAYER_MASK_VERTEX_COLOR
_LAYER_MASK_VERTEX_COLOR_MUL _NORMALMAP_TANGENT_SPACE _NORMALMAP_TANGENT_SPACE0
_NORMALMAP_TANGENT_SPACE1 _NORMALMAP_TANGENT_SPACE2 _NORMALMAP_TANGENT_SPACE3
m_ShaderKeywords: _DETAIL_MAP0 _DETAIL_MAP1 _LAYER_MAPPING_TRIPLANAR0 _LAYER_MASK_VERTEX_COLOR_MUL
_NORMALMAP_TANGENT_SPACE0 _NORMALMAP_TANGENT_SPACE1 _NORMALMAP_TANGENT_SPACE2
_NORMALMAP_TANGENT_SPACE3
m_LightmapFlags: 1
m_EnableInstancingVariants: 0
m_CustomRenderQueue: -1

- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _StencilRef: 2
- _SurfaceType: 0
- _TexWorldScale: 1
- _TexWorldScale0: 0.2

8
Assets/TestScenes/HDTest/LayeredLitTest/Material/Layered_Layer0_UV0.mat


m_PrefabInternal: {fileID: 0}
m_Name: Layered_Layer0_UV0
m_Shader: {fileID: 4800000, guid: 81d02e8644315b742b154842a3a2f98c, type: 3}
m_ShaderKeywords: _ALPHACUTOFFENABLE_OFF _DETAIL_MAP _DETAIL_MAP0 _DETAIL_MAP1 _DETAIL_MAP_WITH_NORMAL
_DISTORTIONDEPTHTEST_OFF _DISTORTIONONLY_OFF _EMISSION _EMISSIVE_COLOR _LAYER_MASK_VERTEX_COLOR
_LAYER_MASK_VERTEX_COLOR_MUL _NORMALMAP_TANGENT_SPACE _NORMALMAP_TANGENT_SPACE0
m_ShaderKeywords: _DETAIL_MAP0 _DETAIL_MAP1 _LAYER_MASK_VERTEX_COLOR_MUL _NORMALMAP_TANGENT_SPACE0
_NORMALMAP_TANGENT_SPACE1 _NORMALMAP_TANGENT_SPACE2 _NORMALMAP_TANGENT_SPACE3
m_LightmapFlags: 1
m_EnableInstancingVariants: 0

- _DistortionDepthTest: 0
- _DistortionEnable: 0
- _DistortionOnly: 0
- _DoubleSidedEnable: 0
- _DoubleSidedMirrorEnable: 1
- _DoubleSidedMode: 0
- _DstBlend: 0
- _EmissiveColorMode: 0

- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _StencilRef: 2
- _SurfaceType: 0
- _TexWorldScale: 1
- _TexWorldScale0: 1

- _BaseColor2: {r: 1, g: 1, b: 1, a: 1}
- _BaseColor3: {r: 1, g: 1, b: 1, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _EmissiveColor: {r: 0, g: 0, b: 0, a: 1}
- _UVDetailsMappingMask: {r: 1, g: 0, b: 0, a: 0}

10
Assets/TestScenes/HDTest/LayeredLitTest/Material/Layered_Layer1_Planar.mat


m_PrefabInternal: {fileID: 0}
m_Name: Layered_Layer1_Planar
m_Shader: {fileID: 4800000, guid: 81d02e8644315b742b154842a3a2f98c, type: 3}
m_ShaderKeywords: _ALPHACUTOFFENABLE_OFF _DETAIL_MAP _DETAIL_MAP0 _DETAIL_MAP1 _DETAIL_MAP_WITH_NORMAL
_DISTORTIONDEPTHTEST_OFF _DISTORTIONONLY_OFF _EMISSION _EMISSIVE_COLOR _LAYER_MAPPING_TRIPLANAR_1
_LAYER_MASK_VERTEX_COLOR _NORMALMAP_TANGENT_SPACE _NORMALMAP_TANGENT_SPACE0 _NORMALMAP_TANGENT_SPACE1
_NORMALMAP_TANGENT_SPACE2 _NORMALMAP_TANGENT_SPACE3
m_ShaderKeywords: _DETAIL_MAP0 _DETAIL_MAP1 _LAYER_MAPPING_PLANAR1 _NORMALMAP_TANGENT_SPACE0
_NORMALMAP_TANGENT_SPACE1 _NORMALMAP_TANGENT_SPACE2 _NORMALMAP_TANGENT_SPACE3
m_LightmapFlags: 1
m_EnableInstancingVariants: 0
m_CustomRenderQueue: -1

- _DistortionDepthTest: 0
- _DistortionEnable: 0
- _DistortionOnly: 0
- _DoubleSidedEnable: 0
- _DoubleSidedMirrorEnable: 1
- _DoubleSidedMode: 0
- _DstBlend: 0
- _EmissiveColorMode: 0

- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _StencilRef: 2
- _SurfaceType: 0
- _TexWorldScale: 1
- _TexWorldScale0: 1

- _BaseColor2: {r: 1, g: 1, b: 1, a: 1}
- _BaseColor3: {r: 1, g: 1, b: 1, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _EmissiveColor: {r: 0, g: 0, b: 0, a: 1}
- _UVDetailsMappingMask: {r: 1, g: 0, b: 0, a: 0}

8
Assets/TestScenes/HDTest/LayeredLitTest/Material/Layered_Layer1_Triplanar.mat


m_PrefabInternal: {fileID: 0}
m_Name: Layered_Layer1_Triplanar
m_Shader: {fileID: 4800000, guid: 81d02e8644315b742b154842a3a2f98c, type: 3}
m_ShaderKeywords: _ALPHACUTOFFENABLE_OFF _DETAIL_MAP _DETAIL_MAP0 _DETAIL_MAP1 _DETAIL_MAP_WITH_NORMAL
_DISTORTIONDEPTHTEST_OFF _DISTORTIONONLY_OFF _DOUBLESIDED _EMISSION _EMISSIVE_COLOR
_LAYER_MAPPING_TRIPLANAR1 _LAYER_MAPPING_TRIPLANAR_1 _LAYER_MASK_VERTEX_COLOR
_NORMALMAP_TANGENT_SPACE _NORMALMAP_TANGENT_SPACE0 _NORMALMAP_TANGENT_SPACE1 _NORMALMAP_TANGENT_SPACE2
_NORMALMAP_TANGENT_SPACE3
m_ShaderKeywords: _DETAIL_MAP0 _DETAIL_MAP1 _LAYER_MAPPING_TRIPLANAR1 _NORMALMAP_TANGENT_SPACE0
_NORMALMAP_TANGENT_SPACE1 _NORMALMAP_TANGENT_SPACE2 _NORMALMAP_TANGENT_SPACE3
m_LightmapFlags: 1
m_EnableInstancingVariants: 0
m_CustomRenderQueue: -1

- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _StencilRef: 2
- _SurfaceType: 0
- _TexWorldScale: 1
- _TexWorldScale0: 1

10
Assets/TestScenes/HDTest/LayeredLitTest/Material/Layered_Layer1_UV0.mat


m_PrefabInternal: {fileID: 0}
m_Name: Layered_Layer1_UV0
m_Shader: {fileID: 4800000, guid: 81d02e8644315b742b154842a3a2f98c, type: 3}
m_ShaderKeywords: _ALPHACUTOFFENABLE_OFF _DETAIL_MAP _DETAIL_MAP0 _DETAIL_MAP1 _DETAIL_MAP_WITH_NORMAL
_DISTORTIONDEPTHTEST_OFF _DISTORTIONONLY_OFF _EMISSION _EMISSIVE_COLOR _LAYER_MASK_VERTEX_COLOR
_NORMALMAP_TANGENT_SPACE _NORMALMAP_TANGENT_SPACE0 _NORMALMAP_TANGENT_SPACE1 _NORMALMAP_TANGENT_SPACE2
_NORMALMAP_TANGENT_SPACE3
m_ShaderKeywords: _DETAIL_MAP0 _DETAIL_MAP1 _NORMALMAP_TANGENT_SPACE0 _NORMALMAP_TANGENT_SPACE1
_NORMALMAP_TANGENT_SPACE2 _NORMALMAP_TANGENT_SPACE3
m_LightmapFlags: 1
m_EnableInstancingVariants: 0
m_CustomRenderQueue: -1

- _DistortionDepthTest: 0
- _DistortionEnable: 0
- _DistortionOnly: 0
- _DoubleSidedEnable: 0
- _DoubleSidedMirrorEnable: 1
- _DoubleSidedMode: 0
- _DstBlend: 0
- _EmissiveColorMode: 0

- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _StencilRef: 2
- _SurfaceType: 0
- _TexWorldScale: 1
- _TexWorldScale0: 1

- _BaseColor2: {r: 1, g: 1, b: 1, a: 1}
- _BaseColor3: {r: 1, g: 1, b: 1, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _EmissiveColor: {r: 0, g: 0, b: 0, a: 1}
- _UVDetailsMappingMask: {r: 1, g: 0, b: 0, a: 0}

10
Assets/TestScenes/HDTest/LayeredLitTest/Material/Layered_Layer1_UV1.mat


m_PrefabInternal: {fileID: 0}
m_Name: Layered_Layer1_UV1
m_Shader: {fileID: 4800000, guid: 81d02e8644315b742b154842a3a2f98c, type: 3}
m_ShaderKeywords: _ALPHACUTOFFENABLE_OFF _DETAIL_MAP _DETAIL_MAP0 _DETAIL_MAP1 _DETAIL_MAP_WITH_NORMAL
_DISTORTIONDEPTHTEST_OFF _DISTORTIONONLY_OFF _EMISSION _EMISSIVE_COLOR _LAYER_MASK_VERTEX_COLOR
_NORMALMAP_TANGENT_SPACE _NORMALMAP_TANGENT_SPACE0 _NORMALMAP_TANGENT_SPACE1 _NORMALMAP_TANGENT_SPACE2
_NORMALMAP_TANGENT_SPACE3
m_ShaderKeywords: _DETAIL_MAP0 _DETAIL_MAP1 _NORMALMAP_TANGENT_SPACE0 _NORMALMAP_TANGENT_SPACE1
_NORMALMAP_TANGENT_SPACE2 _NORMALMAP_TANGENT_SPACE3
m_LightmapFlags: 1
m_EnableInstancingVariants: 0
m_CustomRenderQueue: -1

- _DistortionDepthTest: 0
- _DistortionEnable: 0
- _DistortionOnly: 0
- _DoubleSidedEnable: 0
- _DoubleSidedMirrorEnable: 1
- _DoubleSidedMode: 0
- _DstBlend: 0
- _EmissiveColorMode: 0

- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _StencilRef: 2
- _SurfaceType: 0
- _TexWorldScale: 1
- _TexWorldScale0: 1

- _BaseColor2: {r: 1, g: 1, b: 1, a: 1}
- _BaseColor3: {r: 1, g: 1, b: 1, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _EmissiveColor: {r: 0, g: 0, b: 0, a: 1}
- _UVDetailsMappingMask: {r: 1, g: 0, b: 0, a: 0}

10
Assets/TestScenes/HDTest/LayeredLitTest/Material/Layered_Layer1_UV2.mat


m_PrefabInternal: {fileID: 0}
m_Name: Layered_Layer1_UV2
m_Shader: {fileID: 4800000, guid: 81d02e8644315b742b154842a3a2f98c, type: 3}
m_ShaderKeywords: _ALPHACUTOFFENABLE_OFF _DETAIL_MAP _DETAIL_MAP0 _DETAIL_MAP1 _DETAIL_MAP_WITH_NORMAL
_DISTORTIONDEPTHTEST_OFF _DISTORTIONONLY_OFF _EMISSION _EMISSIVE_COLOR _LAYER_MASK_VERTEX_COLOR
_NORMALMAP_TANGENT_SPACE _NORMALMAP_TANGENT_SPACE0 _NORMALMAP_TANGENT_SPACE1 _NORMALMAP_TANGENT_SPACE2
_NORMALMAP_TANGENT_SPACE3 _REQUIRE_UV2 _REQUIRE_UV2_OR_UV3
m_ShaderKeywords: _DETAIL_MAP0 _DETAIL_MAP1 _NORMALMAP_TANGENT_SPACE0 _NORMALMAP_TANGENT_SPACE1
_NORMALMAP_TANGENT_SPACE2 _NORMALMAP_TANGENT_SPACE3 _REQUIRE_UV2
m_LightmapFlags: 1
m_EnableInstancingVariants: 0
m_CustomRenderQueue: -1

- _DistortionDepthTest: 0
- _DistortionEnable: 0
- _DistortionOnly: 0
- _DoubleSidedEnable: 0
- _DoubleSidedMirrorEnable: 1
- _DoubleSidedMode: 0
- _DstBlend: 0
- _EmissiveColorMode: 0

- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _StencilRef: 2
- _SurfaceType: 0
- _TexWorldScale: 1
- _TexWorldScale0: 1

- _BaseColor2: {r: 1, g: 1, b: 1, a: 1}
- _BaseColor3: {r: 1, g: 1, b: 1, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _EmissiveColor: {r: 0, g: 0, b: 0, a: 1}
- _UVDetailsMappingMask: {r: 1, g: 0, b: 0, a: 0}

10
Assets/TestScenes/HDTest/LayeredLitTest/Material/Layered_Layer1_UV3.mat


m_PrefabInternal: {fileID: 0}
m_Name: Layered_Layer1_UV3
m_Shader: {fileID: 4800000, guid: 81d02e8644315b742b154842a3a2f98c, type: 3}
m_ShaderKeywords: _ALPHACUTOFFENABLE_OFF _DETAIL_MAP _DETAIL_MAP0 _DETAIL_MAP1 _DETAIL_MAP_WITH_NORMAL
_DISTORTIONDEPTHTEST_OFF _DISTORTIONONLY_OFF _EMISSION _EMISSIVE_COLOR _LAYER_MASK_VERTEX_COLOR
_NORMALMAP_TANGENT_SPACE _NORMALMAP_TANGENT_SPACE0 _NORMALMAP_TANGENT_SPACE1 _NORMALMAP_TANGENT_SPACE2
_NORMALMAP_TANGENT_SPACE3 _REQUIRE_UV2_OR_UV3 _REQUIRE_UV3
m_ShaderKeywords: _DETAIL_MAP0 _DETAIL_MAP1 _NORMALMAP_TANGENT_SPACE0 _NORMALMAP_TANGENT_SPACE1
_NORMALMAP_TANGENT_SPACE2 _NORMALMAP_TANGENT_SPACE3 _REQUIRE_UV3
m_LightmapFlags: 1
m_EnableInstancingVariants: 0
m_CustomRenderQueue: -1

- _DistortionDepthTest: 0
- _DistortionEnable: 0
- _DistortionOnly: 0
- _DoubleSidedEnable: 0
- _DoubleSidedMirrorEnable: 1
- _DoubleSidedMode: 0
- _DstBlend: 0
- _EmissiveColorMode: 0

- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _StencilRef: 2
- _SurfaceType: 0
- _TexWorldScale: 1
- _TexWorldScale0: 1

- _BaseColor2: {r: 1, g: 1, b: 1, a: 1}
- _BaseColor3: {r: 1, g: 1, b: 1, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _EmissiveColor: {r: 0, g: 0, b: 0, a: 1}
- _UVDetailsMappingMask: {r: 1, g: 0, b: 0, a: 0}

10
Assets/TestScenes/HDTest/LayeredLitTest/Material/Layered_Layer2_Planar.mat


m_PrefabInternal: {fileID: 0}
m_Name: Layered_Layer2_Planar
m_Shader: {fileID: 4800000, guid: 81d02e8644315b742b154842a3a2f98c, type: 3}
m_ShaderKeywords: _ALPHACUTOFFENABLE_OFF _DETAIL_MAP _DETAIL_MAP0 _DETAIL_MAP1 _DETAIL_MAP2
_DETAIL_MAP_WITH_NORMAL _DISTORTIONDEPTHTEST_OFF _DISTORTIONONLY_OFF _EMISSION
_EMISSIVE_COLOR _LAYEREDLIT_3_LAYERS _LAYER_MAPPING_TRIPLANAR_2 _LAYER_MASK_VERTEX_COLOR
_NORMALMAP_TANGENT_SPACE _NORMALMAP_TANGENT_SPACE0 _NORMALMAP_TANGENT_SPACE1 _NORMALMAP_TANGENT_SPACE2
m_ShaderKeywords: _DETAIL_MAP0 _DETAIL_MAP1 _DETAIL_MAP2 _LAYEREDLIT_3_LAYERS _LAYER_MAPPING_PLANAR2
_NORMALMAP_TANGENT_SPACE0 _NORMALMAP_TANGENT_SPACE1 _NORMALMAP_TANGENT_SPACE2
_NORMALMAP_TANGENT_SPACE3
m_LightmapFlags: 1
m_EnableInstancingVariants: 0

- _DistortionDepthTest: 0
- _DistortionEnable: 0
- _DistortionOnly: 0
- _DoubleSidedEnable: 0
- _DoubleSidedMirrorEnable: 1
- _DoubleSidedMode: 0
- _DstBlend: 0
- _EmissiveColorMode: 0

- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _StencilRef: 2
- _SurfaceType: 0
- _TexWorldScale: 1
- _TexWorldScale0: 1

- _BaseColor2: {r: 0.61764705, g: 1, b: 0.74685603, a: 1}
- _BaseColor3: {r: 1, g: 1, b: 1, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _EmissiveColor: {r: 0, g: 0, b: 0, a: 1}
- _UVDetailsMappingMask: {r: 1, g: 0, b: 0, a: 0}

9
Assets/TestScenes/HDTest/LayeredLitTest/Material/Layered_Layer2_Triplanar.mat


m_PrefabInternal: {fileID: 0}
m_Name: Layered_Layer2_Triplanar
m_Shader: {fileID: 4800000, guid: 81d02e8644315b742b154842a3a2f98c, type: 3}
m_ShaderKeywords: _ALPHACUTOFFENABLE_OFF _DETAIL_MAP _DETAIL_MAP0 _DETAIL_MAP1 _DETAIL_MAP2
_DETAIL_MAP_WITH_NORMAL _DISTORTIONDEPTHTEST_OFF _DISTORTIONONLY_OFF _DOUBLESIDED
_EMISSION _EMISSIVE_COLOR _LAYEREDLIT_3_LAYERS _LAYER_MAPPING_TRIPLANAR2 _LAYER_MAPPING_TRIPLANAR_2
_LAYER_MASK_VERTEX_COLOR _NORMALMAP_TANGENT_SPACE _NORMALMAP_TANGENT_SPACE0 _NORMALMAP_TANGENT_SPACE1
_NORMALMAP_TANGENT_SPACE2 _NORMALMAP_TANGENT_SPACE3
m_ShaderKeywords: _DETAIL_MAP0 _DETAIL_MAP1 _DETAIL_MAP2 _LAYEREDLIT_3_LAYERS _LAYER_MAPPING_TRIPLANAR2
_NORMALMAP_TANGENT_SPACE0 _NORMALMAP_TANGENT_SPACE1 _NORMALMAP_TANGENT_SPACE2
_NORMALMAP_TANGENT_SPACE3
m_LightmapFlags: 1
m_EnableInstancingVariants: 0
m_CustomRenderQueue: -1

- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _StencilRef: 2
- _SurfaceType: 0
- _TexWorldScale: 1
- _TexWorldScale0: 1

11
Assets/TestScenes/HDTest/LayeredLitTest/Material/Layered_Layer2_UV0.mat


m_PrefabInternal: {fileID: 0}
m_Name: Layered_Layer2_UV0
m_Shader: {fileID: 4800000, guid: 81d02e8644315b742b154842a3a2f98c, type: 3}
m_ShaderKeywords: _ALPHACUTOFFENABLE_OFF _DETAIL_MAP _DETAIL_MAP0 _DETAIL_MAP1 _DETAIL_MAP2
_DETAIL_MAP_WITH_NORMAL _DISTORTIONDEPTHTEST_OFF _DISTORTIONONLY_OFF _EMISSION
_EMISSIVE_COLOR _LAYEREDLIT_3_LAYERS _LAYER_MASK_VERTEX_COLOR _NORMALMAP_TANGENT_SPACE
_NORMALMAP_TANGENT_SPACE0 _NORMALMAP_TANGENT_SPACE1 _NORMALMAP_TANGENT_SPACE2
_NORMALMAP_TANGENT_SPACE3
m_ShaderKeywords: _DETAIL_MAP0 _DETAIL_MAP1 _DETAIL_MAP2 _LAYEREDLIT_3_LAYERS _NORMALMAP_TANGENT_SPACE0
_NORMALMAP_TANGENT_SPACE1 _NORMALMAP_TANGENT_SPACE2 _NORMALMAP_TANGENT_SPACE3
m_LightmapFlags: 1
m_EnableInstancingVariants: 0
m_CustomRenderQueue: -1

- _DistortionDepthTest: 0
- _DistortionEnable: 0
- _DistortionOnly: 0
- _DoubleSidedEnable: 0
- _DoubleSidedMirrorEnable: 1
- _DoubleSidedMode: 0
- _DstBlend: 0
- _EmissiveColorMode: 0

- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _StencilRef: 2
- _SurfaceType: 0
- _TexWorldScale: 1
- _TexWorldScale0: 1

- _BaseColor2: {r: 0.61764705, g: 1, b: 0.74685603, a: 1}
- _BaseColor3: {r: 1, g: 1, b: 1, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _EmissiveColor: {r: 0, g: 0, b: 0, a: 1}
- _UVDetailsMappingMask: {r: 1, g: 0, b: 0, a: 0}

11
Assets/TestScenes/HDTest/LayeredLitTest/Material/Layered_Layer2_UV1.mat


m_PrefabInternal: {fileID: 0}
m_Name: Layered_Layer2_UV1
m_Shader: {fileID: 4800000, guid: 81d02e8644315b742b154842a3a2f98c, type: 3}
m_ShaderKeywords: _ALPHACUTOFFENABLE_OFF _DETAIL_MAP _DETAIL_MAP0 _DETAIL_MAP1 _DETAIL_MAP2
_DETAIL_MAP_WITH_NORMAL _DISTORTIONDEPTHTEST_OFF _DISTORTIONONLY_OFF _EMISSION
_EMISSIVE_COLOR _LAYEREDLIT_3_LAYERS _LAYER_MASK_VERTEX_COLOR _NORMALMAP_TANGENT_SPACE
_NORMALMAP_TANGENT_SPACE0 _NORMALMAP_TANGENT_SPACE1 _NORMALMAP_TANGENT_SPACE2
_NORMALMAP_TANGENT_SPACE3
m_ShaderKeywords: _DETAIL_MAP0 _DETAIL_MAP1 _DETAIL_MAP2 _LAYEREDLIT_3_LAYERS _NORMALMAP_TANGENT_SPACE0
_NORMALMAP_TANGENT_SPACE1 _NORMALMAP_TANGENT_SPACE2 _NORMALMAP_TANGENT_SPACE3
m_LightmapFlags: 1
m_EnableInstancingVariants: 0
m_CustomRenderQueue: -1

- _DistortionDepthTest: 0
- _DistortionEnable: 0
- _DistortionOnly: 0
- _DoubleSidedEnable: 0
- _DoubleSidedMirrorEnable: 1
- _DoubleSidedMode: 0
- _DstBlend: 0
- _EmissiveColorMode: 0

- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _StencilRef: 2
- _SurfaceType: 0
- _TexWorldScale: 1
- _TexWorldScale0: 1

- _BaseColor2: {r: 0.61764705, g: 1, b: 0.74685603, a: 1}
- _BaseColor3: {r: 1, g: 1, b: 1, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _EmissiveColor: {r: 0, g: 0, b: 0, a: 1}
- _UVDetailsMappingMask: {r: 1, g: 0, b: 0, a: 0}

12
Assets/TestScenes/HDTest/LayeredLitTest/Material/Layered_Layer2_UV2.mat


m_PrefabInternal: {fileID: 0}
m_Name: Layered_Layer2_UV2
m_Shader: {fileID: 4800000, guid: 81d02e8644315b742b154842a3a2f98c, type: 3}
m_ShaderKeywords: _ALPHACUTOFFENABLE_OFF _DETAIL_MAP _DETAIL_MAP0 _DETAIL_MAP1 _DETAIL_MAP2
_DETAIL_MAP_WITH_NORMAL _DISTORTIONDEPTHTEST_OFF _DISTORTIONONLY_OFF _EMISSION
_EMISSIVE_COLOR _LAYEREDLIT_3_LAYERS _LAYER_MASK_VERTEX_COLOR _NORMALMAP_TANGENT_SPACE
_NORMALMAP_TANGENT_SPACE0 _NORMALMAP_TANGENT_SPACE1 _NORMALMAP_TANGENT_SPACE2
_NORMALMAP_TANGENT_SPACE3 _REQUIRE_UV2 _REQUIRE_UV2_OR_UV3
m_ShaderKeywords: _DETAIL_MAP0 _DETAIL_MAP1 _DETAIL_MAP2 _LAYEREDLIT_3_LAYERS _NORMALMAP_TANGENT_SPACE0
_NORMALMAP_TANGENT_SPACE1 _NORMALMAP_TANGENT_SPACE2 _NORMALMAP_TANGENT_SPACE3
_REQUIRE_UV2
m_LightmapFlags: 1
m_EnableInstancingVariants: 0
m_CustomRenderQueue: -1

- _DistortionDepthTest: 0
- _DistortionEnable: 0
- _DistortionOnly: 0
- _DoubleSidedEnable: 0
- _DoubleSidedMirrorEnable: 1
- _DoubleSidedMode: 0
- _DstBlend: 0
- _EmissiveColorMode: 0

- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _StencilRef: 2
- _SurfaceType: 0
- _TexWorldScale: 1
- _TexWorldScale0: 1

- _BaseColor2: {r: 0.61764705, g: 1, b: 0.74685603, a: 1}
- _BaseColor3: {r: 1, g: 1, b: 1, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _EmissiveColor: {r: 0, g: 0, b: 0, a: 1}
- _UVDetailsMappingMask: {r: 1, g: 0, b: 0, a: 0}

12
Assets/TestScenes/HDTest/LayeredLitTest/Material/Layered_Layer2_UV3.mat


m_PrefabInternal: {fileID: 0}
m_Name: Layered_Layer2_UV3
m_Shader: {fileID: 4800000, guid: 81d02e8644315b742b154842a3a2f98c, type: 3}
m_ShaderKeywords: _ALPHACUTOFFENABLE_OFF _DETAIL_MAP _DETAIL_MAP0 _DETAIL_MAP1 _DETAIL_MAP2
_DETAIL_MAP_WITH_NORMAL _DISTORTIONDEPTHTEST_OFF _DISTORTIONONLY_OFF _EMISSION
_EMISSIVE_COLOR _LAYEREDLIT_3_LAYERS _LAYER_MASK_VERTEX_COLOR _NORMALMAP_TANGENT_SPACE
_NORMALMAP_TANGENT_SPACE0 _NORMALMAP_TANGENT_SPACE1 _NORMALMAP_TANGENT_SPACE2
_NORMALMAP_TANGENT_SPACE3 _REQUIRE_UV2_OR_UV3 _REQUIRE_UV3
m_ShaderKeywords: _DETAIL_MAP0 _DETAIL_MAP1 _DETAIL_MAP2 _LAYEREDLIT_3_LAYERS _NORMALMAP_TANGENT_SPACE0
_NORMALMAP_TANGENT_SPACE1 _NORMALMAP_TANGENT_SPACE2 _NORMALMAP_TANGENT_SPACE3
_REQUIRE_UV3
m_LightmapFlags: 1
m_EnableInstancingVariants: 0
m_CustomRenderQueue: -1

- _DistortionDepthTest: 0
- _DistortionEnable: 0
- _DistortionOnly: 0
- _DoubleSidedEnable: 0
- _DoubleSidedMirrorEnable: 1
- _DoubleSidedMode: 0
- _DstBlend: 0
- _EmissiveColorMode: 0

- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _StencilRef: 2
- _SurfaceType: 0
- _TexWorldScale: 1
- _TexWorldScale0: 1

- _BaseColor2: {r: 0.61764705, g: 1, b: 0.74685603, a: 1}
- _BaseColor3: {r: 1, g: 1, b: 1, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _EmissiveColor: {r: 0, g: 0, b: 0, a: 1}
- _UVDetailsMappingMask: {r: 1, g: 0, b: 0, a: 0}

10
Assets/TestScenes/HDTest/LayeredLitTest/Material/Layered_Layer3_Planar.mat


m_PrefabInternal: {fileID: 0}
m_Name: Layered_Layer3_Planar
m_Shader: {fileID: 4800000, guid: 81d02e8644315b742b154842a3a2f98c, type: 3}
m_ShaderKeywords: _ALPHACUTOFFENABLE_OFF _DETAIL_MAP _DETAIL_MAP0 _DETAIL_MAP1 _DETAIL_MAP2
_DETAIL_MAP3 _DETAIL_MAP_WITH_NORMAL _DISTORTIONDEPTHTEST_OFF _DISTORTIONONLY_OFF
_EMISSION _EMISSIVE_COLOR _LAYEREDLIT_4_LAYERS _LAYER_MAPPING_TRIPLANAR_3 _LAYER_MASK_VERTEX_COLOR
_NORMALMAP_TANGENT_SPACE _NORMALMAP_TANGENT_SPACE0 _NORMALMAP_TANGENT_SPACE1 _NORMALMAP_TANGENT_SPACE2
m_ShaderKeywords: _DETAIL_MAP0 _DETAIL_MAP1 _DETAIL_MAP2 _DETAIL_MAP3 _LAYEREDLIT_4_LAYERS
_LAYER_MAPPING_PLANAR3 _NORMALMAP_TANGENT_SPACE0 _NORMALMAP_TANGENT_SPACE1 _NORMALMAP_TANGENT_SPACE2
_NORMALMAP_TANGENT_SPACE3
m_LightmapFlags: 1
m_EnableInstancingVariants: 0

- _DistortionDepthTest: 0
- _DistortionEnable: 0
- _DistortionOnly: 0
- _DoubleSidedEnable: 0
- _DoubleSidedMirrorEnable: 1
- _DoubleSidedMode: 0
- _DstBlend: 0
- _EmissiveColorMode: 0

- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _StencilRef: 2
- _SurfaceType: 0
- _TexWorldScale: 1
- _TexWorldScale0: 1

- _BaseColor2: {r: 1, g: 1, b: 1, a: 1}
- _BaseColor3: {r: 0.6602435, g: 0.63235295, b: 1, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _EmissiveColor: {r: 0, g: 0, b: 0, a: 1}
- _UVDetailsMappingMask: {r: 1, g: 0, b: 0, a: 0}

9
Assets/TestScenes/HDTest/LayeredLitTest/Material/Layered_Layer3_Triplanar.mat


m_PrefabInternal: {fileID: 0}
m_Name: Layered_Layer3_Triplanar
m_Shader: {fileID: 4800000, guid: 81d02e8644315b742b154842a3a2f98c, type: 3}
m_ShaderKeywords: _ALPHACUTOFFENABLE_OFF _DETAIL_MAP _DETAIL_MAP0 _DETAIL_MAP1 _DETAIL_MAP2
_DETAIL_MAP3 _DETAIL_MAP_WITH_NORMAL _DISTORTIONDEPTHTEST_OFF _DISTORTIONONLY_OFF
_DOUBLESIDED _EMISSION _EMISSIVE_COLOR _LAYEREDLIT_4_LAYERS _LAYER_MAPPING_TRIPLANAR3
_LAYER_MAPPING_TRIPLANAR_3 _LAYER_MASK_VERTEX_COLOR _NORMALMAP_TANGENT_SPACE _NORMALMAP_TANGENT_SPACE0
_NORMALMAP_TANGENT_SPACE1 _NORMALMAP_TANGENT_SPACE2 _NORMALMAP_TANGENT_SPACE3
m_ShaderKeywords: _DETAIL_MAP0 _DETAIL_MAP1 _DETAIL_MAP2 _DETAIL_MAP3 _LAYEREDLIT_4_LAYERS
_LAYER_MAPPING_TRIPLANAR3 _NORMALMAP_TANGENT_SPACE0 _NORMALMAP_TANGENT_SPACE1
_NORMALMAP_TANGENT_SPACE2 _NORMALMAP_TANGENT_SPACE3
m_LightmapFlags: 1
m_EnableInstancingVariants: 0
m_CustomRenderQueue: -1

- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _StencilRef: 2
- _SurfaceType: 0
- _TexWorldScale: 1
- _TexWorldScale0: 1

8
Assets/TestScenes/HDTest/LayeredLitTest/Material/Layered_Layer3_UV0.mat


m_PrefabInternal: {fileID: 0}
m_Name: Layered_Layer3_UV0
m_Shader: {fileID: 4800000, guid: 81d02e8644315b742b154842a3a2f98c, type: 3}
m_ShaderKeywords: _ALPHACUTOFFENABLE_OFF _DETAIL_MAP _DETAIL_MAP0 _DETAIL_MAP1 _DETAIL_MAP2
_DETAIL_MAP3 _DETAIL_MAP_WITH_NORMAL _DISTORTIONDEPTHTEST_OFF _DISTORTIONONLY_OFF
_EMISSION _EMISSIVE_COLOR _LAYEREDLIT_4_LAYERS _LAYER_MASK_VERTEX_COLOR _NORMALMAP_TANGENT_SPACE
m_ShaderKeywords: _DETAIL_MAP0 _DETAIL_MAP1 _DETAIL_MAP2 _DETAIL_MAP3 _LAYEREDLIT_4_LAYERS
_NORMALMAP_TANGENT_SPACE0 _NORMALMAP_TANGENT_SPACE1 _NORMALMAP_TANGENT_SPACE2
_NORMALMAP_TANGENT_SPACE3
m_LightmapFlags: 1

- _DistortionDepthTest: 0
- _DistortionEnable: 0
- _DistortionOnly: 0
- _DoubleSidedEnable: 0
- _DoubleSidedMirrorEnable: 1
- _DoubleSidedMode: 0
- _DstBlend: 0
- _EmissiveColorMode: 0

- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _StencilRef: 2
- _SurfaceType: 0
- _TexWorldScale: 1
- _TexWorldScale0: 1

- _BaseColor2: {r: 1, g: 1, b: 1, a: 1}
- _BaseColor3: {r: 0.6602435, g: 0.63235295, b: 1, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _EmissiveColor: {r: 0, g: 0, b: 0, a: 1}
- _UVDetailsMappingMask: {r: 1, g: 0, b: 0, a: 0}

8
Assets/TestScenes/HDTest/LayeredLitTest/Material/Layered_Layer3_UV1.mat


m_PrefabInternal: {fileID: 0}
m_Name: Layered_Layer3_UV1
m_Shader: {fileID: 4800000, guid: 81d02e8644315b742b154842a3a2f98c, type: 3}
m_ShaderKeywords: _ALPHACUTOFFENABLE_OFF _DETAIL_MAP _DETAIL_MAP0 _DETAIL_MAP1 _DETAIL_MAP2
_DETAIL_MAP3 _DETAIL_MAP_WITH_NORMAL _DISTORTIONDEPTHTEST_OFF _DISTORTIONONLY_OFF
_EMISSION _EMISSIVE_COLOR _LAYEREDLIT_4_LAYERS _LAYER_MASK_VERTEX_COLOR _NORMALMAP_TANGENT_SPACE
m_ShaderKeywords: _DETAIL_MAP0 _DETAIL_MAP1 _DETAIL_MAP2 _DETAIL_MAP3 _LAYEREDLIT_4_LAYERS
_NORMALMAP_TANGENT_SPACE0 _NORMALMAP_TANGENT_SPACE1 _NORMALMAP_TANGENT_SPACE2
_NORMALMAP_TANGENT_SPACE3
m_LightmapFlags: 1

- _DistortionDepthTest: 0
- _DistortionEnable: 0
- _DistortionOnly: 0
- _DoubleSidedEnable: 0
- _DoubleSidedMirrorEnable: 1
- _DoubleSidedMode: 0
- _DstBlend: 0
- _EmissiveColorMode: 0

- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _StencilRef: 2
- _SurfaceType: 0
- _TexWorldScale: 1
- _TexWorldScale0: 1

- _BaseColor2: {r: 1, g: 1, b: 1, a: 1}
- _BaseColor3: {r: 0.6602435, g: 0.63235295, b: 1, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _EmissiveColor: {r: 0, g: 0, b: 0, a: 1}
- _UVDetailsMappingMask: {r: 1, g: 0, b: 0, a: 0}

10
Assets/TestScenes/HDTest/LayeredLitTest/Material/Layered_Layer3_UV2.mat


m_PrefabInternal: {fileID: 0}
m_Name: Layered_Layer3_UV2
m_Shader: {fileID: 4800000, guid: 81d02e8644315b742b154842a3a2f98c, type: 3}
m_ShaderKeywords: _ALPHACUTOFFENABLE_OFF _DETAIL_MAP _DETAIL_MAP0 _DETAIL_MAP1 _DETAIL_MAP2
_DETAIL_MAP3 _DETAIL_MAP_WITH_NORMAL _DISTORTIONDEPTHTEST_OFF _DISTORTIONONLY_OFF
_EMISSION _EMISSIVE_COLOR _LAYEREDLIT_4_LAYERS _LAYER_MASK_VERTEX_COLOR _NORMALMAP_TANGENT_SPACE
m_ShaderKeywords: _DETAIL_MAP0 _DETAIL_MAP1 _DETAIL_MAP2 _DETAIL_MAP3 _LAYEREDLIT_4_LAYERS
_NORMALMAP_TANGENT_SPACE3 _REQUIRE_UV2 _REQUIRE_UV2_OR_UV3
_NORMALMAP_TANGENT_SPACE3 _REQUIRE_UV2
m_LightmapFlags: 1
m_EnableInstancingVariants: 0
m_CustomRenderQueue: -1

- _DistortionDepthTest: 0
- _DistortionEnable: 0
- _DistortionOnly: 0
- _DoubleSidedEnable: 0
- _DoubleSidedMirrorEnable: 1
- _DoubleSidedMode: 0
- _DstBlend: 0
- _EmissiveColorMode: 0

- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _StencilRef: 2
- _SurfaceType: 0
- _TexWorldScale: 1
- _TexWorldScale0: 1

- _BaseColor2: {r: 1, g: 1, b: 1, a: 1}
- _BaseColor3: {r: 0.6602435, g: 0.63235295, b: 1, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _EmissiveColor: {r: 0, g: 0, b: 0, a: 1}
- _UVDetailsMappingMask: {r: 1, g: 0, b: 0, a: 0}

10
Assets/TestScenes/HDTest/LayeredLitTest/Material/Layered_Layer3_UV3.mat


m_PrefabInternal: {fileID: 0}
m_Name: Layered_Layer3_UV3
m_Shader: {fileID: 4800000, guid: 81d02e8644315b742b154842a3a2f98c, type: 3}
m_ShaderKeywords: _ALPHACUTOFFENABLE_OFF _DETAIL_MAP _DETAIL_MAP0 _DETAIL_MAP1 _DETAIL_MAP2
_DETAIL_MAP3 _DETAIL_MAP_WITH_NORMAL _DISTORTIONDEPTHTEST_OFF _DISTORTIONONLY_OFF
_EMISSION _EMISSIVE_COLOR _LAYEREDLIT_4_LAYERS _LAYER_MASK_VERTEX_COLOR _NORMALMAP_TANGENT_SPACE
m_ShaderKeywords: _DETAIL_MAP0 _DETAIL_MAP1 _DETAIL_MAP2 _DETAIL_MAP3 _LAYEREDLIT_4_LAYERS
_NORMALMAP_TANGENT_SPACE3 _REQUIRE_UV2_OR_UV3 _REQUIRE_UV3
_NORMALMAP_TANGENT_SPACE3 _REQUIRE_UV3
m_LightmapFlags: 1
m_EnableInstancingVariants: 0
m_CustomRenderQueue: -1

- _DistortionDepthTest: 0
- _DistortionEnable: 0
- _DistortionOnly: 0
- _DoubleSidedEnable: 0
- _DoubleSidedMirrorEnable: 1
- _DoubleSidedMode: 0
- _DstBlend: 0
- _EmissiveColorMode: 0

- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _StencilRef: 2
- _SurfaceType: 0
- _TexWorldScale: 1
- _TexWorldScale0: 1

- _BaseColor2: {r: 1, g: 1, b: 1, a: 1}
- _BaseColor3: {r: 0.6602435, g: 0.63235295, b: 1, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _EmissiveColor: {r: 0, g: 0, b: 0, a: 1}
- _UVDetailsMappingMask: {r: 1, g: 0, b: 0, a: 0}

38
Assets/TestScenes/HDTest/LayeredLitTest/Material/Lit_UVChart_Layer0_Detail.mat


m_PrefabInternal: {fileID: 0}
m_Name: Lit_UVChart_Layer0_Detail
m_Shader: {fileID: 4800000, guid: 6e4ae4064600d784cac1e41a9e6f2e59, type: 3}
m_ShaderKeywords: _ALPHACUTOFFENABLE_OFF _DETAIL_MAP _DETAIL_MAP_WITH_NORMAL _DISTORTIONDEPTHTEST_OFF
_DISTORTIONONLY_OFF _EMISSION _NORMALMAP _NORMALMAP_TANGENT_SPACE
m_ShaderKeywords: _DETAIL_MAP _NORMALMAP _NORMALMAP_TANGENT_SPACE
m_EnableInstancingVariants: 0
disabledShaderPasses: []
disabledShaderPasses:
- DistortionVectors
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:

m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DistortionVectorMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}

m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SubsurfaceRadiusMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ThicknessMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}

- _BumpScale: 1
- _CullMode: 2
- _Cutoff: 0.5
- _DepthOffsetEnable: 0
- _DetailAOScale: 1
- _DetailAlbedoScale: 1
- _DetailHeightScale: 1

- _DetailSmoothnessScale: 1
- _DistortionDepthTest: 0
- _DistortionEnable: 0
- _DoubleSidedEnable: 0
- _DoubleSidedMirrorEnable: 1
- _EnablePerPixelDisplacement: 0
- _HeightAmplitude: 0.01
- _HeightCenter: 0.5
- _HorizonFade: 1
- _StencilRef: 1
- _NormalScale: 1
- _PPDLodThreshold: 5
- _PPDMaxSamples: 15
- _PPDMinSamples: 5
- _StencilRef: 2
- _SubsurfaceProfile: 0
- _SubsurfaceRadius: 1
- _Thickness: 1
- _ZTestMode: 8
- _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _EmissiveColor: {r: 0, g: 0, b: 0, a: 1}
- _UVDetailsMappingMask: {r: 1, g: 0, b: 0, a: 0}

37
Assets/TestScenes/HDTest/LayeredLitTest/Material/Lit_UVChart_Layer1_Detail.mat


m_PrefabInternal: {fileID: 0}
m_Name: Lit_UVChart_Layer1_Detail
m_Shader: {fileID: 4800000, guid: 6e4ae4064600d784cac1e41a9e6f2e59, type: 3}
m_ShaderKeywords: _ALPHACUTOFFENABLE_OFF _DETAIL_MAP _DETAIL_MAP_WITH_NORMAL _DISTORTIONDEPTHTEST_OFF
_DISTORTIONONLY_OFF _EMISSION _NORMALMAP _NORMALMAP_TANGENT_SPACE _REQUIRE_UV3
m_ShaderKeywords: _DETAIL_MAP _NORMALMAP _NORMALMAP_TANGENT_SPACE
m_EnableInstancingVariants: 0
disabledShaderPasses:
- DistortionVectors
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:

m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DistortionVectorMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}

m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SubsurfaceRadiusMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ThicknessMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}

- _BumpScale: 1
- _CullMode: 2
- _Cutoff: 0.5
- _DepthOffsetEnable: 0
- _DetailAOScale: 1
- _DetailAlbedoScale: 1
- _DetailHeightScale: 1

- _DetailSmoothnessScale: 1
- _DistortionDepthTest: 0
- _DistortionEnable: 0
- _DoubleSidedEnable: 0
- _DoubleSidedMirrorEnable: 1
- _EnablePerPixelDisplacement: 0
- _HeightAmplitude: 0.01
- _HeightCenter: 0.5
- _HorizonFade: 1
- _StencilRef: 1
- _NormalScale: 1
- _PPDLodThreshold: 5
- _PPDMaxSamples: 15
- _PPDMinSamples: 5
- _StencilRef: 2
- _SubsurfaceProfile: 0
- _SubsurfaceRadius: 1
- _Thickness: 1
- _ZTestMode: 8
- _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _EmissiveColor: {r: 0, g: 0, b: 0, a: 1}
- _UVDetailsMappingMask: {r: 1, g: 0, b: 0, a: 0}

31
Assets/TestScenes/HDTest/LayeredLitTest/Material/Lit_UVChart_Layer2_Detail.mat


m_PrefabInternal: {fileID: 0}
m_Name: Lit_UVChart_Layer2_Detail
m_Shader: {fileID: 4800000, guid: 6e4ae4064600d784cac1e41a9e6f2e59, type: 3}
m_ShaderKeywords: _ALPHACUTOFFENABLE_OFF _DETAIL_MAP _DETAIL_MAP_WITH_NORMAL _DISTORTIONDEPTHTEST_OFF
_DISTORTIONONLY_OFF _EMISSION _NORMALMAP _NORMALMAP_TANGENT_SPACE _REQUIRE_UV3
m_ShaderKeywords: _DETAIL_MAP _NORMALMAP _NORMALMAP_TANGENT_SPACE
m_EnableInstancingVariants: 0
disabledShaderPasses: []
disabledShaderPasses:
- DistortionVectors
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:

m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SubsurfaceRadiusMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ThicknessMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}

- _DistortionDepthTest: 0
- _DistortionEnable: 0
- _DistortionOnly: 0
- _DoubleSidedEnable: 0
- _DoubleSidedMirrorEnable: 1
- _EnablePerPixelDisplacement: 0
- _HeightAmplitude: 0.01
- _HeightCenter: 0.5
- _HorizonFade: 1
- _StencilRef: 1
- _NormalScale: 1
- _PPDLodThreshold: 5
- _PPDMaxSamples: 15
- _PPDMinSamples: 5
- _StencilRef: 2
- _SubsurfaceProfile: 0
- _SubsurfaceRadius: 1
- _Thickness: 1
- _UVBase: 0
- _UVDetail: 0
- _UVMappingPlanar: 0

m_Colors:
- _BaseColor: {r: 0.61764705, g: 1, b: 0.74685603, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _EmissiveColor: {r: 0, g: 0, b: 0, a: 1}
- _UVDetailsMappingMask: {r: 1, g: 0, b: 0, a: 0}

37
Assets/TestScenes/HDTest/LayeredLitTest/Material/Lit_UVChart_Layer3_Detail.mat


m_PrefabInternal: {fileID: 0}
m_Name: Lit_UVChart_Layer3_Detail
m_Shader: {fileID: 4800000, guid: 6e4ae4064600d784cac1e41a9e6f2e59, type: 3}
m_ShaderKeywords: _ALPHACUTOFFENABLE_OFF _DETAIL_MAP _DETAIL_MAP_WITH_NORMAL _DISTORTIONDEPTHTEST_OFF
_DISTORTIONONLY_OFF _EMISSION _NORMALMAP _NORMALMAP_TANGENT_SPACE _REQUIRE_UV3
m_ShaderKeywords: _DETAIL_MAP _NORMALMAP _NORMALMAP_TANGENT_SPACE
m_EnableInstancingVariants: 0
disabledShaderPasses:
- DistortionVectors
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:

m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DistortionVectorMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}

m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SubsurfaceRadiusMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ThicknessMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}

- _BumpScale: 1
- _CullMode: 2
- _Cutoff: 0.5
- _DepthOffsetEnable: 0
- _DetailAOScale: 1
- _DetailAlbedoScale: 1
- _DetailHeightScale: 1

- _DetailSmoothnessScale: 1
- _DistortionDepthTest: 0
- _DistortionEnable: 0
- _DoubleSidedEnable: 0
- _DoubleSidedMirrorEnable: 1
- _EnablePerPixelDisplacement: 0
- _HeightAmplitude: 0.01
- _HeightCenter: 0.5
- _HorizonFade: 1
- _StencilRef: 1
- _NormalScale: 1
- _PPDLodThreshold: 5
- _PPDMaxSamples: 15
- _PPDMinSamples: 5
- _StencilRef: 2
- _SubsurfaceProfile: 0
- _SubsurfaceRadius: 1
- _Thickness: 1
- _ZTestMode: 8
- _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _EmissiveColor: {r: 0, g: 0, b: 0, a: 1}
- _UVDetailsMappingMask: {r: 1, g: 0, b: 0, a: 0}

28
Assets/TestScenes/HDTest/LayeredLitTest/Material/Lit_White_Detail.mat


m_PrefabInternal: {fileID: 0}
m_Name: Lit_White_Detail
m_Shader: {fileID: 4800000, guid: 6e4ae4064600d784cac1e41a9e6f2e59, type: 3}
m_ShaderKeywords: _ALPHACUTOFFENABLE_OFF _DETAIL_MAP _DETAIL_MAP_WITH_NORMAL _DISTORTIONDEPTHTEST_OFF
_DISTORTIONONLY_OFF _EMISSION _NORMALMAP _NORMALMAP_TANGENT_SPACE _REQUIRE_UV3
m_ShaderKeywords: _DETAIL_MAP _NORMALMAP _NORMALMAP_TANGENT_SPACE
m_EnableInstancingVariants: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses:

m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SubsurfaceRadiusMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ThicknessMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}

- _DistortionDepthTest: 0
- _DistortionEnable: 0
- _DistortionOnly: 0
- _DoubleSidedEnable: 0
- _DoubleSidedMirrorEnable: 1
- _EnablePerPixelDisplacement: 0
- _HeightAmplitude: 0.01
- _HeightCenter: 0.5
- _HorizonFade: 1
- _StencilRef: 1
- _NormalScale: 1
- _PPDLodThreshold: 5
- _PPDMaxSamples: 15
- _PPDMinSamples: 5
- _StencilRef: 2
- _SubsurfaceProfile: 0
- _SubsurfaceRadius: 1
- _Thickness: 1
- _UVBase: 0
- _UVDetail: 0
- _UVMappingPlanar: 0

m_Colors:
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _EmissiveColor: {r: 0, g: 0, b: 0, a: 1}
- _UVDetailsMappingMask: {r: 1, g: 0, b: 0, a: 0}

6
Assets/TestScenes/HDTest/Material/HDRenderLoopMaterials/Lit_Emissive_Blue.mat


m_PrefabInternal: {fileID: 0}
m_Name: Lit_Emissive_Blue
m_Shader: {fileID: 4800000, guid: 6e4ae4064600d784cac1e41a9e6f2e59, type: 3}
m_ShaderKeywords: _ALPHACUTOFFENABLE_OFF _DISTORTIONDEPTHTEST_OFF _DISTORTIONONLY_OFF
_EMISSION _EMISSIVE_COLOR _NORMALMAP_TANGENT_SPACE _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
m_ShaderKeywords: _EMISSIVE_COLOR _NORMALMAP_TANGENT_SPACE
m_LightmapFlags: 1
m_EnableInstancingVariants: 0
m_CustomRenderQueue: -1

- _SmoothnessTextureChannel: 1
- _SpecularHighlights: 1
- _SrcBlend: 1
- _StencilRef: 1
- _StencilRef: 2
- _SubSurfaceRadius: 0
- _SubsurfaceProfile: 0
- _SubsurfaceRadius: 1

m_Colors:
- _BaseColor: {r: 0, g: 0, b: 0, a: 1}
- _Color: {r: 0, g: 0, b: 0, a: 1}
- _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _EmissiveColor: {r: 0, g: 0, b: 1, a: 1}
- _UVDetailsMappingMask: {r: 1, g: 0, b: 0, a: 0}

12
Assets/TestScenes/HDTest/Material/HDRenderLoopMaterials/test details.mat


m_PrefabInternal: {fileID: 0}
m_Name: test details
m_Shader: {fileID: 4800000, guid: 6e4ae4064600d784cac1e41a9e6f2e59, type: 3}
m_ShaderKeywords: _NORMALMAP_TANGENT_SPACE
m_ShaderKeywords: _DETAIL_MAP _NORMALMAP _NORMALMAP_TANGENT_SPACE
m_LightmapFlags: 1
m_EnableInstancingVariants: 0
m_CustomRenderQueue: -1

m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BaseColorMap:
m_Texture: {fileID: 0}
m_Texture: {fileID: 2800000, guid: d734753529ca78148a43944515a64bc5, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:

m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMap:
m_Texture: {fileID: 2800000, guid: d896c388b98bb614ebe6bb48e0f56dcf, type: 3}
m_Scale: {x: 0.99, y: 1}
m_Offset: {x: 1.52, y: 1}
m_Texture: {fileID: 2800000, guid: 75bfcd5e2d2d5954ca601a85db5d1a73, type: 3}
m_Scale: {x: 0.83, y: 1}
m_Offset: {x: 0.96, y: 1}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}

m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _NormalMap:
m_Texture: {fileID: 0}
m_Texture: {fileID: 2800000, guid: 11f99173903c31f49b05339fc71c7919, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:

2
ProjectSettings/ProjectVersion.txt


m_EditorVersion: 5.6.0b6
m_EditorVersion: 2017.1.0a1

88
Assets/ScriptableRenderPipeline/ShaderLibrary/NormalSurfaceGradient.hlsl


// this produces an orthonormal basis of the tangent and bitangent WITHOUT vertex level tangent/bitangent for any UV including procedurally generated
// method released with the demo for publication of "bump mapping unparametrized surfaces on the GPU"
// http://mmikkelsen3d.blogspot.com/2011/07/derivative-maps.html
void SurfaceGradientGenBasisTB(float3 nrmVertexNormal, float3 sigmaX, float3 sigmaY, float flipSign, float2 texST, out float3 vT, out float3 vB)
{
float2 dSTdx = ddx_fine(texST), dSTdy = ddy_fine(texST);
float det = dot(dSTdx, float2(dSTdy.y, -dSTdy.x));
float sign_det = det < 0 ? -1 : 1;
// invC0 represents (dXds, dYds); but we don't divide by determinant (scale by sign instead)
float2 invC0 = sign_det * float2(dSTdy.y, -dSTdx.y);
vT = sigmaX * invC0.x + sigmaY * invC0.y;
if (abs(det) > 0.0)
vT = normalize(vT);
vB = (sign_det * flipSign) * cross(nrmVertexNormal, vT);
}
// surface gradient from an on the fly TBN (deriv obtained using tspaceNormalToDerivative()) or from conventional vertex level TBN (mikktspace compliant and deriv obtained using tspaceNormalToDerivative())
float3 SurfaceGradientFromTBN(float2 deriv, float3 vT, float3 vB)
{
return deriv.x * vT + deriv.y * vB;
}
// surface gradient from an already generated "normal" such as from an object space normal map
// this allows us to mix the contribution together with a series of other contributions including tangent space normals
// v does not need to be unit length as long as it establishes the direction.
float3 SurfaceGradientFromPerturbedNormal(float3 nrmVertexNormal, float3 v)
{
float3 n = nrmVertexNormal;
float s = 1.0 / max(FLT_EPSILON, abs(dot(n, v)));
return s * (dot(n, v) * n - v);
}
// used to produce a surface gradient from the gradient of a volume bump function such as a volume of perlin noise.
// equation 2. in "bump mapping unparametrized surfaces on the GPU".
// Observe the difference in figure 2. between using the gradient vs. the surface gradient to do bump mapping (the original method is proved wrong in the paper!).
float3 SurfaceGradientFromVolumeGradient(float3 nrmVertexNormal, float3 grad)
{
return grad - dot(nrmVertexNormal, grad) * nrmVertexNormal;
}
// triplanar projection considered special case of volume bump map
// described here: http://mmikkelsen3d.blogspot.com/2013/10/volume-height-maps-and-triplanar-bump.html
// derivs obtained using tspaceNormalToDerivative() and weights using computeTriplanarWeights().
float3 SurfaceGradientFromTriplanarProjection(float3 nrmVertexNormal, float3 triplanarWeights, float2 deriv_xplane, float2 deriv_yplane, float2 deriv_zplane)
{
const float w0 = triplanarWeights.x, w1 = triplanarWeights.y, w2 = triplanarWeights.z;
// assume deriv_xplane, deriv_yplane and deriv_zplane sampled using (z,y), (z,x) and (x,y) respectively.
// positive scales of the look-up coordinate will work as well but for negative scales the derivative components will need to be negated accordingly.
float3 volumeGrad = float3(w2 * deriv_zplane.x + w1 * deriv_yplane.y, w2 * deriv_zplane.y + w0 * deriv_xplane.y, w0 * deriv_xplane.x + w1 * deriv_yplane.x);
return SurfaceGradientFromVolumeGradient(nrmVertexNormal, volumeGrad);
}
float3 SurfaceGradientResolveNormal(float3 nrmVertexNormal, float3 surfGrad)
{
return normalize(nrmVertexNormal - surfGrad);
}
// The 128 means the derivative will come out no greater than 128 numerically (where 1 is 45 degrees so 128 is very steap). You can increase it if u like of course
// Basically tan(angle) limited to 128
// So a max angle of 89.55 degrees ;) id argue thats close enough to the vertical limit at 90 degrees
// vT is channels.xy of a tangent space normal in[-1; 1]
// out: convert vT to a derivative
float2 UnpackDerivativeNormalAG(float4 packedNormal, float scale = 1.0)
{
const float fS = 1.0 / (128.0 * 128.0);
float2 vT = packedNormal.wy * 2.0 - 1.0;
float2 vTsq = vT * vT;
float nz_sq = 1 - vTsq.x - vTsq.y;
float maxcompxy_sq = fS * max(vTsq.x, vTsq.y);
float z_inv = rsqrt(max(nz_sq, maxcompxy_sq));
float2 deriv = -z_inv * float2(vT.x, vT.y);
return deriv * scale;
}
float2 UnpackDerivativeNormalRGB(float4 packedNormal, float scale = 1.0)
{
const float fS = 1.0 / (128.0 * 128.0);
float3 vT = packedNormal.xyz * 2.0 - 1.0;
float3 vTsq = vT * vT;
float maxcompxy_sq = fS * max(vTsq.x, vTsq.y);
float z_inv = rsqrt(max(vTsq.z, maxcompxy_sq));
float2 deriv = -z_inv * float2(vT.x, vT.y);
return deriv * scale;
}

9
Assets/ScriptableRenderPipeline/ShaderLibrary/NormalSurfaceGradient.hlsl.meta


fileFormatVersion: 2
guid: b6ff088bebec9f941ae19a0086e4f097
timeCreated: 1487475828
licenseType: Pro
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

70
Assets/ScriptableRenderPipeline/ShaderLibrary/SampleUVMapping.hlsl


// This structure abstract uv mapping inside one struct.
// It represent a mapping of any uv (with its associated tangent space for derivative if SurfaceGradient mode) - UVSet0 to 4, planar, triplanar
#include "ShaderLibrary/NormalSurfaceGradient.hlsl"
#define UV_MAPPING_UVSET 0
#define UV_MAPPING_PLANAR 1
#define UV_MAPPING_TRIPLANAR 2
struct UVMapping
{
int mappingType;
float2 uv; // Current uv or planar uv
// Triplanar specific
float2 uvZY;
float2 uvXZ;
float2 uvXY;
float3 normalWS; // vertex normal
float3 triplanarWeights;
#ifdef SURFACE_GRADIENT
// tangent basis to use when mappingType is UV_MAPPING_UVSET
// these are vertex level in world space
float3 tangentWS;
float3 bitangentWS;
// TODO: store also object normal map for object triplanar
#endif
};
// Multiple includes of the file to handle all variations of textures sampling for regular, lod and bias
// Regular sampling functions
#define ADD_FUNC_SUFFIX(Name) Name
#define SAMPLE_TEXTURE_FUNC(textureName, samplerName, uvMapping, unused) SAMPLE_TEXTURE2D(textureName, samplerName, uvMapping)
#include "SampleUVMappingInternal.hlsl"
#undef ADD_FUNC_SUFFIX
#undef SAMPLE_TEXTURE_FUNC
// Lod sampling functions
#define ADD_FUNC_SUFFIX(Name) Name##Lod
#define SAMPLE_TEXTURE_FUNC(textureName, samplerName, uvMapping, lod) SAMPLE_TEXTURE2D_LOD(textureName, samplerName, uvMapping, lod)
#include "SampleUVMappingInternal.hlsl"
#undef ADD_FUNC_SUFFIX
#undef SAMPLE_TEXTURE_FUNC
// Bias sampling functions
#define ADD_FUNC_SUFFIX(Name) Name##Bias
#define SAMPLE_TEXTURE_FUNC(textureName, samplerName, uvMapping, bias) SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, uvMapping, bias)
#include "SampleUVMappingInternal.hlsl"
#undef ADD_FUNC_SUFFIX
#undef SAMPLE_TEXTURE_FUNC
// Macro to improve readibility of surface data
#define SAMPLE_UVMAPPING_TEXTURE2D(textureName, samplerName, uvMapping) SampleUVMapping(TEXTURE2D_PARAM(textureName, samplerName), uvMapping, 0.0) // Last 0.0 is unused
#define SAMPLE_UVMAPPING_TEXTURE2D_LOD(textureName, samplerName, uvMapping, lod) SampleUVMappingLod(TEXTURE2D_PARAM(textureName, samplerName), uvMapping, lod)
#define SAMPLE_UVMAPPING_TEXTURE2D_BIAS(textureName, samplerName, uvMapping, bias) SampleUVMappingBias(TEXTURE2D_PARAM(textureName, samplerName), uvMapping, bias)
#define SAMPLE_UVMAPPING_NORMALMAP(textureName, samplerName, uvMapping, scale) SampleUVMappingNormal(TEXTURE2D_PARAM(textureName, samplerName), uvMapping, scale, 0.0)
#define SAMPLE_UVMAPPING_NORMALMAP_LOD(textureName, samplerName, uvMapping, scale, lod) SampleUVMappingNormalLod(TEXTURE2D_PARAM(textureName, samplerName), uvMapping, scale, lod)
#define SAMPLE_UVMAPPING_NORMALMAP_BIAS(textureName, samplerName, uvMapping, scale, bias) SampleUVMappingNormalBias(TEXTURE2D_PARAM(textureName, samplerName), uvMapping, scale, bias)
#define SAMPLE_UVMAPPING_NORMALMAP_AG(textureName, samplerName, uvMapping, scale) SampleUVMappingNormalAG(TEXTURE2D_PARAM(textureName, samplerName), uvMapping, scale, 0.0)
#define SAMPLE_UVMAPPING_NORMALMAP_AG_LOD(textureName, samplerName, uvMapping, scale, lod) SampleUVMappingNormalAGLod(TEXTURE2D_PARAM(textureName, samplerName), uvMapping, scale, lod)
#define SAMPLE_UVMAPPING_NORMALMAP_AG_BIAS(textureName, samplerName, uvMapping, scale, bias) SampleUVMappingNormalAGBias(TEXTURE2D_PARAM(textureName, samplerName), uvMapping, scale, bias)
#define SAMPLE_UVMAPPING_NORMALMAP_RGB(textureName, samplerName, uvMapping, scale) SampleUVMappingNormalRGB(TEXTURE2D_PARAM(textureName, samplerName), uvMapping, scale, 0.0)
#define SAMPLE_UVMAPPING_NORMALMAP_RGB_LOD(textureName, samplerName, uvMapping, scale, lod) SampleUVMappingNormalRGBLod(TEXTURE2D_PARAM(textureName, samplerName), uvMapping, scale, lod)
#define SAMPLE_UVMAPPING_NORMALMAP_RGB_BIAS(textureName, samplerName, uvMapping, scale, bias) SampleUVMappingNormalRGBBias(TEXTURE2D_PARAM(textureName, samplerName), uvMapping, scale, bias)

57
Assets/ScriptableRenderPipeline/ShaderLibrary/SampleUVMappingInternal.hlsl


// These functions are use to hide the handling of triplanar mapping
// Normal need a specific treatment as they use special encoding for both base and detail map
// Also we use multiple inclusion to handle the various variation for lod and bias
// param can be unused, lod or bias
float4 ADD_FUNC_SUFFIX(SampleUVMapping)(TEXTURE2D_ARGS(textureName, samplerName), UVMapping uvMapping, float param)
{
if (uvMapping.mappingType == UV_MAPPING_TRIPLANAR)
{
float3 triplanarWeights = uvMapping.triplanarWeights;
float4 val = float4(0.0, 0.0, 0.0, 0.0);
if (triplanarWeights.x > 0.0)
val += triplanarWeights.x * SAMPLE_TEXTURE_FUNC(textureName, samplerName, uvMapping.uvZY, param);
if (triplanarWeights.y > 0.0)
val += triplanarWeights.y * SAMPLE_TEXTURE_FUNC(textureName, samplerName, uvMapping.uvXZ, param);
if (triplanarWeights.z > 0.0)
val += triplanarWeights.z * SAMPLE_TEXTURE_FUNC(textureName, samplerName, uvMapping.uvXY, param);
return val;
}
else // UV_MAPPING_UVSET / UV_MAPPING_PLANAR
{
return SAMPLE_TEXTURE_FUNC(textureName, samplerName, uvMapping.uv, param);
}
}
// Nested multiple includes of the file to handle all variations of normal map (AG, RG or RGB)
// TODO: Handle BC5 format, currently this code is for DXT5nm - After the change, rename this function UnpackNormalmapRGorAG
// This version is use for the base normal map
#define ADD_NORMAL_FUNC_SUFFIX(Name) Name
#define UNPACK_NORMAL_FUNC UnpackNormalAG
#define UNPACK_DERIVATIVE_FUNC UnpackDerivativeNormalAG
#include "SampleUVMappingNormalInternal.hlsl"
#undef ADD_NORMAL_FUNC_SUFFIX
#undef UNPACK_NORMAL_FUNC
#undef UNPACK_DERIVATIVE_FUNC
// This version is for normalmap with AG encoding only. Mainly use with details map.
#define ADD_NORMAL_FUNC_SUFFIX(Name) Name##AG
#define UNPACK_NORMAL_FUNC UnpackNormalAG
#define UNPACK_DERIVATIVE_FUNC UnpackDerivativeNormalAG
#include "SampleUVMappingNormalInternal.hlsl"
#undef ADD_NORMAL_FUNC_SUFFIX
#undef UNPACK_NORMAL_FUNC
#undef UNPACK_DERIVATIVE_FUNC
// This version is for normalmap with RGB encoding only, i.e uncompress or BC7.
#define ADD_NORMAL_FUNC_SUFFIX(Name) Name##RGB
#define UNPACK_NORMAL_FUNC UnpackNormalRGB
#define UNPACK_DERIVATIVE_FUNC UnpackDerivativeNormalRGB
#include "SampleUVMappingNormalInternal.hlsl"
#undef ADD_NORMAL_FUNC_SUFFIX
#undef UNPACK_NORMAL_FUNC
#undef UNPACK_DERIVATIVE_FUNC

55
Assets/ScriptableRenderPipeline/ShaderLibrary/SampleUVMappingNormalInternal.hlsl


float3 ADD_FUNC_SUFFIX(ADD_NORMAL_FUNC_SUFFIX(SampleUVMappingNormal))(TEXTURE2D_ARGS(textureName, samplerName), UVMapping uvMapping, float scale, float param)
{
if (uvMapping.mappingType == UV_MAPPING_TRIPLANAR)
{
float3 triplanarWeights = uvMapping.triplanarWeights;
#ifdef SURFACE_GRADIENT
float2 derivXplane;
float2 derivYPlane;
float2 derivZPlane;
derivXplane = derivYPlane = derivZPlane = float2(0.0, 0.0);
if (triplanarWeights.x > 0.0)
derivXplane = triplanarWeights.x * UNPACK_DERIVATIVE_FUNC(SAMPLE_TEXTURE_FUNC(textureName, samplerName, uvMapping.uvZY, param), scale);
if (triplanarWeights.y > 0.0)
derivYPlane = triplanarWeights.y * UNPACK_DERIVATIVE_FUNC(SAMPLE_TEXTURE_FUNC(textureName, samplerName, uvMapping.uvXZ, param), scale);
if (triplanarWeights.z > 0.0)
derivZPlane = triplanarWeights.z * UNPACK_DERIVATIVE_FUNC(SAMPLE_TEXTURE_FUNC(textureName, samplerName, uvMapping.uvXY, param), scale);
// Assume derivXplane, derivYPlane and derivZPlane sampled using (z,y), (z,x) and (x,y) respectively.
// TODO: Check with morten convention! Do it follow ours ?
float3 volumeGrad = float3(derivZPlane.x + derivYPlane.y, derivZPlane.y + derivXplane.y, derivXplane.x + derivYPlane.x);
return SurfaceGradientFromVolumeGradient(uvMapping.normalWS, volumeGrad);
#else
float3 val = float3(0.0, 0.0, 0.0);
if (triplanarWeights.x > 0.0)
val += triplanarWeights.x * UNPACK_NORMAL_FUNC(SAMPLE_TEXTURE_FUNC(textureName, samplerName, uvMapping.uvZY, param), scale);
if (triplanarWeights.y > 0.0)
val += triplanarWeights.y * UNPACK_NORMAL_FUNC(SAMPLE_TEXTURE_FUNC(textureName, samplerName, uvMapping.uvXZ, param), scale);
if (triplanarWeights.z > 0.0)
val += triplanarWeights.z * UNPACK_NORMAL_FUNC(SAMPLE_TEXTURE_FUNC(textureName, samplerName, uvMapping.uvXY, param), scale);
return normalize(val);
#endif
}
#ifdef SURFACE_GRADIENT
else if (uvMapping.mappingType == UV_MAPPING_PLANAR)
{
float2 derivYPlane = UNPACK_DERIVATIVE_FUNC(SAMPLE_TEXTURE_FUNC(textureName, samplerName, uvMapping.uvXZ, param), scale);
// See comment above
float3 volumeGrad = float3(derivYPlane.y, 0.0, derivYPlane.x);
return SurfaceGradientFromVolumeGradient(uvMapping.normalWS, volumeGrad);
}
#endif
else
{
#ifdef SURFACE_GRADIENT
float2 deriv = UNPACK_DERIVATIVE_FUNC(SAMPLE_TEXTURE_FUNC(textureName, samplerName, uvMapping.uv, param), scale);
return SurfaceGradientFromTBN(deriv, uvMapping.tangentWS, uvMapping.bitangentWS);
#else
return UNPACK_NORMAL_FUNC(SAMPLE_TEXTURE_FUNC(textureName, samplerName, uvMapping.uv, param), scale);
#endif
}
}

9
Assets/ScriptableRenderPipeline/ShaderLibrary/SampleUVMappingNormalInternal.hlsl.meta


fileFormatVersion: 2
guid: f941b2119184e624a8ecd126735c5ed0
timeCreated: 1487475828
licenseType: Pro
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

93
Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/SampleLayerInternal.hlsl


// These functions are use to hide the handling of triplanar mapping
// Normal need a specific treatment as they use special encoding for both base and detail map
// Also we use multiple inclusion to handle the various variation for lod and bias
// param can be unused, lod or bias
float4 ADD_FUNC_SUFFIX(SampleLayer)(TEXTURE2D_ARGS(layerTex, layerSampler), LayerUV layerUV, float3 triplanarWeights, float param)
{
if (layerUV.isTriplanar)
{
float4 val = float4(0.0, 0.0, 0.0, 0.0);
if (triplanarWeights.x > 0.0)
val += triplanarWeights.x * SAMPLE_TEXTURE_FUNC(layerTex, layerSampler, layerUV.uvZY, param);
if (triplanarWeights.y > 0.0)
val += triplanarWeights.y * SAMPLE_TEXTURE_FUNC(layerTex, layerSampler, layerUV.uvXZ, param);
if (triplanarWeights.z > 0.0)
val += triplanarWeights.z * SAMPLE_TEXTURE_FUNC(layerTex, layerSampler, layerUV.uvXY, param);
return val;
}
else
{
return SAMPLE_TEXTURE_FUNC(layerTex, layerSampler, layerUV.uv, param);
}
}
// TODO: Handle BC5 format, currently this code is for DXT5nm - After the change, rename this function UnpackNormalmapRGorAG
// This version is use for the base normal map
float3 ADD_FUNC_SUFFIX(SampleLayerNormal)(TEXTURE2D_ARGS(layerTex, layerSampler), LayerUV layerUV, float3 triplanarWeights, float scale, float param)
{
if (layerUV.isTriplanar)
{
float3 val = float3(0.0, 0.0, 0.0);
if (triplanarWeights.x > 0.0)
val += triplanarWeights.x * UnpackNormalAG(SAMPLE_TEXTURE_FUNC(layerTex, layerSampler, layerUV.uvZY, param), scale);
if (triplanarWeights.y > 0.0)
val += triplanarWeights.y * UnpackNormalAG(SAMPLE_TEXTURE_FUNC(layerTex, layerSampler, layerUV.uvXZ, param), scale);
if (triplanarWeights.z > 0.0)
val += triplanarWeights.z * UnpackNormalAG(SAMPLE_TEXTURE_FUNC(layerTex, layerSampler, layerUV.uvXY, param), scale);
return normalize(val);
}
else
{
return UnpackNormalAG(SAMPLE_TEXTURE_FUNC(layerTex, layerSampler, layerUV.uv, param), scale);
}
}
// This version is for normalmap with AG encoding only. Mainly use with details map.
float3 ADD_FUNC_SUFFIX(SampleLayerNormalAG)(TEXTURE2D_ARGS(layerTex, layerSampler), LayerUV layerUV, float3 triplanarWeights, float scale, float param)
{
if (layerUV.isTriplanar)
{
float3 val = float3(0.0, 0.0, 0.0);
if (triplanarWeights.x > 0.0)
val += triplanarWeights.x * UnpackNormalAG(SAMPLE_TEXTURE_FUNC(layerTex, layerSampler, layerUV.uvZY, param), scale);
if (triplanarWeights.y > 0.0)
val += triplanarWeights.y * UnpackNormalAG(SAMPLE_TEXTURE_FUNC(layerTex, layerSampler, layerUV.uvXZ, param), scale);
if (triplanarWeights.z > 0.0)
val += triplanarWeights.z * UnpackNormalAG(SAMPLE_TEXTURE_FUNC(layerTex, layerSampler, layerUV.uvXY, param), scale);
return normalize(val);
}
else
{
return UnpackNormalAG(SAMPLE_TEXTURE_FUNC(layerTex, layerSampler, layerUV.uv, param), scale);
}
}
// This version is for normalmap with RGB encoding only, i.e uncompress or BC7. Mainly used for object space normal.
float3 ADD_FUNC_SUFFIX(SampleLayerNormalRGB)(TEXTURE2D_ARGS(layerTex, layerSampler), LayerUV layerUV, float3 triplanarWeights, float scale, float param)
{
if (layerUV.isTriplanar)
{
float3 val = float3(0.0, 0.0, 0.0);
if (triplanarWeights.x > 0.0)
val += triplanarWeights.x * UnpackNormalRGB(SAMPLE_TEXTURE_FUNC(layerTex, layerSampler, layerUV.uvZY, param), scale);
if (triplanarWeights.y > 0.0)
val += triplanarWeights.y * UnpackNormalRGB(SAMPLE_TEXTURE_FUNC(layerTex, layerSampler, layerUV.uvXZ, param), scale);
if (triplanarWeights.z > 0.0)
val += triplanarWeights.z * UnpackNormalRGB(SAMPLE_TEXTURE_FUNC(layerTex, layerSampler, layerUV.uvXY, param), scale);
return normalize(val);
}
else
{
return UnpackNormalRGB(SAMPLE_TEXTURE_FUNC(layerTex, layerSampler, layerUV.uv, param), scale);
}
}

51
Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/SampleLayer.hlsl


// Gather all kind of mapping in one struct, allow to improve code readability
struct LayerUV
{
float2 uv;
bool isPlanar; // mutually exclusive with isTriplanar
// triplanar
bool isTriplanar;
float2 uvZY;
float2 uvXZ;
float2 uvXY;
};
// Multiple includes of the file to handle all variations of textures sampling for regular, lod and bias
// Regular sampling functions
#define ADD_FUNC_SUFFIX(Name) Name
#define SAMPLE_TEXTURE_FUNC(layerTex, layerSampler, layerUV, unused) SAMPLE_TEXTURE2D(layerTex, layerSampler, layerUV)
#include "SampleLayerInternal.hlsl"
#undef ADD_FUNC_SUFFIX
#undef SAMPLE_TEXTURE_FUNC
// Lod sampling functions
#define ADD_FUNC_SUFFIX(Name) Name##Lod
#define SAMPLE_TEXTURE_FUNC(layerTex, layerSampler, layerUV, lod) SAMPLE_TEXTURE2D_LOD(layerTex, layerSampler, layerUV, lod)
#include "SampleLayerInternal.hlsl"
#undef ADD_FUNC_SUFFIX
#undef SAMPLE_TEXTURE_FUNC
// Bias sampling functions
#define ADD_FUNC_SUFFIX(Name) Name##Bias
#define SAMPLE_TEXTURE_FUNC(layerTex, layerSampler, layerUV, bias) SAMPLE_TEXTURE2D_BIAS(layerTex, layerSampler, layerUV, bias)
#include "SampleLayerInternal.hlsl"
#undef ADD_FUNC_SUFFIX
#undef SAMPLE_TEXTURE_FUNC
// Macro to improve readibility of surface data
#define SAMPLE_LAYER_TEXTURE2D(textureName, samplerName, coord) SampleLayer(TEXTURE2D_PARAM(textureName, samplerName), coord, layerTexCoord.triplanarWeights, 0.0) // Last 0.0 is unused
#define SAMPLE_LAYER_TEXTURE2D_LOD(textureName, samplerName, coord, lod) SampleLayerLod(TEXTURE2D_PARAM(textureName, samplerName), coord, layerTexCoord.triplanarWeights, lod)
#define SAMPLE_LAYER_TEXTURE2D_BIAS(textureName, samplerName, coord, bias) SampleLayerBias(TEXTURE2D_PARAM(textureName, samplerName), coord, layerTexCoord.triplanarWeights, bias)
#define SAMPLE_LAYER_NORMALMAP(textureName, samplerName, coord, scale) SampleLayerNormal(TEXTURE2D_PARAM(textureName, samplerName), coord, layerTexCoord.triplanarWeights, scale, 0.0)
#define SAMPLE_LAYER_NORMALMAP_LOD(textureName, samplerName, coord, scale, lod) SampleLayerNormalLod(TEXTURE2D_PARAM(textureName, samplerName), coord, layerTexCoord.triplanarWeights, scale, lod)
#define SAMPLE_LAYER_NORMALMAP_BIAS(textureName, samplerName, coord, scale, bias) SampleLayerNormalBias(TEXTURE2D_PARAM(textureName, samplerName), coord, layerTexCoord.triplanarWeights, scale, bias)
#define SAMPLE_LAYER_NORMALMAP_AG(textureName, samplerName, coord, scale) SampleLayerNormalAG(TEXTURE2D_PARAM(textureName, samplerName), coord, layerTexCoord.triplanarWeights, scale, 0.0)
#define SAMPLE_LAYER_NORMALMAP_AG_LOD(textureName, samplerName, coord, scale, lod) SampleLayerNormalAGLod(TEXTURE2D_PARAM(textureName, samplerName), coord, layerTexCoord.triplanarWeights, scale, lod)
#define SAMPLE_LAYER_NORMALMAP_AG_BIAS(textureName, samplerName, coord, scale, bias) SampleLayerNormalAGBias(TEXTURE2D_PARAM(textureName, samplerName), coord, layerTexCoord.triplanarWeights, scale, bias)
#define SAMPLE_LAYER_NORMALMAP_RGB(textureName, samplerName, coord, scale) SampleLayerNormalRGB(TEXTURE2D_PARAM(textureName, samplerName), coord, layerTexCoord.triplanarWeights, scale, 0.0)
#define SAMPLE_LAYER_NORMALMAP_RGB_LOD(textureName, samplerName, coord, scale, lod) SampleLayerNormalRGBLod(TEXTURE2D_PARAM(textureName, samplerName), coord, layerTexCoord.triplanarWeights, scale, lod)
#define SAMPLE_LAYER_NORMALMAP_RGB_BIAS(textureName, samplerName, coord, scale, bias) SampleLayerNormalRGBBias(TEXTURE2D_PARAM(textureName, samplerName), coord, layerTexCoord.triplanarWeights, scale, bias)

9
Assets/TestScenes/HDTest/LayeredLitTest/Mesh/Materials.meta


fileFormatVersion: 2
guid: e8f6ad2e481134b4fa6108a280b52de7
folderAsset: yes
timeCreated: 1484331445
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

/Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/SampleLayer.hlsl.meta → /Assets/ScriptableRenderPipeline/ShaderLibrary/SampleUVMapping.hlsl.meta

/Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/SampleLayerInternal.hlsl.meta → /Assets/ScriptableRenderPipeline/ShaderLibrary/SampleUVMappingInternal.hlsl.meta

正在加载...
取消
保存