浏览代码

Merge branch 'master' into 2018.1-experimental

/main
sebastienlagarde 7 年前
当前提交
2c1c78cf
共有 68 个文件被更改,包括 930 次插入388 次删除
  1. 4
      .gitmodules
  2. 2
      ScriptableRenderPipeline/Core/CoreRP/CoreResources/EncodeBC6H.compute
  3. 2
      ScriptableRenderPipeline/Core/CoreRP/CoreResources/GPUCopy.compute
  4. 2
      ScriptableRenderPipeline/Core/CoreRP/CoreResources/TexturePadding.compute
  5. 2
      ScriptableRenderPipeline/Core/CoreRP/Editor/Volume/Drawers/ColorParameterDrawer.cs
  6. 39
      ScriptableRenderPipeline/Core/CoreRP/Editor/Volume/VolumeComponentListEditor.cs
  7. 31
      ScriptableRenderPipeline/Core/CoreRP/Editor/Volume/VolumeEditor.cs
  8. 2
      ScriptableRenderPipeline/Core/CoreRP/ShaderLibrary/Common.hlsl
  9. 2
      ScriptableRenderPipeline/Core/CoreRP/Shadow/DebugDisplayShadowMap.shader
  10. 2
      ScriptableRenderPipeline/Core/CoreRP/Shadow/ShadowBlurMoments.compute
  11. 2
      ScriptableRenderPipeline/Core/CoreRP/Shadow/ShadowClear.shader
  12. 5
      ScriptableRenderPipeline/Core/CoreRP/Volume/Volume.cs
  13. 23
      ScriptableRenderPipeline/Core/CoreRP/Volume/VolumeManager.cs
  14. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Camera/HDCamera.cs
  15. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Debug/DebugColorPicker.shader
  16. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Debug/DebugDisplayLatlong.shader
  17. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Debug/DebugFullScreen.shader
  18. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Debug/DebugViewMaterialGBuffer.shader
  19. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Debug/DebugViewTiles.shader
  20. 4
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/BuildPlayer/HDRPCustomBuildProcessor.cs
  21. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Material/DiffusionProfile/DrawDiffusionProfile.shader
  22. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Material/DiffusionProfile/DrawTransmittanceGraph.shader
  23. 196
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Material/StackLit/BaseMaterialUI.cs
  24. 204
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Material/StackLit/StackLitUI.cs
  25. 5
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/HDRenderPipeline.cs
  26. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/Deferred.shader
  27. 4
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/DeferredDirectionalShadow.compute
  28. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/LightLoop/Deferred.compute
  29. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/LightLoop/LightLoop.cs
  30. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/LightLoop/builddispatchindirect.compute
  31. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/LightLoop/cleardispatchindirect.compute
  32. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/LightLoop/lightlistbuild-bigtile.compute
  33. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/LightLoop/lightlistbuild-clustered.compute
  34. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/LightLoop/lightlistbuild.compute
  35. 4
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/LightLoop/materialflags.compute
  36. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/LightLoop/scrbound.compute
  37. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/Volumetrics/VolumetricLighting.compute
  38. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Decal/Decal.shader
  39. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/GGXConvolution/BuildProbabilityTables.compute
  40. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/GGXConvolution/ComputeGgxIblSampleData.compute
  41. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/GGXConvolution/GGXConvolve.shader
  42. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/LayeredLit/LayeredLit.shader
  43. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/LayeredLit/LayeredLitTessellation.shader
  44. 6
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Lit/Lit.hlsl
  45. 4
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Lit/Lit.shader
  46. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Lit/LitTessellation.shader
  47. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/PreIntegratedFGD/PreIntegratedFGD.shader
  48. 109
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/StackLit/StackLit.shader
  49. 358
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/StackLit/StackLitData.hlsl
  50. 66
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/StackLit/StackLitProperties.hlsl
  51. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/SubsurfaceScattering/CombineLighting.shader
  52. 4
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/SubsurfaceScattering/SubsurfaceScattering.compute
  53. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/SubsurfaceScattering/SubsurfaceScattering.shader
  54. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Unlit/Unlit.shader
  55. 6
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/RenderPipeline/FrameSettings.cs
  56. 4
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/RenderPipelineResources/ApplyDistorsion.compute
  57. 4
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/RenderPipelineResources/Blit.shader
  58. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/RenderPipelineResources/ColorPyramid.compute
  59. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/RenderPipelineResources/CopyDepthBuffer.shader
  60. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/RenderPipelineResources/CopyStencilBuffer.shader
  61. 4
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/RenderPipelineResources/DepthPyramid.compute
  62. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Sky/HDRISky/HDRISky.shader
  63. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Sky/OpaqueAtmosphericScattering.shader
  64. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Sky/ProceduralSky/ProceduralSky.shader
  65. 10
      ScriptableRenderPipeline/LightweightPipeline/LWRP/LightweightPipeline.cs
  66. 121
      ScriptableRenderPipeline/Core/CoreRP/ShaderLibrary/API/Switch.hlsl
  67. 9
      ScriptableRenderPipeline/Core/CoreRP/ShaderLibrary/API/Switch.hlsl.meta
  68. 8
      Tests/UTF_Tests_HDRP.meta

4
.gitmodules


url = https://github.com/Unity-Technologies/ShaderGraph
[submodule "Tests/UTF_Core"]
path = Tests/UTF_Core
url=https://github.com/Unity-Technologies/UTF_Core.git
url = https://github.com/Unity-Technologies/UTF_Core.git
url=https://github.com/Unity-Technologies/UTF_Tests_HDRP.git
url = https://github.com/Unity-Technologies/UTF_Tests_HDRP.git

2
ScriptableRenderPipeline/Core/CoreRP/CoreResources/EncodeBC6H.compute


#include "CoreRP/ShaderLibrary/BC6H.hlsl"
#include "CoreRP/ShaderLibrary/Sampling/Sampling.hlsl"
#pragma only_renderers d3d11 ps4 xboxone vulkan metal
#pragma only_renderers d3d11 ps4 xboxone vulkan metal switch
TextureCube<float4> _Source;
RWTexture2DArray<uint4> _Target;

2
ScriptableRenderPipeline/Core/CoreRP/CoreResources/GPUCopy.compute


// Autogenerated file. Do not edit by hand
#pragma only_renderers d3d11 ps4 xboxone vulkan metal
#pragma only_renderers d3d11 ps4 xboxone vulkan metal switch
#include "../ShaderLibrary/Common.hlsl"
CBUFFER_START (UnityCBuffer)

2
ScriptableRenderPipeline/Core/CoreRP/CoreResources/TexturePadding.compute


#pragma kernel KMainTop KERNEL_NAME=KMainTop DIRECTION=DIRECTION_TOP
#pragma kernel KMainRight KERNEL_NAME=KMainRight DIRECTION=DIRECTION_RIGHT
#pragma only_renderers d3d11 ps4 xboxone vulkan metal
#pragma only_renderers d3d11 ps4 xboxone vulkan metal switch
// ------------------------------------------------
// Texture buffers

2
ScriptableRenderPipeline/Core/CoreRP/Editor/Volume/Drawers/ColorParameterDrawer.cs


return false;
var o = parameter.GetObjectRef<ColorParameter>();
value.colorValue = EditorGUILayout.ColorField(title, value.colorValue, o.showEyeDropper, o.showAlpha, o.showAlpha);
value.colorValue = EditorGUILayout.ColorField(title, value.colorValue, o.showEyeDropper, o.showAlpha, o.hdr);
return true;
}
}

39
ScriptableRenderPipeline/Core/CoreRP/Editor/Volume/VolumeComponentListEditor.cs


{
public sealed class VolumeComponentListEditor
{
public VolumeProfile asset { get; private set; }
VolumeProfile m_Asset;
SerializedObject m_SerializedObject;
SerializedProperty m_ComponentsProperty;

Assert.IsNotNull(asset);
Assert.IsNotNull(serializedObject);
m_Asset = asset;
this.asset = asset;
m_SerializedObject = serializedObject;
m_ComponentsProperty = serializedObject.Find((VolumeProfile x) => x.components);
Assert.IsNotNull(m_ComponentsProperty);

void OnUndoRedoPerformed()
{
m_Asset.isDirty = true;
asset.isDirty = true;
// Dumb hack to make sure the serialized object is up to date on undo (else there'll be
// a state mismatch when this class is used in a GameObject inspector).

m_Editors.Clear();
// Recreate editors for existing settings, if any
for (int i = 0; i < m_Asset.components.Count; i++)
CreateEditor(m_Asset.components[i], m_ComponentsProperty.GetArrayElementAtIndex(i));
var components = asset.components;
for (int i = 0; i < components.Count; i++)
CreateEditor(components[i], m_ComponentsProperty.GetArrayElementAtIndex(i));
}
public void Clear()

public void OnGUI()
{
if (m_Asset == null)
if (asset == null)
if (m_Asset.isDirty)
if (asset.isDirty)
m_Asset.isDirty = false;
asset.isDirty = false;
|| AssetDatabase.IsOpenForEdit(m_Asset, StatusQueryOptions.UseCachedIfPossible);
|| AssetDatabase.IsOpenForEdit(asset, StatusQueryOptions.UseCachedIfPossible);
using (new EditorGUI.DisabledScope(!isEditable))
{

{
var r = hscope.rect;
var pos = new Vector2(r.x + r.width / 2f, r.yMax + 18f);
FilterWindow.Show(pos, new VolumeComponentProvider(m_Asset, this));
FilterWindow.Show(pos, new VolumeComponentProvider(asset, this));
}
}
}

Undo.RegisterCreatedObjectUndo(component, "Add Volume Component");
// Store this new effect as a subasset so we can reference it safely afterwards
AssetDatabase.AddObjectToAsset(component, m_Asset);
// Only when we're not dealing with an instantiated asset
if (EditorUtility.IsPersistent(asset))
AssetDatabase.AddObjectToAsset(component, asset);
// Grow the list first, then add - that's how serialized lists work in Unity
m_ComponentsProperty.arraySize++;

// Force save / refresh
EditorUtility.SetDirty(m_Asset);
AssetDatabase.SaveAssets();
if (EditorUtility.IsPersistent(asset))
{
EditorUtility.SetDirty(asset);
AssetDatabase.SaveAssets();
}
// Create & store the internal editor object for this effect
CreateEditor(component, componentProp, forceOpen: true);

Undo.DestroyObjectImmediate(component);
// Force save / refresh
EditorUtility.SetDirty(m_Asset);
EditorUtility.SetDirty(asset);
AssetDatabase.SaveAssets();
}

Undo.RegisterCreatedObjectUndo(newComponent, "Reset Volume Component");
// Store this new effect as a subasset so we can reference it safely afterwards
AssetDatabase.AddObjectToAsset(newComponent, m_Asset);
AssetDatabase.AddObjectToAsset(newComponent, asset);
// Put it in the reserved space
property.objectReferenceValue = newComponent;

Undo.DestroyObjectImmediate(prevComponent);
// Force save / refresh
EditorUtility.SetDirty(m_Asset);
EditorUtility.SetDirty(asset);
AssetDatabase.SaveAssets();
}

31
ScriptableRenderPipeline/Core/CoreRP/Editor/Volume/VolumeEditor.cs


get { return target as Volume; }
}
VolumeProfile profileRef
{
get { return actualTarget.HasInstantiatedProfile() ? actualTarget.profile : actualTarget.sharedProfile; }
}
void OnEnable()
{
var o = new PropertyFetcher<Volume>(serializedObject);

var buttonNewRect = new Rect(fieldRect.xMax, lineRect.y, buttonWidth, lineRect.height);
var buttonCopyRect = new Rect(buttonNewRect.xMax, lineRect.y, buttonWidth, lineRect.height);
EditorGUI.PrefixLabel(labelRect, CoreEditorUtils.GetContent("Profile|A reference to a profile asset."));
EditorGUI.PrefixLabel(labelRect, CoreEditorUtils.GetContent(actualTarget.HasInstantiatedProfile() ? "Profile (Instance)|A copy of a profile asset." : "Profile|A reference to a profile asset."));
var profile = (VolumeProfile)EditorGUI.ObjectField(fieldRect, m_Profile.objectReferenceValue, typeof(VolumeProfile), false);
VolumeProfile profile = null;
if (actualTarget.HasInstantiatedProfile())
profile = (VolumeProfile)EditorGUI.ObjectField(fieldRect, actualTarget.profile, typeof(VolumeProfile), false);
else
profile = (VolumeProfile)EditorGUI.ObjectField(fieldRect, m_Profile.objectReferenceValue, typeof(VolumeProfile), false);
if (actualTarget.HasInstantiatedProfile()) // Clear the instantiated profile, from now on we're using shared again
actualTarget.profile = null;
}
EditorGUI.EndProperty();

var scene = actualTarget.gameObject.scene;
var asset = VolumeProfileFactory.CreateVolumeProfile(scene, targetName);
m_Profile.objectReferenceValue = asset;
actualTarget.profile = null; // Make sure we're not using an instantiated profile anymore
if (showCopy && GUI.Button(buttonCopyRect, CoreEditorUtils.GetContent("Clone|Create a new profile and copy the content of the currently assigned profile."), EditorStyles.miniButtonRight))
if (showCopy && GUI.Button(buttonCopyRect, CoreEditorUtils.GetContent(actualTarget.HasInstantiatedProfile() ? "Save|Save the instantiated profile" : "Clone|Create a new profile and copy the content of the currently assigned profile."), EditorStyles.miniButtonRight))
var origin = (VolumeProfile)m_Profile.objectReferenceValue;
var path = AssetDatabase.GetAssetPath(origin);
var origin = profileRef;
var path = AssetDatabase.GetAssetPath(m_Profile.objectReferenceValue);
path = AssetDatabase.GenerateUniqueAssetPath(path);
var asset = Instantiate(origin);

AssetDatabase.Refresh();
m_Profile.objectReferenceValue = asset;
actualTarget.profile = null; // Make sure we're not using an instantiated profile anymore
assetHasChanged = true;
}
}

if (m_Profile.objectReferenceValue == null)
if (m_Profile.objectReferenceValue == null && !actualTarget.HasInstantiatedProfile())
{
if (assetHasChanged)
m_ComponentList.Clear(); // Asset wasn't null before, do some cleanup

if (assetHasChanged)
RefreshEffectListEditor((VolumeProfile)m_Profile.objectReferenceValue);
if (assetHasChanged || profileRef != m_ComponentList.asset)
RefreshEffectListEditor(profileRef);
if (!multiEdit)
{

2
ScriptableRenderPipeline/Core/CoreRP/ShaderLibrary/Common.hlsl


#include "API/Metal.hlsl"
#elif defined(SHADER_API_VULKAN)
#include "API/Vulkan.hlsl"
#elif defined(SHADER_API_SWITCH)
#include "API/Switch.hlsl"
#elif defined(SHADER_API_GLCORE)
#include "API/GLCore.hlsl"
#elif defined(SHADER_API_GLES3)

2
ScriptableRenderPipeline/Core/CoreRP/Shadow/DebugDisplayShadowMap.shader


{
HLSLINCLUDE
#pragma target 4.5
#pragma only_renderers d3d11 ps4 xboxone vulkan metal
#pragma only_renderers d3d11 ps4 xboxone vulkan metal switch
#include "CoreRP/ShaderLibrary/Common.hlsl"

2
ScriptableRenderPipeline/Core/CoreRP/Shadow/ShadowBlurMoments.compute


#include "CoreRP/ShaderLibrary/Common.hlsl"
#include "CoreRP/ShaderLibrary/Shadow/ShadowMoments.hlsl"
#pragma only_renderers d3d11 ps4 xboxone vulkan metal
#pragma only_renderers d3d11 ps4 xboxone vulkan metal switch
#if MAX_MSAA > 1
Texture2DMS<float> depthTex;

2
ScriptableRenderPipeline/Core/CoreRP/Shadow/ShadowClear.shader


{
HLSLINCLUDE
#pragma target 4.5
#pragma only_renderers d3d11 ps4 xboxone vulkan metal
#pragma only_renderers d3d11 ps4 xboxone vulkan metal switch
#include "CoreRP/ShaderLibrary/Common.hlsl"
ENDHLSL

5
ScriptableRenderPipeline/Core/CoreRP/Volume/Volume.cs


}
}
public bool HasInstantiatedProfile()
{
return m_InternalProfile != null;
}
// Needed for state tracking (see the comments in Update)
int m_PreviousLayer;
float m_PreviousPriority;

23
ScriptableRenderPipeline/Core/CoreRP/Volume/VolumeManager.cs


public sealed class VolumeManager
{
//>>> System.Lazy<T> is broken in Unity (legacy runtime) so we'll have to do it ourselves :|
static volatile VolumeManager s_Instance;
static object s_LockObj = new UnityObject();
static readonly VolumeManager s_Instance = new VolumeManager();
public static VolumeManager instance { get { return s_Instance; } }
public static VolumeManager instance
{
get
{
// Double-lock checking
if (s_Instance == null)
{
lock (s_LockObj) // Lock on a separate object to avoid deadlocks
{
if (s_Instance == null)
s_Instance = new VolumeManager();
}
}
return s_Instance;
}
}
// Explicit static constructor to tell the C# compiler not to mark type as beforefieldinit
static VolumeManager() { }
//<<<
// Internal stack

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Camera/HDCamera.cs


m_ActualHeight = camera.pixelHeight;
var screenWidth = m_ActualWidth;
var screenHeight = m_ActualHeight;
#if !UNITY_SWITCH
if (frameSettings.enableStereo)
{
screenWidth = XRSettings.eyeTextureWidth;

ConfigureStereoMatrices();
}
#endif
// Unfortunately sometime (like in the HDCameraEditor) HDUtils.hdrpSettings can be null because of scripts that change the current pipeline...
m_msaaSamples = HDUtils.hdrpSettings != null ? HDUtils.hdrpSettings.msaaSampleCount : MSAASamples.None;

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Debug/DebugColorPicker.shader


HLSLPROGRAM
#pragma target 4.5
#pragma only_renderers d3d11 ps4 xboxone vulkan metal
#pragma only_renderers d3d11 ps4 xboxone vulkan metal switch
#pragma vertex Vert
#pragma fragment Frag

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Debug/DebugDisplayLatlong.shader


HLSLPROGRAM
#pragma target 4.5
#pragma only_renderers d3d11 ps4 xboxone vulkan metal
#pragma only_renderers d3d11 ps4 xboxone vulkan metal switch
#pragma vertex Vert
#pragma fragment Frag

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Debug/DebugFullScreen.shader


HLSLPROGRAM
#pragma target 4.5
#pragma only_renderers d3d11 ps4 xboxone vulkan metal
#pragma only_renderers d3d11 ps4 xboxone vulkan metal switch
#pragma vertex Vert
#pragma fragment Frag

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Debug/DebugViewMaterialGBuffer.shader


HLSLPROGRAM
#pragma target 4.5
#pragma only_renderers d3d11 ps4 xboxone vulkan metal
#pragma only_renderers d3d11 ps4 xboxone vulkan metal switch
#pragma vertex Vert
#pragma fragment Frag

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Debug/DebugViewTiles.shader


HLSLPROGRAM
#pragma target 4.5
#pragma only_renderers d3d11 ps4 xboxone vulkan metal
#pragma only_renderers d3d11 ps4 xboxone vulkan metal switch
#pragma vertex Vert
#pragma fragment Frag

4
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/BuildPlayer/HDRPCustomBuildProcessor.cs


report.summary.platform == BuildTarget.StandaloneLinuxUniversal ||
report.summary.platform == BuildTarget.StandaloneOSX ||
report.summary.platform == BuildTarget.XboxOne ||
report.summary.platform == BuildTarget.PS4 /* ||
report.summary.platform == BuildTarget.Switch */)
report.summary.platform == BuildTarget.PS4 ||
report.summary.platform == BuildTarget.Switch)
{
return ;
}

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Material/DiffusionProfile/DrawDiffusionProfile.shader


HLSLPROGRAM
#pragma target 4.5
#pragma only_renderers d3d11 ps4 xboxone vulkan metal
#pragma only_renderers d3d11 ps4 xboxone vulkan metal switch
#pragma vertex Vert
#pragma fragment Frag

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Material/DiffusionProfile/DrawTransmittanceGraph.shader


HLSLPROGRAM
#pragma target 4.5
#pragma only_renderers d3d11 ps4 xboxone vulkan metal
#pragma only_renderers d3d11 ps4 xboxone vulkan metal switch
#pragma vertex Vert
#pragma fragment Frag

196
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Material/StackLit/BaseMaterialUI.cs


public abstract void OnFindProperty(MaterialProperty[] props);
public abstract void OnGUI();
internal abstract string ToShaderPropertiesStringInternal();
}
public class GroupProperty : BaseProperty

private readonly BaseProperty[] m_ChildProperties;
private readonly Property m_Show;
public bool Foldout = false;
public GroupProperty(BaseMaterialGUI parent, BaseProperty[] childProperties, Func<object, bool> isVisible = null)
: this(parent, string.Empty, childProperties, isVisible)
public GroupProperty(BaseMaterialGUI parent, string groupName, BaseProperty[] childProperties, Func<object, bool> isVisible = null)
: this(parent, groupName, string.Empty, childProperties, isVisible)
public GroupProperty(BaseMaterialGUI parent, string groupTitle, BaseProperty[] childProperties, Func<object, bool> isVisible = null)
public GroupProperty(BaseMaterialGUI parent, string groupName, string groupTitle, BaseProperty[] childProperties, Func<object, bool> isVisible = null)
m_Show = new Property(parent, groupName + "Show", "", false);
m_Title = groupTitle;
m_ChildProperties = childProperties;
}

m_Show.OnFindProperty(props);
foreach (var c in m_ChildProperties)
{
c.OnFindProperty(props);

{
if (!string.IsNullOrEmpty(m_Title))
{
Foldout = EditorGUILayout.Foldout(Foldout, m_Title);
m_Show.BoolValue = EditorGUILayout.Foldout(m_Show.BoolValue, m_Title);
else
else if (m_Show.IsValid)
Foldout = true;
m_Show.BoolValue = true;
if (Foldout)
if (!m_Show.IsValid || m_Show.BoolValue)
{
EditorGUI.indentLevel++;

}
}
}
internal override string ToShaderPropertiesStringInternal()
{
string outputString = string.Empty;
foreach (var c in m_ChildProperties)
{
outputString += c.ToShaderPropertiesStringInternal() + "\n";
}
return outputString;
}
protected MaterialProperty m_MaterialProperty = null;
public MaterialProperty m_MaterialProperty = null;
protected readonly GUIContent m_GuiContent = null;

{
get { return m_MaterialProperty != null; }
}
public float FloatValue
{
get { return m_MaterialProperty.floatValue; }

public bool BoolValue
{
get { return Math.Abs(m_MaterialProperty.floatValue) > 0.0f; }
get { return m_MaterialProperty == null || Math.Abs(m_MaterialProperty.floatValue) > 0.0f; }
set { m_MaterialProperty.floatValue = value ? 1.0f : 0.0f; }
}

Parent.m_MaterialEditor.ShaderProperty(m_MaterialProperty, m_GuiContent);
}
}
internal override string ToShaderPropertiesStringInternal()
{
if (IsValid
&& (IsVisible == null || IsVisible(this)))
{
switch (m_MaterialProperty.type)
{
case MaterialProperty.PropType.Color:
return string.Format("{0}(\"{1}\", Color) = (1, 1, 1, 1)", PropertyName, PropertyText);
case MaterialProperty.PropType.Vector:
return string.Format("{0}(\"{1}\", Vector) = (0, 0, 0, 0)", PropertyName, PropertyText);
case MaterialProperty.PropType.Float:
return string.Format("{0}(\"{1}\", Float) = 0.0", PropertyName, PropertyText);
case MaterialProperty.PropType.Range:
return string.Format("{0}(\"{1}\", Range({2:0.0###}, {3:0.0###})) = 0", PropertyName, PropertyText, m_MaterialProperty.rangeLimits.x, m_MaterialProperty.rangeLimits.y);
case MaterialProperty.PropType.Texture:
return string.Format("{0}(\"{1}\", 2D) = \"white\" {{}}", PropertyName, PropertyText);
default:
// Unknown type... default to outputting a float.
return string.Format("{0}(\"{1}\", Float) = 0.0", PropertyName, PropertyText);
}
}
else
{
// Material property is not loaded, default to outputting a float.
return string.Format("{0}(\"{1}\", Float) = 0.0", PropertyName, PropertyText);
}
}
}
public class ComboProperty : Property

Parent.m_MaterialEditor.TexturePropertySingleLine(m_GuiContent, m_MaterialProperty, m_ExtraProperty);
}
}
internal override string ToShaderPropertiesStringInternal()
{
return string.Format("{0}(\"{1}\", 2D) = \"white\" {{}}\n" +
"{2}(\"{3}\", Float) = 0.0",
PropertyName, PropertyText,
ExtraPropertyName, ExtraPropertyName);
}
}
public class TextureProperty : Property

A,
}
public enum PlanarSpace
{
World,
Local
}
public enum NormalSpace
{
Tangent,
Object
}
public enum UVMapping
{
UV0,

Triplanar,
}
public Property m_Show;
public Property m_ConstantProperty;
public Property m_LocalOrWorldProperty;
public ComboProperty m_LocalOrWorldProperty;
public ComboProperty m_TilingProperty;
public ComboProperty m_NormalSpaceProperty;
public Property m_ChannelProperty;

public bool Foldout = false;
public string m_ConstantPropertyName;
public TextureProperty(BaseMaterialGUI parent, string propertyName, string constantPropertyName, string guiText, bool isMandatory = true, bool isNormalMap = false)
: this(parent, propertyName, constantPropertyName, guiText, string.Empty, isMandatory, isNormalMap)
public bool m_IsNormalMap;
public TextureProperty(BaseMaterialGUI parent, string propertyName, string constantPropertyName, string guiText, bool useConstantAsTint, bool isMandatory = true, bool isNormalMap = false)
: this(parent, propertyName, constantPropertyName, guiText, string.Empty, useConstantAsTint, isMandatory, isNormalMap)
public TextureProperty(BaseMaterialGUI parent, string propertyName, string constantPropertyName, string guiText, string toolTip, bool isMandatory = true, bool isNormalMap = false)
public TextureProperty(BaseMaterialGUI parent, string propertyName, string constantPropertyName, string guiText, string toolTip, bool useConstantAsTint, bool isMandatory = true, bool isNormalMap = false)
m_TextureProperty = new TextureOneLineProperty(parent, propertyName, constantPropertyName, guiText, toolTip, isMandatory);
m_IsNormalMap = isNormalMap;
m_ConstantPropertyName = constantPropertyName;
m_Show = new Property(parent, propertyName + "Show", "", isMandatory);
if (useConstantAsTint == false)
{
m_ConstantProperty = new Property(parent, constantPropertyName, guiText, toolTip, isMandatory);
}
m_TextureProperty = new TextureOneLineProperty(parent, propertyName, useConstantAsTint ? constantPropertyName : string.Empty, guiText, toolTip, isMandatory);
m_LocalOrWorldProperty = new Property(parent, propertyName + "LocalOrWorld", "Local Space", "Whether Planar or Triplanar is using Local or World space.", false);
m_LocalOrWorldProperty = new ComboProperty(parent, propertyName + "UVLocal", "Local or world", Enum.GetNames(typeof(PlanarSpace)), false);
m_TilingProperty = new ComboProperty(parent, propertyName + "Tiling", "Tiling", Enum.GetNames(typeof(Tiling)), false);
m_NormalSpaceProperty = new ComboProperty(parent, propertyName + "ObjSpace", "Normal space", Enum.GetNames(typeof(NormalSpace)), false);
m_ChannelProperty = new Property(parent, propertyName + "Channel", "Channel", false);
m_ChannelProperty = new ComboProperty(parent, propertyName + "Channel", "Channel", Enum.GetNames(typeof(Channel)), false);
m_RemapProperty = new Property(parent, constantPropertyName + "Remap", "Remapping", "Defines the range to remap/scale the values in texture", false);
m_InvertRemapProperty = new Property(parent, constantPropertyName + "RemapInverted", "Invert Remapping", "Whether the mapping values are inverted.", false);

{
base.OnFindProperty(props);
m_Show.OnFindProperty(props);
if (m_ConstantProperty != null)
{
m_ConstantProperty.OnFindProperty(props);
}
m_TilingProperty.OnFindProperty(props);
m_NormalSpaceProperty.OnFindProperty(props);
m_ChannelProperty.OnFindProperty(props);
m_RemapProperty.OnFindProperty(props);
m_InvertRemapProperty.OnFindProperty(props);

{
if (m_TextureProperty.IsValid
&& (IsVisible == null || IsVisible(this)))
if ((IsVisible == null || IsVisible(this))
&& m_Show.IsValid
&& m_TextureProperty.IsValid)
Foldout = EditorGUILayout.Foldout(Foldout, PropertyText);
if (Foldout)
m_Show.BoolValue = EditorGUILayout.Foldout(m_Show.BoolValue, PropertyText);
if (m_Show.BoolValue)
if (m_ConstantProperty != null && m_ConstantProperty.IsValid
&& m_TextureProperty.TextureValue == null)
{
m_ConstantProperty.OnGUI();
}
m_TextureProperty.OnGUI();

m_LocalOrWorldProperty.OnGUI();
m_TilingProperty.OnGUI();
m_LocalOrWorldProperty.OnGUI();
Parent.m_MaterialEditor.TextureScaleOffsetProperty(m_TextureProperty.m_MaterialProperty);
if (m_UvSetProperty.FloatValue >= (float)UVMapping.PlanarXY)
{
m_LocalOrWorldProperty.OnGUI();
}
if (m_IsNormalMap)
{
m_NormalSpaceProperty.OnGUI();
}
if (m_RemapProperty.IsValid)
{

}
}
}
}
internal override string ToShaderPropertiesStringInternal()
{
string constantName = m_ConstantPropertyName.StartsWith("_")
? m_ConstantPropertyName.Substring(1)
: m_ConstantPropertyName;
return string.Format(
"[HideInInspector] {0}MapShow(\"{1} Show\", Float) = 0\n" +
"{0}(\"{1}\", Range(0.0, 1.0)) = 0\n" +
"{2}(\"{1} Map\", 2D) = " + (m_IsNormalMap ? "\"bump\"" : "\"white\"") + " {{ }}\n" +
"{0}UseMap(\"{1} Use Map\", Float) = 0\n" +
(m_IsNormalMap ? "{0}ObjSpace(\"{1} Object Space\", Float) = 0\n" : "") +
"{2}UV(\"{1} Map UV\", Float) = 0.0\n" +
"{2}UVLocal(\"{1} Map UV Local\", Float) = 0.0\n" +
"{2}Channel(\"{1} Map Channel\", Float) = 0.0\n" +
"{2}ChannelMask(\"{1} Map Channel Mask\", Vector) = (1, 0, 0, 0)\n" +
"{0}Remap(\"{1} Remap\", Vector) = (0, 1, 0, 0)\n" +
"[ToggleUI] {0}RemapInverted(\"Invert {1} Remap\", Float) = 0.0\n" +
"[HideInInspector] {0}Range(\"{1} Range\", Vector) = (0, 1, 0, 0)\n",
m_ConstantPropertyName, constantName, PropertyName);
}
}
#endregion
}
}

204
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Material/StackLit/StackLitUI.cs


{
class StackLitGUI : BaseMaterialGUI
{
protected static class StylesStackLit
{
public static GUIContent useLocalPlanarMapping = new GUIContent("Use Local Planar Mapping", "Use local space for planar/triplanar mapping instead of world space");
};
#region Strings
protected const string k_DoubleSidedNormalMode = "_DoubleSidedNormalMode";

// Base
protected const string k_BaseColor = "_BaseColor";
protected const string k_BaseColorMap = "_BaseColorMap";
protected const string k_BaseColorMapUV = "_BaseColorMapUV";
protected const string k_MetallicRemapMin = "_MetallicRemap";
protected const string k_MetallicMapUV = "_MetallicMapUV";
protected const string k_MetallicRemap = "_MetallicRemap";
protected const string k_MetallicRemapInverted = "_MetallicRemapInverted";
protected const string k_MetallicRange = "_MetallicRange";
protected const string k_Smoothness1RemapMin = "_SmoothnessARemap";
protected const string k_Smoothness1MapUV = "_SmoothnessAMapUV";
protected const string k_Smoothness1Remap = "_SmoothnessARemap";
protected const string k_Smoothness1RemapInverted = "_SmoothnessARemapInverted";
protected const string k_Smoothness1Range = "_SmoothnessARange";
protected const string k_NormalMapUV = "_NormalMapUV";
protected const string k_EmissiveColorMapUV = "_EmissiveColorMapUV";
protected const string k_DiffusionProfileName = "_DiffusionProfile";
protected const string k_SubsurfaceMaskName = "_SubsurfaceMask";
protected const string k_DiffusionProfile = "_DiffusionProfile";
protected const string k_SubsurfaceMask = "_SubsurfaceMask";
protected const string k_SubsurfaceMaskMapUV = "_SubsurfaceMaskMapUV";
protected const string k_SubsurfaceMaskRemap = "_SubsurfaceMaskRemap";
protected const string k_SubsurfaceMaskRemapInverted = "_SubsurfaceMaskRemapInverted";
protected const string k_SubsurfaceMaskRange = "_SubsurfaceMaskRange";
protected const string k_ThicknessName = "_Thickness";
protected const string k_ThicknessMapName = "_ThicknessMap";
protected const string k_ThicknessRemapName = "_ThicknessRemap";
// Translucency
protected const string k_Thickness = "_Thickness";
protected const string k_ThicknessMap = "_ThicknessMap";
protected const string k_ThicknessMapUV = "_ThicknessMapUV";
protected const string k_ThicknessRemap = "_ThicknessRemap";
protected const string k_ThicknessRemapInverted = "_ThicknessRemapInverted";
protected const string k_ThicknessRange = "_ThicknessRange";
protected const string k_SmoothnessRemap2Min = "_SmoothnessBRemap";
protected const string k_Smoothness2MapUV = "_SmoothnessBMapUV";
protected const string k_Smoothness2Remap = "_SmoothnessBRemap";
protected const string k_Smoothness2RemapInverted = "_SmoothnessBRemapInverted";
protected const string k_Smoothness2Range = "_SmoothnessBRange";
protected const string k_LobeMix = "_LobeMix";

public StackLitGUI()
{
_baseMaterialProperties = new GroupProperty(this, new BaseProperty[]
_baseMaterialProperties = new GroupProperty(this, "_BaseMaterial", new BaseProperty[]
new Property(this, k_DoubleSidedNormalMode, "Normal mode", "This will modify the normal base on the selected mode. Mirror: Mirror the normal with vertex normal plane, Flip: Flip the normal.", false),
new Property(this, k_DoubleSidedNormalMode, "Normal mode", "This will modify the normal base on the selected mode. Mirror: Mirror the normal with vertex normal plane, Flip: Flip the normal.", false),
_materialProperties = new GroupProperty(this, new BaseProperty[]
_materialProperties = new GroupProperty(this, "_Material", new BaseProperty[]
new GroupProperty(this, "Standard", new BaseProperty[]
new GroupProperty(this, "_Standard", "Standard", new BaseProperty[]
new TextureProperty(this, k_BaseColorMap, k_BaseColor, "Base Color + Opacity", "Albedo (RGB) and Opacity (A)", false),
new TextureProperty(this, k_MetallicMap, k_Metallic, "Metallic", "Metallic", false),
new TextureProperty(this, k_Smoothness1Map, k_Smoothness1, "Smoothness", "Smoothness", false),
new TextureProperty(this, k_BaseColorMap, k_BaseColor, "Base Color + Opacity", "Albedo (RGB) and Opacity (A)", true, false),
new TextureProperty(this, k_MetallicMap, k_Metallic, "Metallic", "Metallic", false, false),
new TextureProperty(this, k_Smoothness1Map, k_Smoothness1, "Smoothness", "Smoothness", false, false),
new TextureProperty(this, k_NormalMap, k_NormalScale, "Normal TODO", "Normal Map", false, true),
new TextureProperty(this, k_NormalMap, k_NormalScale, "Normal", "Normal Map", false, false, true),
new GroupProperty(this, "Emissive", new BaseProperty[]
new GroupProperty(this, "_Emissive", "Emissive", new BaseProperty[]
new TextureProperty(this, k_EmissiveColorMap, k_EmissiveColor, "Emissive Color", "Emissive", false),
new TextureProperty(this, k_EmissiveColorMap, k_EmissiveColor, "Emissive Color", "Emissive", true, false),
//new GroupProperty(this, "Coat", new BaseProperty[]
//new GroupProperty(this, "_Coat", "Coat", new BaseProperty[]
// new TextureProperty(this, k_BaseColorMap, k_BaseColor, "SmoothnessCoat", "smoothnessCoat", false),
// new TextureProperty(this, k_BaseColorMap, k_BaseColor, "Index Of Refraction", "iorCoat", false),
// new TextureProperty(this, k_BaseColorMap, k_BaseColor, "Normal", "normal Coat", false),
// new TextureProperty(this, k_BaseColorMap, k_BaseColor, "SmoothnessCoat", "smoothnessCoat", false, false),
// new TextureProperty(this, k_BaseColorMap, k_BaseColor, "Index Of Refraction", "iorCoat", false, false),
// new TextureProperty(this, k_BaseColorMap, k_BaseColor, "Normal", "normal Coat", false, false),
new GroupProperty(this, "Sub-Surface Scattering", new BaseProperty[]
new GroupProperty(this, "_SSS", "Sub-Surface Scattering", new BaseProperty[]
new DiffusionProfileProperty(this, k_DiffusionProfileName, "Diffusion Profile", "A profile determines the shape of the SSS/transmission filter.", false),
new TextureProperty(this, k_SubsurfaceMaskName, "Subsurface mask map (R)", "Determines the strength of the subsurface scattering effect.", false),
new DiffusionProfileProperty(this, k_DiffusionProfile, "Diffusion Profile", "A profile determines the shape of the SSS/transmission filter.", false),
new TextureProperty(this, k_SubsurfaceMaskMap, k_SubsurfaceMask, "Subsurface mask map (R)", "Determines the strength of the subsurface scattering effect.", false, false),
new GroupProperty(this, "Second Specular Lobe", new BaseProperty[]
new GroupProperty(this, "_Lobe2", "Second Specular Lobe", new BaseProperty[]
new TextureProperty(this, k_Smoothness2Map, k_Smoothness2, "Smoothness2", "Smoothness2", false),
new Property(this, k_LobeMix, "Lobe Mix", "Lobe Mix", false),
new TextureProperty(this, k_Smoothness2Map, k_Smoothness2, "Smoothness2", "Smoothness2", false, false),
new Property(this, k_LobeMix, "Lobe Mix", "Lobe Mix", false),
//new GroupProperty(this, "Anisotropy", new BaseProperty[]
//new GroupProperty(this, "_Anisotropy", "Anisotropy", new BaseProperty[]
//{
// new TextureProperty(this, k_BaseColorMap, k_BaseColor, "Anisotropy Strength", "anisotropy strength", false),
// new TextureProperty(this, k_BaseColorMap, k_BaseColor, "Rotation", "rotation", false),

new GroupProperty(this, "Transmission", new BaseProperty[]
new GroupProperty(this, "_Transmission", "Transmission", new BaseProperty[]
new DiffusionProfileProperty(this, k_DiffusionProfileName, "Diffusion Profile", "A profile determines the shape of the SSS/transmission filter.", false),
new TextureProperty(this, k_ThicknessName, "Thickness", "If subsurface scattering is enabled, low values allow some light to be transmitted through the object.", false),
new DiffusionProfileProperty(this, k_DiffusionProfile, "Diffusion Profile", "A profile determines the shape of the SSS/transmission filter.", false),
new TextureProperty(this, k_ThicknessMap, k_Thickness, "Thickness", "If subsurface scattering is enabled, low values allow some light to be transmitted through the object.", false),
//new GroupProperty(this, "Iridescence", new BaseProperty[]
//new GroupProperty(this, "_Iridescence", "Iridescence", new BaseProperty[]
//new GroupProperty(this, "Glint", new BaseProperty[]
//new GroupProperty(this, "_Glint", "Glint", new BaseProperty[]
//{
// new TextureProperty(this, k_BaseColorMap, k_BaseColor, "Density", "Density:", false),
// new TextureProperty(this, k_BaseColorMap, k_BaseColor, "Tint", "Tint", false),

{
//base.FindMaterialProperties(props);
_materialProperties.OnFindProperty(props);
}
}
protected override void BaseMaterialPropertiesGUI()
{

protected override void MaterialPropertiesGUI(Material material)
{
//if (GUILayout.Button("Generate All Properties"))
//{
// Debug.Log(_materialProperties.ToShaderPropertiesStringInternal());
//}
_materialProperties.OnGUI();
}

SetupMaterialKeywordsAndPass(material);
}
protected static void SetupTextureMaterialProperty(Material material, string basePropertyName)
{
string useMapPropertyName = basePropertyName + "UseMap";
string mapPropertyName = basePropertyName + "Map";
string remapPropertyName = basePropertyName + "Remap";
string invertPropertyName = basePropertyName + "RemapInverted";
string rangePropertyName = basePropertyName + "Range";
string channelPropertyName = basePropertyName + "MapChannel";
string channelMaskPropertyName = basePropertyName + "MapChannelMask";
if (material.GetTexture(mapPropertyName))
{
Vector4 rangeVector = material.GetVector(remapPropertyName);
if (material.GetFloat(invertPropertyName) > 0.0f)
{
float s = rangeVector.x;
rangeVector.x = rangeVector.y;
rangeVector.y = s;
}
material.SetFloat(useMapPropertyName, 1.0f);
material.SetVector(rangePropertyName, rangeVector);
int channel = (int)material.GetFloat(channelPropertyName);
switch (channel)
{
case 0:
material.SetVector(channelMaskPropertyName, new Vector4(1.0f, 0.0f, 0.0f, 0.0f));
break;
case 1:
material.SetVector(channelMaskPropertyName, new Vector4(0.0f, 1.0f, 0.0f, 0.0f));
break;
case 2:
material.SetVector(channelMaskPropertyName, new Vector4(0.0f, 0.0f, 1.0f, 0.0f));
break;
case 3:
material.SetVector(channelMaskPropertyName, new Vector4(0.0f, 0.0f, 0.0f, 1.0f));
break;
}
}
else
{
material.SetFloat(useMapPropertyName, 0.0f);
material.SetVector(rangePropertyName, new Vector4(0.0f, 1.0f, 0.0f, 0.0f));
material.SetVector(channelMaskPropertyName, new Vector4(1.0f, 0.0f, 0.0f, 0.0f));
}
}
static public void SetupMaterialKeywordsAndPass(Material material)
public static void SetupMaterialKeywordsAndPass(Material material)
{
//TODO see BaseLitUI.cs:SetupBaseLitKeywords (stencil etc)
SetupBaseUnlitKeywords(material);

}
}
//NOTE: For SSS in forward and split lighting, obviously we don't have a gbuffer pass,
//NOTE: For SSS in forward and split lighting, obviously we don't have a gbuffer pass,
// so no stencil tagging there, but velocity? To check...
//TODO: stencil state, displacement, wind, depthoffset, tessellation

CoreUtils.SetKeyword(material, "_NORMALMAP_TANGENT_SPACE", true);
CoreUtils.SetKeyword(material, "_NORMALMAP", material.GetTexture(k_NormalMap));
CoreUtils.SetKeyword(material, "_SMOOTHNESSMASKMAPA", material.GetTexture(k_Smoothness1Map));
CoreUtils.SetKeyword(material, "_SMOOTHNESSMASKMAPB", material.GetTexture(k_Smoothness2Map));
CoreUtils.SetKeyword(material, "_METALLICMAP", material.GetTexture(k_MetallicMap));
CoreUtils.SetKeyword(material, "_EMISSIVE_COLOR_MAP", material.GetTexture(k_EmissiveColorMap));
//bool needUV2 = (LitGUI.UVBaseMapping)material.GetFloat(k_UVBase) == LitGUI.UVBaseMapping.UV2;
//bool needUV3 = (LitGUI.UVBaseMapping)material.GetFloat(k_UVBase) == LitGUI.UVBaseMapping.UV3;
SetupTextureMaterialProperty(material, k_Metallic);
SetupTextureMaterialProperty(material, k_Smoothness1);
SetupTextureMaterialProperty(material, k_Smoothness2);
SetupTextureMaterialProperty(material, k_SubsurfaceMask);
SetupTextureMaterialProperty(material, k_Thickness);
//if (needUV3)
//{
// material.DisableKeyword("_REQUIRE_UV2");
// material.EnableKeyword("_REQUIRE_UV3");
//}
//else if (needUV2)
//{
// material.EnableKeyword("_REQUIRE_UV2");
// material.DisableKeyword("_REQUIRE_UV3");
//}
//else
//{
// material.DisableKeyword("_REQUIRE_UV2");
// material.DisableKeyword("_REQUIRE_UV3");
//}
// Check if we are using specific UVs.
TextureProperty.UVMapping[] uvIndices = new[]
{
(TextureProperty.UVMapping)material.GetFloat(k_BaseColorMapUV),
(TextureProperty.UVMapping)material.GetFloat(k_MetallicMapUV),
(TextureProperty.UVMapping)material.GetFloat(k_NormalMapUV),
(TextureProperty.UVMapping)material.GetFloat(k_Smoothness1MapUV),
(TextureProperty.UVMapping)material.GetFloat(k_Smoothness2MapUV),
(TextureProperty.UVMapping)material.GetFloat(k_EmissiveColorMapUV),
(TextureProperty.UVMapping)material.GetFloat(k_SubsurfaceMaskMapUV),
(TextureProperty.UVMapping)material.GetFloat(k_ThicknessMapUV),
};
bool requireUv2 = false;
bool requireUv3 = false;
bool requireTriplanar = false;
for (int i = 0; i < uvIndices.Length; ++i)
{
requireUv2 = requireUv2 || uvIndices[i] == TextureProperty.UVMapping.UV2;
requireUv3 = requireUv3 || uvIndices[i] == TextureProperty.UVMapping.UV3;
requireTriplanar = requireTriplanar || uvIndices[i] == TextureProperty.UVMapping.Triplanar;
}
CoreUtils.SetKeyword(material, "_EMISSIVE_COLOR_MAP", material.GetTexture(k_EmissiveColorMap));
//CoreUtils.SetKeyword(material, "_USE_UV2", requireUv2);
//CoreUtils.SetKeyword(material, "_USE_UV3", requireUv3);
CoreUtils.SetKeyword(material, "_USE_TRIPLANAR", requireTriplanar);
}
}
} // namespace UnityEditor

5
ScriptableRenderPipeline/HDRenderPipeline/HDRP/HDRenderPipeline.cs


return false;
}
#if !UNITY_SWITCH
// VR is not supported currently in HD
if (XRSettings.isDeviceActive)
{

}
#endif
return true;
}

SystemInfo.graphicsDeviceType == GraphicsDeviceType.PlayStation4 ||
SystemInfo.graphicsDeviceType == GraphicsDeviceType.XboxOne ||
SystemInfo.graphicsDeviceType == GraphicsDeviceType.XboxOneD3D12 ||
SystemInfo.graphicsDeviceType == GraphicsDeviceType.Vulkan)
SystemInfo.graphicsDeviceType == GraphicsDeviceType.Vulkan ||
SystemInfo.graphicsDeviceType == (GraphicsDeviceType)22 /*GraphicsDeviceType.Switch*/)
{
return true;
}

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/Deferred.shader


HLSLPROGRAM
#pragma target 4.5
#pragma only_renderers d3d11 ps4 xboxone vulkan metal
#pragma only_renderers d3d11 ps4 xboxone vulkan metal switch
#pragma vertex Vert
#pragma fragment Frag

4
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/DeferredDirectionalShadow.compute


// Each #kernel tells which function to compile; you can have many kernels
// Each #kernel tells which function to compile; you can have many kernels
#pragma kernel DeferredDirectionalShadow DEFERRED_DIRECTIONAL=DeferredDirectionalShadow
#pragma kernel DeferredDirectionalShadow_Contact DEFERRED_DIRECTIONAL=DeferredDirectionalShadow_Contact ENABLE_CONTACT_SHADOWS
#pragma kernel DeferredDirectionalShadow_Normals DEFERRED_DIRECTIONAL=DeferredDirectionalShadow_Normals ENABLE_NORMALS

#include "../ShaderVariables.hlsl"
#include "Lighting.hlsl"
#pragma only_renderers d3d11 ps4 xboxone vulkan metal
#pragma only_renderers d3d11 ps4 xboxone vulkan metal switch
//#pragma enable_d3d11_debug_symbols

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/LightLoop/Deferred.compute


#include "../../Debug/DebugDisplay.hlsl"
#include "../../Lighting/Lighting.hlsl" // This include Material.hlsl
#pragma only_renderers d3d11 ps4 xboxone vulkan metal
#pragma only_renderers d3d11 ps4 xboxone vulkan metal switch
//-------------------------------------------------------------------------------------
// variable declaration

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/LightLoop/LightLoop.cs


using System;
using System;
using System.Collections.Generic;
using UnityEngine.Experimental.Rendering.HDPipeline.Internal;
using UnityEngine.Rendering;

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/LightLoop/builddispatchindirect.compute


#pragma kernel BuildDispatchIndirect
#pragma only_renderers d3d11 ps4 xboxone vulkan metal
#pragma only_renderers d3d11 ps4 xboxone vulkan metal switch
#include "CoreRP/ShaderLibrary/Common.hlsl"
#include "LightLoop.cs.hlsl"

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/LightLoop/cleardispatchindirect.compute


#pragma kernel ClearDispatchIndirect
#pragma only_renderers d3d11 ps4 xboxone vulkan metal
#pragma only_renderers d3d11 ps4 xboxone vulkan metal switch
RWBuffer<uint> g_DispatchIndirectBuffer : register( u0 ); // Indirect arguments have to be in a _buffer_, not a structured buffer

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/LightLoop/lightlistbuild-bigtile.compute


#include "SortingComputeUtils.hlsl"
#include "LightCullUtils.hlsl"
#pragma only_renderers d3d11 ps4 xboxone vulkan metal
#pragma only_renderers d3d11 ps4 xboxone vulkan metal switch
#define EXACT_EDGE_TESTS
#define PERFORM_SPHERICAL_INTERSECTION_TESTS

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/LightLoop/lightlistbuild-clustered.compute


#include "SortingComputeUtils.hlsl"
#endif
#pragma only_renderers d3d11 ps4 xboxone vulkan metal
#pragma only_renderers d3d11 ps4 xboxone vulkan metal switch
//#define EXACT_EDGE_TESTS
#define PERFORM_SPHERICAL_INTERSECTION_TESTS

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/LightLoop/lightlistbuild.compute


#include "SortingComputeUtils.hlsl"
#endif
#pragma only_renderers d3d11 ps4 xboxone vulkan metal
#pragma only_renderers d3d11 ps4 xboxone vulkan metal switch
#define FINE_PRUNING_ENABLED
#define PERFORM_SPHERICAL_INTERSECTION_TESTS

4
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/LightLoop/materialflags.compute


#pragma kernel MaterialFlagsGen_Write MATERIALFLAGSGEN=MaterialFlagsGen_Write
#pragma kernel MaterialFlagsGen_Write MATERIALFLAGSGEN=MaterialFlagsGen_Write
#pragma kernel MaterialFlagsGen_Or MATERIALFLAGSGEN=MaterialFlagsGen_Or USE_OR
// #pragma enable_d3d11_debug_symbols

#include "../../Material/Material.hlsl" // This includes Material.hlsl
#include "../../Lighting/LightDefinition.cs.hlsl"
#pragma only_renderers d3d11 ps4 xboxone vulkan metal
#pragma only_renderers d3d11 ps4 xboxone vulkan metal switch
#define USE_MATERIAL_FEATURE_FLAGS
#define NR_THREADS 64

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/LightLoop/scrbound.compute


#include "LightLoop.cs.hlsl"
#include "LightCullUtils.hlsl"
#pragma only_renderers d3d11 ps4 xboxone vulkan metal
#pragma only_renderers d3d11 ps4 xboxone vulkan metal switch
uniform int g_isOrthographic;
uniform int g_iNrVisibLights;

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/Volumetrics/VolumetricLighting.compute


#include "../Lighting.hlsl" // Includes Material.hlsl
#include "../LightEvaluation.hlsl"
#pragma only_renderers d3d11 ps4 xboxone vulkan metal
#pragma only_renderers d3d11 ps4 xboxone vulkan metal switch
//--------------------------------------------------------------------------------------------------
// Inputs & outputs

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Decal/Decal.shader


HLSLINCLUDE
#pragma target 4.5
#pragma only_renderers d3d11 ps4 xboxone vulkan metal
#pragma only_renderers d3d11 ps4 xboxone vulkan metal switch
//#pragma enable_d3d11_debug_symbols
//-------------------------------------------------------------------------------------

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/GGXConvolution/BuildProbabilityTables.compute


#include "CoreRP/ShaderLibrary/ImageBasedLighting.hlsl"
#include "../../ShaderVariables.hlsl"
#pragma only_renderers d3d11 ps4 xboxone vulkan metal
#pragma only_renderers d3d11 ps4 xboxone vulkan metal switch
/* --- Input --- */

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/GGXConvolution/ComputeGgxIblSampleData.compute


#include "CoreRP/ShaderLibrary/Common.hlsl"
#include "CoreRP/ShaderLibrary/ImageBasedLighting.hlsl"
#pragma only_renderers d3d11 ps4 xboxone vulkan metal
#pragma only_renderers d3d11 ps4 xboxone vulkan metal switch
#ifdef SHADER_API_MOBILE
#define MAX_IBL_SAMPLE_CNT 34

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/GGXConvolution/GGXConvolve.shader


HLSLPROGRAM
#pragma target 4.5
#pragma only_renderers d3d11 ps4 xboxone vulkan metal
#pragma only_renderers d3d11 ps4 xboxone vulkan metal switch
#pragma multi_compile _ USE_MIS

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/LayeredLit/LayeredLit.shader


HLSLINCLUDE
#pragma target 4.5
#pragma only_renderers d3d11 ps4 xboxone vulkan metal
#pragma only_renderers d3d11 ps4 xboxone vulkan metal switch
#pragma shader_feature _ALPHATEST_ON
#pragma shader_feature _DEPTHOFFSET_ON

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/LayeredLit/LayeredLitTessellation.shader


HLSLINCLUDE
#pragma target 5.0
#pragma only_renderers d3d11 ps4 xboxone vulkan metal
#pragma only_renderers d3d11 ps4 xboxone vulkan metal switch
#pragma shader_feature _ALPHATEST_ON
#pragma shader_feature _DEPTHOFFSET_ON

6
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Lit/Lit.hlsl


// SurfaceData is define in Lit.cs which generate Lit.cs.hlsl
// SurfaceData is define in Lit.cs which generate Lit.cs.hlsl
#include "Lit.cs.hlsl"
#include "../SubsurfaceScattering/SubsurfaceScattering.hlsl"
#include "CoreRP/ShaderLibrary/VolumeRendering.hlsl"

float3 rayOriginWS = preLightData.transparentPositionWS;
float3 rayDirWS = preLightData.transparentRefractV;
#if DEBUG_DISPLAY
#ifdef DEBUG_DISPLAY
int debugMode = DEBUGLIGHTINGMODE_SCREEN_SPACE_TRACING_REFRACTION;
bool debug = _DebugLightingMode == debugMode
&& !any(int2(_MouseClickPixelCoord.xy) - int2(posInput.positionSS));

// Common initialization
ssRayInput.rayOriginWS = rayOriginWS;
ssRayInput.rayDirWS = rayDirWS;
#if DEBUG_DISPLAY
#ifdef DEBUG_DISPLAY
ssRayInput.debug = debug;
#endif
// Algorithm specific initialization

4
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Lit/Lit.shader


Shader "HDRenderPipeline/Lit"
Shader "HDRenderPipeline/Lit"
{
Properties
{

HLSLINCLUDE
#pragma target 4.5
#pragma only_renderers d3d11 ps4 xboxone vulkan metal
#pragma only_renderers d3d11 ps4 xboxone vulkan metal switch
//-------------------------------------------------------------------------------------
// Variant

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Lit/LitTessellation.shader


HLSLINCLUDE
#pragma target 5.0
#pragma only_renderers d3d11 ps4 xboxone vulkan metal
#pragma only_renderers d3d11 ps4 xboxone vulkan metal switch
//-------------------------------------------------------------------------------------
// Variant

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/PreIntegratedFGD/PreIntegratedFGD.shader


#pragma vertex Vert
#pragma fragment Frag
#pragma target 4.5
#pragma only_renderers d3d11 ps4 xboxone vulkan metal
#pragma only_renderers d3d11 ps4 xboxone vulkan metal switch
#include "CoreRP/ShaderLibrary/Common.hlsl"
#include "CoreRP/ShaderLibrary/ImageBasedLighting.hlsl"

109
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/StackLit/StackLit.shader


// Reminder. Color here are in linear but the UI (color picker) do the conversion sRGB to linear
// Be careful, do not change the name here to _Color. It will conflict with the "fake" parameters (see end of properties) required for GI.
_BaseColor("BaseColor", Color) = (1,1,1,1)
_BaseColorMap("BaseColorMap", 2D) = "white" {}
_BaseColorMapUV("BaseColorMapUV", Float) = 0.0
_BaseColorMap("BaseColor Map", 2D) = "white" {}
[HideInInspector] _BaseColorMapShow("BaseColor Map Show", Float) = 0
_BaseColorMapUV("BaseColor Map UV", Float) = 0.0
_BaseColorMapUVLocal("BaseColorMap UV Local", Float) = 0.0
[HideInInspector] _MetallicMapShow("Metallic Map Show", Float) = 0
_MetallicMap("MetallicMap", 2D) = "black" {}
_MetallicMapUV("MetallicMapUV", Float) = 0.0
_MetallicMapChannel("MetallicMapChannel", Vector) = (1, 0, 0, 0)
_MetallicMap("Metallic Map", 2D) = "black" {}
_MetallicUseMap("Metallic Use Map", Float) = 0
_MetallicMapUV("Metallic Map UV", Float) = 0.0
_MetallicMapUVLocal("Metallic Map UV Local", Float) = 0.0
_MetallicMapChannel("Metallic Map Channel", Float) = 0.0
_MetallicMapChannelMask("Metallic Map Channel Mask", Vector) = (1, 0, 0, 0)
[HideInInspector] _MetallicRange("Metallic Range", Vector) = (0, 1, 0, 0)
[HideInInspector] _SmoothnessAMapShow("SmoothnessA Map Show", Float) = 0
_SmoothnessAMap("BaseColorMap", 2D) = "white" {}
_SmoothnessAMapUV("SmoothnessAMapUV", Float) = 0.0
_SmoothnessAMapChannel("SmoothnessA Map Channel", Vector) = (1, 0, 0, 0)
_SmoothnessAMap("SmoothnessA Map", 2D) = "white" {}
_SmoothnessAUseMap("SmoothnessA Use Map", Float) = 0
_SmoothnessAMapUV("SmoothnessA Map UV", Float) = 0.0
_SmoothnessAMapUVLocal("_SmoothnessA Map UV Local", Float) = 0.0
_SmoothnessAMapChannel("SmoothnessA Map Channel", Float) = 0.0
_SmoothnessAMapChannelMask("SmoothnessA Map Channel Mask", Vector) = (1, 0, 0, 0)
[HideInInspector] _SmoothnessARange("SmoothnessA Range", Vector) = (0, 1, 0, 0)
[HideInInspector] _SmoothnessBMapShow("SmoothnessB Map Show", Float) = 0
_SmoothnessBMap("SmoothnessBMap", 2D) = "white" {}
_SmoothnessBMapUV("SmoothnessBMapUV", Float) = 0.0
_SmoothnessBMapChannel("SmoothnessB Map Channel", Vector) = (1, 0, 0, 0)
_SmoothnessBMap("SmoothnessB Map", 2D) = "white" {}
_SmoothnessBUseMap("SmoothnessB Use Map", Float) = 0
_SmoothnessBMapUV("SmoothnessB Map UV", Float) = 0.0
_SmoothnessAMapUVLocal("_SmoothnessB Map UV Local", Float) = 0.0
_SmoothnessBMapChannel("SmoothnessB Map Channel", Float) = 0.0
_SmoothnessBMapChannelMask("SmoothnessB Map Channel Mask", Vector) = (1, 0, 0, 0)
[HideInInspector] _SmoothnessBRange("SmoothnessB Range", Vector) = (0, 1, 0, 0)
[HideInInspector] _NormalMapShow("NormalMap Show", Float) = 0.0
_NormalScale("_NormalScale", Range(0.0, 2.0)) = 1
_NormalMapUVLocal("NormalMapUV Local", Float) = 0.0
_NormalMapObjSpace("NormalMapUV Local", Float) = 0.0
_NormalScale("Normal Scale", Range(0.0, 2.0)) = 1
[HideInInspector] _EmissiveColorMapShow("Emissive Color Map Show", Float) = 0.0
_EmissiveColor("Emissive Color", Color) = (1, 1, 1)
_EmissiveColorMap("Emissive Color Map", 2D) = "white" {}
_EmissiveColorMapUV("Emissive Color Map UV", Range(0.0, 1.0)) = 0
_EmissiveColorMapUVLocal("Emissive Color Map UV Local", Float) = 0.0
_EmissiveIntensity("Emissive Intensity", Float) = 0
[ToggleUI] _AlbedoAffectEmissive("Albedo Affect Emissive", Float) = 0.0
[Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Planar, 4, Triplanar, 5)] _UVBase("UV Set for base", Float) = 0
[HideInInspector] _UVMappingMask("_UVMappingMask", Color) = (1, 0, 0, 0)
[HideInInspector] _SubsurfaceMaskMapShow("Subsurface Mask Map Show", Float) = 0
_SubsurfaceMask("Subsurface Mask", Range(0.0, 1.0)) = 1.0
_SubsurfaceMaskMap("Subsurface Mask Map", 2D) = "black" {}
_SubsurfaceMaskUSeMap("Subsurface Mask Use Map", Float) = 0
_SubsurfaceMaskMapUV("Subsurface Mask Map UV", Float) = 0.0
_SubsurfaceMaskMapChannel("Subsurface Mask Map Channel", Float) = 0.0
_SubsurfaceMaskMapChannelMask("Subsurface Mask Map Channel Mask", Vector) = (1, 0, 0, 0)
_SubsurfaceMaskRemap("Subsurface Mask Remap", Vector) = (0, 1, 0, 0)
[ToggleUI] _SubsurfaceMaskRemapInverted("Invert Subsurface Mask Remap", Float) = 0.0
[HideInInspector] _SubsurfaceMaskRange("Subsurface Mask Range", Vector) = (0, 1, 0, 0)
_EmissiveColor("EmissiveColor", Color) = (1, 1, 1)
_EmissiveColorMap("EmissiveColorMap", 2D) = "white" {}
_EmissiveColorMapUV("EmissiveColorMap", Range(0.0, 1.0)) = 0
_EmissiveIntensity("EmissiveIntensity", Float) = 0
[ToggleUI] _AlbedoAffectEmissive("Albedo Affect Emissive", Float) = 0.0
[HideInInspector] _ThicknessMapShow("Thickness Show", Float) = 0
_Thickness("Thickness", Range(0.0, 1.0)) = 1.0
_ThicknessMap("Thickness Map", 2D) = "black" {}
_ThicknessUseMap("Thickness Use Map", Float) = 0
_ThicknessMapUV("Thickness Map UV", Float) = 0.0
_ThicknessMapChannel("Thickness Map Channel", Float) = 0.0
_ThicknessMapChannelMask("Thickness Map Channel Mask", Vector) = (1, 0, 0, 0)
_ThicknessRemap("Thickness Remap", Vector) = (0, 1, 0, 0)
[ToggleUI] _ThicknessRemapInverted("Invert Thickness Remap", Float) = 0.0
[HideInInspector] _ThicknessRange("Thickness Range", Vector) = (0, 1, 0, 0)
_DistortionVectorMap("DistortionVectorMap", 2D) = "black" {}
[ToggleUI] _DistortionEnable("Enable Distortion", Float) = 0.0

_AlphaCutoff("Alpha Cutoff", Range(0.0, 1.0)) = 0.5
_TransparentSortPriority("_TransparentSortPriority", Float) = 0
// Stencil state
[HideInInspector] _StencilRef("_StencilRef", Int) = 2 // StencilLightingUsage.RegularLighting (fixed at compile time)
[HideInInspector] _StencilWriteMask("_StencilWriteMask", Int) = 7 // StencilMask.Lighting (fixed at compile time)

[ToggleUI] _EnableFogOnTransparent("Enable Fog", Float) = 1.0
[ToggleUI] _EnableBlendModePreserveSpecularLighting("Enable Blend Mode Preserve Specular Lighting", Float) = 1.0
// Sections show values.
[HideInInspector] _StandardShow("_StandardShow", Float) = 0.0
[HideInInspector] _EmissiveShow("_EmissiveShow", Float) = 0.0
[HideInInspector] _CoatShow("_CoatShow", Float) = 0.0
[HideInInspector] _SSSShow("_SSSShow", Float) = 0.0
[HideInInspector] _Lobe2Show("_Lobe2Show", Float) = 0.0
[HideInInspector] _AnisotropyShow("_AnisotropyShow", Float) = 0.0
[HideInInspector] _TransmissionShow("_TransmissionShow", Float) = 0.0
[HideInInspector] _IridescenceShow("_IridescenceShow", Float) = 0.0
[HideInInspector] _GlintShow("_GlintShow", Float) = 0.0
// Caution: C# code in BaseLitUI.cs call LightmapEmissionFlagsProperty() which assume that there is an existing "_EmissionColor"
// value that exist to identify if the GI emission need to be enabled.
// In our case we don't use such a mechanism but need to keep the code quiet. We declare the value and always enable it.

#pragma shader_feature _DOUBLESIDED_ON
#pragma shader_feature _NORMALMAP_TANGENT_SPACE
#pragma shader_feature _ _REQUIRE_UV2 _REQUIRE_UV3
// ...TODO: for surface gradient framework eg see litdata.hlsl,
// but we need it right away for toggle with LayerTexCoord mapping so we might need them
#pragma shader_feature _USE_UV2
#pragma shader_feature _USE_UV3
#pragma shader_feature _USE_TRIPLANAR
// ...TODO: for surface gradient framework eg see litdata.hlsl,
// but we need it right away for toggle with LayerTexCoord mapping so we might need them
// from the Frag input right away. See also ShaderPass/StackLitSharePass.hlsl.
#pragma shader_feature _NORMALMAP

#pragma shader_feature _ _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY
#pragma shader_feature _BLENDMODE_PRESERVE_SPECULAR_LIGHTING // easily handled in material.hlsl, so adding this already.
#pragma shader_feature _ENABLE_FOG_ON_TRANSPARENT
//enable GPU instancing support
#pragma multi_compile_instancing

ZWrite [_ZWrite]
Cull [_CullModeForward]
//
// NOTE: For _CullModeForward, see BaseLitUI and the handling of TransparentBackfaceEnable:
// NOTE: For _CullModeForward, see BaseLitUI and the handling of TransparentBackfaceEnable:
// Basically, we need to use it to support a TransparentBackface pass before this pass
// (and it should be placed just before this one) for separate backface and frontface rendering,
// eg for "hair shader style" approximate sorting, see eg Thorsten Scheuermann writeups on this:

//
// See Lit.shader and the order of the passes after a DistortionVectors, we have:
// See Lit.shader and the order of the passes after a DistortionVectors, we have:
// TransparentDepthPrepass, TransparentBackface, Forward, TransparentDepthPostpass
HLSLPROGRAM

358
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/StackLit/StackLitData.hlsl


#include "CoreRP/ShaderLibrary/Sampling/SampleUVMapping.hlsl"
#include "../MaterialUtilities.hlsl"
//-----------------------------------------------------------------------------
// Texture Mapping (think of LayerTexCoord as simply TexCoordMappings,
// ie no more layers here - cf Lit materials)
//-----------------------------------------------------------------------------
////-----------------------------------------------------------------------------
//// Texture Mapping (think of LayerTexCoord as simply TexCoordMappings,
//// ie no more layers here - cf Lit materials)
////-----------------------------------------------------------------------------
// For easier copying of code for now use a LayerTexCoord wrapping struct.
// We don't have details yet.
////
//// For easier copying of code for now use a LayerTexCoord wrapping struct.
//// We don't have details yet.
////
//// NEWLITTODO: Eventually, we could quickly share GetBuiltinData of LitBuiltinData.hlsl
//// in our GetSurfaceAndBuiltinData( ) here, since we will use the LayerTexCoord identifier,
//// and an identical ComputeLayerTexCoord( ) prototype
////
//struct LayerTexCoord
//{
// UVMapping base;
// NEWLITTODO: Eventually, we could quickly share GetBuiltinData of LitBuiltinData.hlsl
// in our GetSurfaceAndBuiltinData( ) here, since we will use the LayerTexCoord identifier,
// and an identical ComputeLayerTexCoord( ) prototype
// // Store information that will be share by all UVMapping
// float3 vertexNormalWS; // TODO: store also object normal map for object triplanar
//};
struct LayerTexCoord
{
UVMapping base;
UVMapping details;
// Store information that will be share by all UVMapping
float3 vertexNormalWS; // TODO: store also object normal map for object triplanar
};
//// Want to use only one sampler for normalmap/bentnormalmap either we use OS or TS. And either we have normal map or bent normal or both.
////
//// Note (compared to Lit shader):
////
//// We don't have a layered material with which we are sharing code here like the LayeredLit shader, but we can also save a couple of
//// samplers later if we use bentnormals.
////
//// _IDX suffix is meaningless here, could use the name SAMPLER_NORMALMAP_ID instead of SAMPLER_NORMALMAP_IDX and replace all
//// indirect #ifdef _NORMALMAP_TANGENT_SPACE_IDX #ifdef and _NORMALMAP_IDX tests with the more direct
//// shader_feature keywords _NORMALMAP_TANGENT_SPACE and _NORMALMAP.
////
//// (Originally in the LayeredLit shader, shader_feature keywords like _NORMALMAP become _NORMALMAP0 but since files are shared,
//// LitDataIndividualLayer will use a generic _NORMALMAP_IDX defined before its inclusion by the client LitData or LayeredLitData.
//// That way, LitDataIndividualLayer supports multiple inclusions)
// Want to use only one sampler for normalmap/bentnormalmap either we use OS or TS. And either we have normal map or bent normal or both.
//
// Note (compared to Lit shader):
//
// We don't have a layered material with which we are sharing code here like the LayeredLit shader, but we can also save a couple of
// samplers later if we use bentnormals.
//
// _IDX suffix is meaningless here, could use the name SAMPLER_NORMALMAP_ID instead of SAMPLER_NORMALMAP_IDX and replace all
// indirect #ifdef _NORMALMAP_TANGENT_SPACE_IDX #ifdef and _NORMALMAP_IDX tests with the more direct
// shader_feature keywords _NORMALMAP_TANGENT_SPACE and _NORMALMAP.
//
// (Originally in the LayeredLit shader, shader_feature keywords like _NORMALMAP become _NORMALMAP0 but since files are shared,
// LitDataIndividualLayer will use a generic _NORMALMAP_IDX defined before its inclusion by the client LitData or LayeredLitData.
// That way, LitDataIndividualLayer supports multiple inclusions)
//
//
#ifdef _NORMALMAP_TANGENT_SPACE
#if defined(_NORMALMAP)
#define SAMPLER_NORMALMAP_ID sampler_NormalMap

//#endif
#endif
void ComputeLayerTexCoord( // Uv related parameters
float2 texCoord0, float2 texCoord1, float2 texCoord2, float2 texCoord3, float4 uvMappingMask,
// scale and bias for base
float2 texScale, float2 texBias,
// mapping type and output
int mappingType, inout LayerTexCoord layerTexCoord)
//-----------------------------------------------------------------------------
// Texture Mapping
//-----------------------------------------------------------------------------
#define TEXCOORD_INDEX_UV0 (0)
#define TEXCOORD_INDEX_UV1 (1)
#define TEXCOORD_INDEX_UV2 (2)
#define TEXCOORD_INDEX_UV3 (3)
#define TEXCOORD_INDEX_PLANAR_XY (4)
#define TEXCOORD_INDEX_PLANAR_YZ (5)
#define TEXCOORD_INDEX_PLANAR_ZX (6)
#define TEXCOORD_INDEX_TRIPLANAR (7)
#define TEXCOORD_INDEX_COUNT (TEXCOORD_INDEX_TRIPLANAR) // Triplanar is not consider as having mapping
struct TextureUVMapping
{
float2 texcoords[TEXCOORD_INDEX_COUNT][2];
#ifdef _USE_TRIPLANAR
float3 triplanarWeights[2];
#endif
float3 vertexNormalWS;
float3 vertexTangentWS[4];
float3 vertexBitangentWS[4];
};
void InitializeMappingData(FragInputs input, out TextureUVMapping uvMapping)
float3 position = GetAbsolutePositionWS(input.positionWS);
float2 uvXZ;
float2 uvXY;
float2 uvZY;
//TODO: Planar, Triplanar, detail map, surface_gradient.
// Build the texcoords array.
uvMapping.texcoords[TEXCOORD_INDEX_UV0][0] = uvMapping.texcoords[TEXCOORD_INDEX_UV0][1] = input.texCoord0.xy;
uvMapping.texcoords[TEXCOORD_INDEX_UV1][0] = uvMapping.texcoords[TEXCOORD_INDEX_UV1][1] = input.texCoord1.xy;
uvMapping.texcoords[TEXCOORD_INDEX_UV2][0] = uvMapping.texcoords[TEXCOORD_INDEX_UV2][1] = input.texCoord2.xy;
uvMapping.texcoords[TEXCOORD_INDEX_UV3][0] = uvMapping.texcoords[TEXCOORD_INDEX_UV3][1] = input.texCoord3.xy;
// Handle uv0, uv1, uv2, uv3 based on _UVMappingMask weight (exclusif 0..1)
float2 uvBase = uvMappingMask.x * texCoord0 +
uvMappingMask.y * texCoord1 +
uvMappingMask.z * texCoord2 +
uvMappingMask.w * texCoord3;
// Copy data in uvmapping fields: used by generic sampling code (see especially SampleUVMappingNormalInternal.hlsl)
layerTexCoord.base.mappingType = mappingType;
layerTexCoord.base.normalWS = layerTexCoord.vertexNormalWS;
// planar/triplanar
GetTriplanarCoordinate(position, uvXZ, uvXY, uvZY);
uvMapping.texcoords[TEXCOORD_INDEX_PLANAR_XY][0] = uvXY;
uvMapping.texcoords[TEXCOORD_INDEX_PLANAR_YZ][0] = uvZY;
uvMapping.texcoords[TEXCOORD_INDEX_PLANAR_ZX][0] = uvXZ;
// Apply tiling options
layerTexCoord.base.uv = uvBase * texScale + texBias;
}
// If we use local planar mapping, convert to local space
position = TransformWorldToObject(position);
GetTriplanarCoordinate(position, uvXZ, uvXY, uvZY);
uvMapping.texcoords[TEXCOORD_INDEX_PLANAR_XY][1] = uvXY;
uvMapping.texcoords[TEXCOORD_INDEX_PLANAR_YZ][1] = uvZY;
uvMapping.texcoords[TEXCOORD_INDEX_PLANAR_ZX][1] = uvXZ;
#ifdef _USE_TRIPLANAR
float3 vertexNormal = input.worldToTangent[2].xyz;
uvMapping.triplanarWeights[0] = ComputeTriplanarWeights(vertexNormal);
// If we use local planar mapping, convert to local space
vertexNormal = TransformWorldToObjectDir(vertexNormal);
uvMapping.triplanarWeights[1] = ComputeTriplanarWeights(vertexNormal);
#endif
// Normal mapping with surface gradient
float3 vertexNormalWS = input.worldToTangent[2];
uvMapping.vertexNormalWS = vertexNormalWS;
float3 GetNormalTS(FragInputs input, LayerTexCoord layerTexCoord, float3 detailNormalTS, float detailMask)
{
// TODO: different spaces (eg #ifdef _NORMALMAP_TANGENT_SPACE #elif object space, SURFACE_GRADIENT, etc.)
// and use detail map
uvMapping.vertexTangentWS[0] = input.worldToTangent[0];
uvMapping.vertexBitangentWS[0] = input.worldToTangent[1];
float3 normalTS;
float3 dPdx = ddx_fine(input.positionWS);
float3 dPdy = ddy_fine(input.positionWS);
// Note we don't use the _NORMALMAP_IDX mechanism of the Lit shader, since we don't have "layers", we can
// directly use the shader_feature keyword:
#ifdef _NORMALMAP
normalTS = SAMPLE_UVMAPPING_NORMALMAP(_NormalMap, SAMPLER_NORMALMAP_ID, layerTexCoord.base, _NormalScale);
#else
normalTS = float3(0.0, 0.0, 1.0);
#endif
float3 sigmaX = dPdx - dot(dPdx, vertexNormalWS) * vertexNormalWS;
float3 sigmaY = dPdy - dot(dPdy, vertexNormalWS) * vertexNormalWS;
//float flipSign = dot(sigmaY, cross(vertexNormalWS, 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
return normalTS;
SurfaceGradientGenBasisTB(vertexNormalWS, sigmaX, sigmaY, flipSign, input.texCoord1, uvMapping.vertexTangentWS[1], uvMapping.vertexBitangentWS[1]);
SurfaceGradientGenBasisTB(vertexNormalWS, sigmaX, sigmaY, flipSign, input.texCoord2, uvMapping.vertexTangentWS[2], uvMapping.vertexBitangentWS[2]);
SurfaceGradientGenBasisTB(vertexNormalWS, sigmaX, sigmaY, flipSign, input.texCoord3, uvMapping.vertexTangentWS[3], uvMapping.vertexBitangentWS[3]);
// 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
void GetLayerTexCoord(float2 texCoord0, float2 texCoord1, float2 texCoord2, float2 texCoord3,
float3 positionWS, float3 vertexNormalWS, inout LayerTexCoord layerTexCoord)
float4 SampleTexture2DScaleBias(TEXTURE2D_ARGS(textureName, samplerName), float textureNameUV, float textureNameUVLocal, float4 textureNameST, TextureUVMapping uvMapping)
layerTexCoord.vertexNormalWS = vertexNormalWS;
// TODO:
//layerTexCoord.triplanarWeights = ComputeTriplanarWeights(vertexNormalWS);
return SAMPLE_TEXTURE2D(textureName, samplerName, (uvMapping.texcoords[textureNameUV][textureNameUVLocal] * textureNameST.xy + textureNameST.zw));
}
int mappingType = UV_MAPPING_UVSET;
// If we use triplanar on any of the properties, then we enable the triplanar path
float4 SampleTexture2DTriplanarScaleBias(TEXTURE2D_ARGS(textureName, samplerName), float textureNameUV, float textureNameUVLocal, float4 textureNameST, TextureUVMapping uvMapping)
{
#ifdef _USE_TRIPLANAR
if (textureNameUV == TEXCOORD_INDEX_TRIPLANAR)
{
float4 val = float4(0.0, 0.0, 0.0, 0.0);
//TODO: _MAPPING_PLANAR, _MAPPING_TRIPLANAR
if (uvMapping.triplanarWeights[textureNameUVLocal].x > 0.0)
val += uvMapping.triplanarWeights[textureNameUVLocal].x * SampleTexture2DScaleBias(TEXTURE2D_PARAM(textureName, samplerName), TEXCOORD_INDEX_PLANAR_YZ, textureNameUVLocal, textureNameST, uvMapping);
if (uvMapping.triplanarWeights[textureNameUVLocal].y > 0.0)
val += uvMapping.triplanarWeights[textureNameUVLocal].y * SampleTexture2DScaleBias(TEXTURE2D_PARAM(textureName, samplerName), TEXCOORD_INDEX_PLANAR_ZX, textureNameUVLocal, textureNameST, uvMapping);
if (uvMapping.triplanarWeights[textureNameUVLocal].z > 0.0)
val += uvMapping.triplanarWeights[textureNameUVLocal].z * SampleTexture2DScaleBias(TEXTURE2D_PARAM(textureName, samplerName), TEXCOORD_INDEX_PLANAR_XY, textureNameUVLocal, textureNameST, uvMapping);
// Be sure that the compiler is aware that we don't use UV1 to UV3 for main layer so it can optimize code
ComputeLayerTexCoord( texCoord0, texCoord1, texCoord2, texCoord3, _UVMappingMask, /* TODO _UVDetailsMappingMask, */
_BaseColorMap_ST.xy, _BaseColorMap_ST.zw, /* TODO _DetailMap_ST.xy, _DetailMap_ST.zw, 1.0, _LinkDetailsWithBase,
/* TODO positionWS, _TexWorldScale, */
mappingType, layerTexCoord);
return val;
}
else
{
#endif // _USE_TRIPLANAR
return SampleTexture2DScaleBias(TEXTURE2D_PARAM(textureName, samplerName), textureNameUV, textureNameUVLocal, textureNameST, uvMapping);
#ifdef _USE_TRIPLANAR
}
#endif
// 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)
float3 SampleTexture2DTriplanarNormalScaleBias(TEXTURE2D_ARGS(textureName, samplerName), float textureNameUV, float textureNameUVLocal, float4 textureNameST, float textureNameObjSpace, TextureUVMapping uvMapping, float2 scale)
// TODO: SURFACE_GRADIENT
//#ifdef SURFACE_GRADIENT
//GenerateLayerTexCoordBasisTB(input, layerTexCoord);
//#endif
if (textureNameObjSpace)
{
// TODO: obj triplanar (need to do * 2 - 1 before blending)
GetLayerTexCoord( input.texCoord0, input.texCoord1, input.texCoord2, input.texCoord3,
input.positionWS, input.worldToTangent[2].xyz, layerTexCoord);
// We forbid scale in case of object space as it make no sense
// Decompress normal ourselve
float3 normalOS = SampleTexture2DTriplanarScaleBias(TEXTURE2D_PARAM(textureName, samplerName), textureNameUV, textureNameUVLocal, textureNameST, uvMapping) * 2.0 - 1.0;
// no need to renormalize normalOS for SurfaceGradientFromPerturbedNormal
return SurfaceGradientFromPerturbedNormal(uvMapping.vertexNormalWS, TransformObjectToWorldDir(normalOS));
}
else
{
#ifdef _USE_TRIPLANAR
if (textureNameUV == TEXCOORD_INDEX_TRIPLANAR)
{
float2 derivXplane;
float2 derivYPlane;
float2 derivZPlane;
derivXplane = derivYPlane = derivZPlane = float2(0.0, 0.0);
if (uvMapping.triplanarWeights[textureNameUVLocal].x > 0.0)
derivXplane = uvMapping.triplanarWeights[textureNameUVLocal].x * UnpackDerivativeNormalRGorAG(SampleTexture2DScaleBias(TEXTURE2D_PARAM(textureName, samplerName), TEXCOORD_INDEX_PLANAR_YZ, textureNameUVLocal, textureNameST, uvMapping), scale);
if (uvMapping.triplanarWeights[textureNameUVLocal].y > 0.0)
derivYPlane = uvMapping.triplanarWeights[textureNameUVLocal].y * UnpackDerivativeNormalRGorAG(SampleTexture2DScaleBias(TEXTURE2D_PARAM(textureName, samplerName), TEXCOORD_INDEX_PLANAR_ZX, textureNameUVLocal, textureNameST, uvMapping), scale);
if (uvMapping.triplanarWeights[textureNameUVLocal].z > 0.0)
derivZPlane = uvMapping.triplanarWeights[textureNameUVLocal].z * UnpackDerivativeNormalRGorAG(SampleTexture2DScaleBias(TEXTURE2D_PARAM(textureName, samplerName), TEXCOORD_INDEX_PLANAR_XY, textureNameUVLocal, textureNameST, uvMapping), scale);
// Assume derivXplane, derivYPlane and derivZPlane sampled using (z,y), (z,x) and (x,y) respectively.
float3 volumeGrad = float3(derivZPlane.x + derivYPlane.y, derivZPlane.y + derivXplane.y, derivXplane.x + derivYPlane.x);
return SurfaceGradientFromVolumeGradient(uvMapping.vertexNormalWS, volumeGrad);
}
#endif
float2 deriv = UnpackDerivativeNormalRGorAG(SampleTexture2DScaleBias(TEXTURE2D_PARAM(textureName, samplerName), textureNameUV, textureNameUVLocal, textureNameST, uvMapping));
if (textureNameUV <= TEXCOORD_INDEX_UV3)
{
return SurfaceGradientFromTBN(deriv, uvMapping.vertexTangentWS[textureNameUV], uvMapping.vertexBitangentWS[textureNameUV]);
}
else
{
float3 volumeGrad;
if (textureNameUV == TEXCOORD_INDEX_PLANAR_YZ)
volumeGrad = float3(0.0, deriv.y, deriv.x);
else if (textureNameUV == TEXCOORD_INDEX_PLANAR_ZX)
volumeGrad = float3(deriv.y, 0.0, deriv.x);
else if (textureNameUV == TEXCOORD_INDEX_PLANAR_XY)
volumeGrad = float3(deriv.x, deriv.y, 0.0);
return SurfaceGradientFromVolumeGradient(uvMapping.vertexNormalWS, volumeGrad);
}
}
#define SAMPLE_TEXTURE2D_SCALE_BIAS(name) SampleTexture2DTriplanarScaleBias(name, sampler##name, name##UV, name##UVLocal, name##_ST, uvMapping)
#define SAMPLE_TEXTURE2D_NORMAL_SCALE_BIAS(name, scale) SampleTexture2DTriplanarNormalScaleBias(name, sampler##name, name##UV, name##UVLocal, name##_ST, name##ObjSpace, uvMapping, scale)
// ...Texture Mapping
// GetSurfaceAndBuiltinData
// cf with
// cf with
// LitBuiltinData.hlsl:GetBuiltinData()
// LitBuiltinData.hlsl:GetBuiltinData()
ApplyDoubleSidedFlipOrMirror(input); // Apply double sided flip on the vertex normal
ApplyDoubleSidedFlipOrMirror(input); // Apply double sided flip on the vertex normal.
LayerTexCoord layerTexCoord;
ZERO_INITIALIZE(LayerTexCoord, layerTexCoord);
GetLayerTexCoord(input, layerTexCoord);
TextureUVMapping uvMapping;
InitializeMappingData(input, uvMapping);
// We perform the conversion to world of the normalTS outside of the GetSurfaceData
// so it allow us to correctly deal with detail normal map and optimize the code for the layered shaders
float3 normalTS;
// TODO: Those are only needed once we handle specular occlusion and optionnally bent normal maps.
// Also, for the builtinData part, use bentnormal to sample diffuse GI
//float3 bentNormalTS;
//float3 bentNormalWS;
//float alpha = SAMPLE_TEXTURE2D(_BaseColorMap, sampler_BaseColorMap, baseColorMapUv).a * _BaseColor.a;
float alpha = SAMPLE_UVMAPPING_TEXTURE2D(_BaseColorMap, sampler_BaseColorMap, layerTexCoord.base).a * _BaseColor.a;
float alpha = SAMPLE_TEXTURE2D_SCALE_BIAS(_BaseColorMap).a * _BaseColor.a;
#ifdef _ALPHATEST_ON
//NEWLITTODO: Once we include those passes in the main StackLit.shader, add handling of CUTOFF_TRANSPARENT_DEPTH_PREPASS and _POSTPASS
// and the related properties (in the .shader) and uniforms (in the StackLitProperties file) _AlphaCutoffPrepass, _AlphaCutoffPostpass

// TODO detail map:
float3 detailNormalTS = float3(0.0, 0.0, 0.0);
float detailMask = 0.0;
//TODO remove the following and use fetching macros that use uvmapping :
//float2 baseColorMapUv = TRANSFORM_TEX(input.texCoord0, _BaseColorMap);
//surfaceData.baseColor = SAMPLE_TEXTURE2D(_BaseColorMap, sampler_BaseColorMap, baseColorMapUv).rgb * _BaseColor.rgb;
surfaceData.baseColor = SAMPLE_UVMAPPING_TEXTURE2D(_BaseColorMap, sampler_BaseColorMap, layerTexCoord.base).rgb * _BaseColor.rgb;
//surfaceData.normalWS = float3(0.0, 0.0, 0.0);
surfaceData.baseColor = SAMPLE_TEXTURE2D_SCALE_BIAS(_BaseColorMap).rgb * _BaseColor.rgb;
normalTS = GetNormalTS(input, layerTexCoord, detailNormalTS, detailMask);
float3 gradient = SAMPLE_TEXTURE2D_NORMAL_SCALE_BIAS(_NormalMap, float2(_NormalScale.xx));
#if defined(_SMOOTHNESSMASKMAPA)
surfaceData.perceptualSmoothnessA = dot(SAMPLE_UVMAPPING_TEXTURE2D(_SmoothnessAMap, sampler_SmoothnessAMap, layerTexCoord.base), _MetallicMapChannel, _SmoothnessAMapChannel);
surfaceData.perceptualSmoothnessA = lerp(_SmoothnessARemap.x, _SmoothnessARemap.y, surfaceData.perceptualSmoothnessA);
#else
surfaceData.perceptualSmoothnessA = _SmoothnessA;
#endif
surfaceData.perceptualSmoothnessA = dot(SAMPLE_TEXTURE2D_SCALE_BIAS(_SmoothnessAMap), _SmoothnessAMapChannelMask);
surfaceData.perceptualSmoothnessA = lerp(_SmoothnessARange.x, _SmoothnessARange.y, surfaceData.perceptualSmoothnessA);
surfaceData.perceptualSmoothnessA = lerp(_SmoothnessA, surfaceData.perceptualSmoothnessA, _SmoothnessAUseMap);
#if defined(_SMOOTHNESSMASKMAPB)
surfaceData.perceptualSmoothnessB = dot(SAMPLE_UVMAPPING_TEXTURE2D(_SmoothnessAMaB, sampler_SmoothnessBMap, layerTexCoord.base), _SmoothnessBMapChannel);
surfaceData.perceptualSmoothnessB = lerp(_SmoothnessBRemap.x, _SmoothnessBRemap.y, surfaceData.perceptualSmoothnessB);
#else
surfaceData.perceptualSmoothnessB = _SmoothnessB;
#endif
surfaceData.perceptualSmoothnessB = dot(SAMPLE_TEXTURE2D_SCALE_BIAS(_SmoothnessBMap), _SmoothnessBMapChannelMask);
surfaceData.perceptualSmoothnessB = lerp(_SmoothnessBRange.x, _SmoothnessBRange.y, surfaceData.perceptualSmoothnessB);
surfaceData.perceptualSmoothnessB = lerp(_SmoothnessB, surfaceData.perceptualSmoothnessB, _SmoothnessBUseMap);
#ifdef _METALLICMAP
surfaceData.metallic = dot(SAMPLE_UVMAPPING_TEXTURE2D(_MetallicMap, sampler_MetallicMap, layerTexCoord.base), _MetallicMapChannel);
#else
surfaceData.metallic = 1.0;
#endif
surfaceData.metallic *= _Metallic;
surfaceData.metallic = dot(SAMPLE_TEXTURE2D_SCALE_BIAS(_MetallicMap), _MetallicMapChannelMask);
surfaceData.metallic = lerp(_MetallicRange.x, _MetallicRange.y, surfaceData.metallic);
surfaceData.metallic = lerp(_Metallic, surfaceData.metallic, _MetallicUseMap);
// TODO: As we add features, or-set the flags eg MATERIALFEATUREFLAGS_LIT_* with #ifdef
// on corresponding _MATERIAL_FEATURE_* shader_feature kerwords (set by UI) so the compiler
// TODO: As we add features, or-set the flags eg MATERIALFEATUREFLAGS_LIT_* with #ifdef
// on corresponding _MATERIAL_FEATURE_* shader_feature kerwords (set by UI) so the compiler
// knows the value of surfaceData.materialFeatures.
surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD;

GetNormalWS(input, V, normalTS, surfaceData.normalWS); // MaterialUtilities.hlsl
// Convert back to world space normal
surfaceData.normalWS = SurfaceGradientResolveNormal(input.worldToTangent[2], gradient);
// TODO: decal etc.

surfaceData.baseColor = GetTextureDataDebug(_DebugMipMapMode, layerTexCoord.base.uv, _BaseColorMap, _BaseColorMap_TexelSize, _BaseColorMap_MipInfo, surfaceData.baseColor);
surfaceData.baseColor = GetTextureDataDebug(_DebugMipMapMode, texcoords[_BaseColorMapUV], _BaseColorMap, _BaseColorMap_TexelSize, _BaseColorMap_MipInfo, surfaceData.baseColor);
surfaceData.metallic = 0;
}
#endif

// -------------------------------------------------------------
// NEWLITTODO: for all BuiltinData, might need to just refactor and use a comon function like that
// NEWLITTODO: for all BuiltinData, might need to just refactor and use a comon function like that
// contained in LitBuiltinData.hlsl
builtinData.opacity = alpha;

// Emissive Intensity is only use here, but is part of BuiltinData to enforce UI parameters as we want the users to fill one color and one intensity
builtinData.emissiveIntensity = _EmissiveIntensity; // We still store intensity here so we can reuse it with debug code
builtinData.emissiveColor = _EmissiveColor * builtinData.emissiveIntensity * lerp(float3(1.0, 1.0, 1.0), surfaceData.baseColor.rgb, _AlbedoAffectEmissive);
#ifdef _EMISSIVE_COLOR_MAP
builtinData.emissiveColor *= SAMPLE_TEXTURE2D(_EmissiveColorMap, sampler_EmissiveColorMap, TRANSFORM_TEX(input.texCoord0, _EmissiveColorMap)).rgb;
#endif
builtinData.emissiveColor *= SAMPLE_TEXTURE2D_SCALE_BIAS(_EmissiveColorMap).rgb;
//NEWLITTODO: shader feature SHADOWS_SHADOWMASK not there yet.
//NEWLITTODO: shader feature SHADOWS_SHADOWMASK not there yet.
builtinData.shadowMask0 = 0.0;
builtinData.shadowMask1 = 0.0;
builtinData.shadowMask2 = 0.0;

#endif
builtinData.depthOffset = 0.0;
}

66
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/StackLit/StackLitProperties.hlsl


TEXTURE2D(_SmoothnessBMap);
SAMPLER(sampler_SmoothnessBMap);
TEXTURE2D(_SubsurfaceMaskMap);
SAMPLER(sampler_SubsurfaceMaskMap);
TEXTURE2D(_ThicknessMap);
SAMPLER(sampler_ThicknessMap);
TEXTURE2D(_EmissiveColorMap);
SAMPLER(sampler_EmissiveColorMap);

float4 _BaseColorMap_TexelSize;
float4 _BaseColorMap_MipInfo;
float _BaseColorMapUV;
float _BaseColorMapUVLocal;
float _MetallicUseMap;
float4 _MetallicMapChannel;
float _MetallicMapUVLocal;
float4 _MetallicMap_ST;
float4 _MetallicMap_TexelSize;
float4 _MetallicMap_MipInfo;
float4 _MetallicMapChannelMask;
float4 _MetallicRange;
float _SmoothnessAUseMap;
float4 _SmoothnessAMapChannel;
float4 _SmoothnessARemap;
float _SmoothnessAMapUVLocal;
float4 _SmoothnessAMap_ST;
float4 _SmoothnessAMap_TexelSize;
float4 _SmoothnessAMap_MipInfo;
float4 _SmoothnessAMapChannelMask;
float4 _SmoothnessARange;
float _SmoothnessBUV;
float4 _SmoothnessBMapChannel;
float4 _SmoothnessBRemap;
float _SmoothnessBUseMap;
float _SmoothnessBMapUV;
float _SmoothnessBMapUVLocal;
float4 _SmoothnessBMap_ST;
float4 _SmoothnessBMap_TexelSize;
float4 _SmoothnessBMap_MipInfo;
float4 _SmoothnessBMapChannelMask;
float4 _SmoothnessBRange;
float4 _UVMappingMask;
float _NormalMapUVLocal;
float _NormalMapObjSpace;
float4 _NormalMap_ST;
float4 _NormalMap_TexelSize;
float4 _NormalMap_MipInfo;
float4 _EmissiveColorMap_TexelSize;
float4 _EmissiveColorMap_MipInfo;
float _EmissiveColorMapUV;
float _EmissiveColorMapUVLocal;
float _SubsurfaceMask;
float _SubsurfaceMaskUseMap;
float _SubsurfaceMaskMapUV;
float4 _SubsurfaceMaskMap_ST;
float4 _SubsurfaceMaskMap_TexelSize;
float4 _SubsurfaceMaskMap_MipInfo;
float4 _SubsurfaceMaskMapChannelMask;
float4 _SubsurfaceMaskRange;
float _Thickness;
float _ThicknessUseMap;
float _ThicknessMapUV;
float4 _ThicknessMap_ST;
float4 _ThicknessMap_TexelSize;
float4 _ThicknessMap_MipInfo;
float4 _ThicknessMapChannelMask;
float4 _ThicknessRange;
float _AlphaCutoff;
float4 _DoubleSidedConstants;

float _DistortionBlurScale;
float _DistortionBlurRemapMin;
float _DistortionBlurRemapMax;
// Caution: C# code in BaseLitUI.cs call LightmapEmissionFlagsProperty() which assume that there is an existing "_EmissionColor"
// value that exist to identify if the GI emission need to be enabled.

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/SubsurfaceScattering/CombineLighting.shader


HLSLPROGRAM
#pragma target 4.5
#pragma only_renderers d3d11 ps4 xboxone vulkan metal
#pragma only_renderers d3d11 ps4 xboxone vulkan metal switch
// #pragma enable_d3d11_debug_symbols
#pragma vertex Vert

4
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/SubsurfaceScattering/SubsurfaceScattering.compute


// =============== Convolves transmitted radiance with the Disney diffusion profile ================
// =============== Convolves transmitted radiance with the Disney diffusion profile ================
//--------------------------------------------------------------------------------------------------
// Definitions

#include "../../Lighting/LightDefinition.cs.hlsl"
#include "SubsurfaceScattering.hlsl"
#pragma only_renderers d3d11 ps4 xboxone vulkan metal
#pragma only_renderers d3d11 ps4 xboxone vulkan metal switch
//--------------------------------------------------------------------------------------------------
// Inputs & outputs

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/SubsurfaceScattering/SubsurfaceScattering.shader


HLSLPROGRAM
#pragma target 4.5
#pragma only_renderers d3d11 ps4 xboxone vulkan metal
#pragma only_renderers d3d11 ps4 xboxone vulkan metal switch
// #pragma enable_d3d11_debug_symbols
#pragma vertex Vert

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Unlit/Unlit.shader


HLSLINCLUDE
#pragma target 4.5
#pragma only_renderers d3d11 ps4 xboxone vulkan metal
#pragma only_renderers d3d11 ps4 xboxone vulkan metal switch
//-------------------------------------------------------------------------------------
// Variant

6
ScriptableRenderPipeline/HDRenderPipeline/HDRP/RenderPipeline/FrameSettings.cs


using System;
using System;
using System.Collections.Generic;
using UnityEngine.XR;

// Planar and real time cubemap doesn't need post process and render in FP16
aggregate.enablePostprocess = camera.cameraType != CameraType.Reflection && srcFrameSettings.enablePostprocess;
#if UNITY_SWITCH
aggregate.enableStereo = false;
#else
#endif
aggregate.enableAsyncCompute = srcFrameSettings.enableAsyncCompute && SystemInfo.supportsAsyncCompute;

4
ScriptableRenderPipeline/HDRenderPipeline/HDRP/RenderPipelineResources/ApplyDistorsion.compute


#include "CoreRP/ShaderLibrary/Common.hlsl"
#include "CoreRP/ShaderLibrary/Common.hlsl"
#pragma only_renderers d3d11 ps4 xboxone vulkan metal
#pragma only_renderers d3d11 ps4 xboxone vulkan metal switch
TEXTURE2D(_DistortionTexture);
TEXTURE2D(_ColorPyramidTexture);

4
ScriptableRenderPipeline/HDRenderPipeline/HDRP/RenderPipelineResources/Blit.shader


Shader "Hidden/HDRenderPipeline/Blit"
Shader "Hidden/HDRenderPipeline/Blit"
#pragma only_renderers d3d11 ps4 xboxone vulkan metal
#pragma only_renderers d3d11 ps4 xboxone vulkan metal switch
#include "CoreRP/ShaderLibrary/Common.hlsl"
#include "../ShaderVariables.hlsl"

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/RenderPipelineResources/ColorPyramid.compute


#include "CoreRP/ShaderLibrary/Common.hlsl"
#pragma only_renderers d3d11 ps4 xboxone vulkan metal
#pragma only_renderers d3d11 ps4 xboxone vulkan metal switch
Texture2D<float4> _Source;
RWTexture2D<float4> _Result;

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/RenderPipelineResources/CopyDepthBuffer.shader


HLSLPROGRAM
#pragma target 4.5
#pragma only_renderers d3d11 ps4 xboxone vulkan metal
#pragma only_renderers d3d11 ps4 xboxone vulkan metal switch
#pragma fragment Frag
#pragma vertex Vert
// #pragma enable_d3d11_debug_symbols

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/RenderPipelineResources/CopyStencilBuffer.shader


HLSLINCLUDE
#pragma target 4.5
#pragma only_renderers d3d11 ps4 xboxone vulkan metal
#pragma only_renderers d3d11 ps4 xboxone vulkan metal switch
// #pragma enable_d3d11_debug_symbols
#include "CoreRP/ShaderLibrary/Common.hlsl"

4
ScriptableRenderPipeline/HDRenderPipeline/HDRP/RenderPipelineResources/DepthPyramid.compute


#include "CoreRP/ShaderLibrary/Common.hlsl"
#include "CoreRP/ShaderLibrary/Common.hlsl"
// ------------------------------------------------
// Algorithm

#pragma kernel KDepthDownSample8 KERNEL_SIZE=8 KERNEL_NAME=KDepthDownSample8
#pragma kernel KDepthDownSample1 KERNEL_SIZE=1 KERNEL_NAME=KDepthDownSample1
#pragma only_renderers d3d11 ps4 xboxone vulkan metal
#pragma only_renderers d3d11 ps4 xboxone vulkan metal switch
// ------------------------------------------------
// Texture buffers

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Sky/HDRISky/HDRISky.shader


#pragma fragment Frag
#pragma target 4.5
#pragma only_renderers d3d11 ps4 xboxone vulkan metal
#pragma only_renderers d3d11 ps4 xboxone vulkan metal switch
#include "CoreRP/ShaderLibrary/Common.hlsl"
#include "CoreRP/ShaderLibrary/Color.hlsl"

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Sky/OpaqueAtmosphericScattering.shader


HLSLPROGRAM
#pragma target 4.5
#pragma only_renderers d3d11 ps4 xboxone vulkan metal
#pragma only_renderers d3d11 ps4 xboxone vulkan metal switch
#pragma vertex Vert
#pragma fragment Frag

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Sky/ProceduralSky/ProceduralSky.shader


#pragma fragment Frag
#pragma target 4.5
#pragma only_renderers d3d11 ps4 xboxone vulkan metal
#pragma only_renderers d3d11 ps4 xboxone vulkan metal switch
#pragma multi_compile _ _ENABLE_SUN_DISK

10
ScriptableRenderPipeline/LightweightPipeline/LWRP/LightweightPipeline.cs


}
else
cmd.DisableShaderKeyword(kMSAADepthKeyword);
CopyTexture(cmd, m_DepthRT, m_CopyDepth, m_CopyDepthMaterial, forceBlit);
depthRT = m_CopyDepth;
setRenderTarget = true;

private void SetupFrameRenderingConfiguration(out FrameRenderingConfiguration configuration, bool screenspaceShadows, bool stereoEnabled, bool sceneViewCamera)
{
configuration = (stereoEnabled) ? FrameRenderingConfiguration.Stereo : FrameRenderingConfiguration.None;
#if !UNITY_SWITCH
#endif
m_IntermediateTextureArray = false;
bool hdrEnabled = m_Asset.SupportsHDR && m_CurrCamera.allowHDR;

private RenderTextureDescriptor CreateRTDesc(FrameRenderingConfiguration renderingConfig, float scaler = 1.0f)
{
RenderTextureDescriptor desc;
#if !UNITY_SWITCH
#endif
desc = new RenderTextureDescriptor(m_CurrCamera.pixelWidth, m_CurrCamera.pixelHeight);
float renderScale = GetRenderScale();

private bool IsStereoEnabled(Camera camera)
{
#if !UNITY_SWITCH
#else
return false;
#endif
}
private float GetRenderScale()

121
ScriptableRenderPipeline/Core/CoreRP/ShaderLibrary/API/Switch.hlsl


// This file assume SHADER_API_SWITCH is defined
// TODO: This is a straight copy from D3D11.hlsl. Go through all this stuff and adjust where needed.
#define UNITY_UV_STARTS_AT_TOP 1
#define UNITY_REVERSED_Z 1
#define UNITY_NEAR_CLIP_VALUE (1.0)
// This value will not go through any matrix projection conversion
#define UNITY_RAW_FAR_CLIP_VALUE (0.0)
#define VERTEXID_SEMANTIC SV_VertexID
#define FRONT_FACE_SEMANTIC SV_IsFrontFace
#define FRONT_FACE_TYPE bool
#define IS_FRONT_VFACE(VAL, FRONT, BACK) ((VAL) ? (FRONT) : (BACK))
#define CBUFFER_START(name) cbuffer name {
#define CBUFFER_END };
// flow control attributes
#define UNITY_BRANCH [branch]
#define UNITY_FLATTEN [flatten]
#define UNITY_UNROLL [unroll]
#define UNITY_UNROLLX(_x) [unroll(_x)]
#define UNITY_LOOP [loop]
// Initialize arbitrary structure with zero values.
// Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0
#define ZERO_INITIALIZE(type, name) name = (type)0;
#define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } }
// Texture util abstraction
#define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2)
// Texture abstraction
#define TEXTURE2D(textureName) Texture2D textureName
#define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName
#define TEXTURECUBE(textureName) TextureCube textureName
#define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName
#define TEXTURE3D(textureName) Texture3D textureName
#define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName)
#define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName)
#define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName)
#define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName)
#define RW_TEXTURE2D(type, textureName) RWTexture2D<type> textureName
#define RW_TEXTURE3D(type, textureName) RWTexture3D<type> textureName
#define SAMPLER(samplerName) SamplerState samplerName
#define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName
#define TEXTURE2D_ARGS(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName)
#define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName)
#define TEXTURECUBE_ARGS(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName)
#define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName)
#define TEXTURE3D_ARGS(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName)
#define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName)
#define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName)
#define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName)
#define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName)
#define TEXTURE2D_PARAM(textureName, samplerName) textureName, samplerName
#define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) textureName, samplerName
#define TEXTURECUBE_PARAM(textureName, samplerName) textureName, samplerName
#define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) textureName, samplerName
#define TEXTURE3D_PARAM(textureName, samplerName) textureName, samplerName
#define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) textureName, samplerName
#define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) textureName, samplerName
#define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) textureName, samplerName
#define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) textureName, samplerName
#define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2)
#define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod)
#define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias)
#define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy)
#define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index))
#define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod)
#define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias)
#define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3)
#define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod)
#define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias)
#define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index))
#define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod)
#define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias)
#define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3)
#define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod)
#define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z)
#define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z)
#define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord3).xyz, (coord3).w)
#define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w)
#define SAMPLE_DEPTH_TEXTURE(textureName, samplerName, coord2) SAMPLE_TEXTURE2D(textureName, samplerName, coord2).r
#define SAMPLE_DEPTH_TEXTURE_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod).r
float4 switch_load_texture2d(Texture2D texName, uint2 unCoord2) {
uint _tw; uint _th;
texName.GetDimensions(_tw, _th);
unCoord2 = clamp(unCoord2, uint2(0, 0), uint2(_tw-1, _th-1));
return texName.Load(int3(unCoord2, 0));
}
//(kc)#define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0))
#define LOAD_TEXTURE2D(textureName, unCoord2) switch_load_texture2d(textureName, unCoord2)
#define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod))
#define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex)
#define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0))
#define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod))
#define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0))
#define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod))
#define PLATFORM_SUPPORT_GATHER
#define GATHER_TEXTURE2D(textureName, samplerName, coord2, offset) textureName.Gather(samplerName, coord2, offset)
#define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index), offset)
#define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3)
#define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index))
#define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2, offset) textureName.GatherRed(samplerName, coord2, offset)
#define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2, offset) textureName.GatherGreen(samplerName, coord2, offset)
#define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2, offset) textureName.GatherBlue(samplerName, coord2, offset)

9
ScriptableRenderPipeline/Core/CoreRP/ShaderLibrary/API/Switch.hlsl.meta


fileFormatVersion: 2
guid: e81335bf0a3c45c4fa81ed2fe67eeba0
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

8
Tests/UTF_Tests_HDRP.meta


fileFormatVersion: 2
guid: 86137e24adbf2b7488553f8ddda7cc8e
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存