浏览代码

Rename 'MaterialClass' to 'MaterialID' in the code (not the UI) to avoid confusion

/main
Evgenii Golubev 8 年前
当前提交
5708bc95
共有 7 个文件被更改,包括 24 次插入31 次删除
  1. 9
      Assets/ScriptableRenderLoop/HDRenderPipeline/Material/Lit/Editor/BaseLitUI.cs
  2. 14
      Assets/ScriptableRenderLoop/HDRenderPipeline/Material/Lit/Editor/LitUI.cs
  3. 2
      Assets/ScriptableRenderLoop/HDRenderPipeline/Material/Lit/Lit.shader
  4. 2
      Assets/ScriptableRenderLoop/HDRenderPipeline/Material/Lit/LitDataInternal.hlsl
  5. 2
      Assets/ScriptableRenderLoop/HDRenderPipeline/Material/Lit/LitProperties.hlsl
  6. 2
      Assets/ScriptableRenderLoop/HDRenderPipeline/Material/Lit/LitTessellation.shader
  7. 24
      Assets/ScriptableRenderLoop/HDRenderPipeline/Utilities.cs

9
Assets/ScriptableRenderLoop/HDRenderPipeline/Material/Lit/Editor/BaseLitUI.cs


public static GUIContent detailMapModeText = new GUIContent("Detail Map with Normal", "Detail Map with AO / Height");
public static GUIContent UVDetailMappingText = new GUIContent("UV set for Detail", "");
public static GUIContent materialClassText = new GUIContent("Material Class", "Subsurface Scattering: enable for translucent materials such as skin, vegetation, fruit, marble, wax and milk.");
public static GUIContent materialIDText = new GUIContent("Material Class", "Subsurface Scattering: enable for translucent materials such as skin, vegetation, fruit, marble, wax and milk.");
public static GUIContent emissiveColorModeText = new GUIContent("Emissive Color Usage", "Use emissive color or emissive mask");
public static string InputsText = "Inputs";

Phong,
Displacement,
DisplacementPhong,
}
public enum MaterialClass
{
Standard,
SSS,
Hair
}
void SurfaceTypePopup()

14
Assets/ScriptableRenderLoop/HDRenderPipeline/Material/Lit/Editor/LitUI.cs


protected const string kUVDetail = "_UVDetail";
protected MaterialProperty UVDetailsMappingMask = null;
protected const string kUVDetailsMappingMask = "_UVDetailsMappingMask";
protected MaterialProperty materialClass = null;
protected const string kMaterialClass = "_MaterialClass";
protected MaterialProperty materialID = null;
protected const string kMaterialID = "_MaterialID";
protected MaterialProperty emissiveColorMode = null;
protected const string kEmissiveColorMode = "_EmissiveColorMode";

// These are options that are shared with the LayeredLit shader. Don't put anything that can't be shared here:
// For instance, properties like BaseColor and such don't exist in the LayeredLit so don't put them here.
protected void FindMaterialOptionProperties(MaterialProperty[] props)
{
{
smoothnessMapChannel = FindProperty(kSmoothnessTextureChannel, props);
normalMapSpace = FindProperty(kNormalMapSpace, props);
enablePerPixelDisplacement = FindProperty(kEnablePerPixelDisplacement, props);

materialClass = FindProperty(kMaterialClass, props);
materialID = FindProperty(kMaterialID, props);
emissiveColorMode = FindProperty(kEmissiveColorMode, props);
}

m_MaterialEditor.ShaderProperty(ppdMinSamples, Styles.ppdMinSamplesText);
m_MaterialEditor.ShaderProperty(ppdMaxSamples, Styles.ppdMaxSamplesText);
ppdMinSamples.floatValue = Mathf.Min(ppdMinSamples.floatValue, ppdMaxSamples.floatValue);
m_MaterialEditor.ShaderProperty(materialClass, Styles.materialClassText);
m_MaterialEditor.ShaderProperty(materialID, Styles.materialIDText);
EditorGUI.indentLevel--;
}

bool smoothnessInAlbedoAlpha = (SmoothnessMapChannel)smoothnessMapChannel.floatValue == SmoothnessMapChannel.AlbedoAlpha;
bool smoothnessInAlbedoAlpha = (SmoothnessMapChannel)smoothnessMapChannel.floatValue == SmoothnessMapChannel.AlbedoAlpha;
bool useDetailMapWithNormal = (DetailMapMode)detailMapMode.floatValue == DetailMapMode.DetailWithNormal;
bool useEmissiveMask = (EmissiveColorMode)emissiveColorMode.floatValue == EmissiveColorMode.UseEmissiveMask;

material.DisableKeyword("_REQUIRE_UV3");
}
material.SetInt("_StencilRef", (int)material.GetFloat(kMaterialClass)); // See 'StencilBits'.
material.SetInt("_StencilRef", (int)material.GetFloat(kMaterialID)); // See 'StencilBits'.
}
}
} // namespace UnityEditor

2
Assets/ScriptableRenderLoop/HDRenderPipeline/Material/Lit/Lit.shader


_DetailHeightScale("_DetailHeightScale", Range(-2.0, 2.0)) = 1
_DetailAOScale("_DetailAOScale", Range(-2.0, 2.0)) = 1
[Enum(Standard, 0, Subsurface Scattering, 1, Hair, 2)] _MaterialClass("Material Class", Int) = 0
[Enum(Standard, 0, Subsurface Scattering, 1, Clear Coat, 2)] _MaterialID("Material Class", Int) = 0
_SubSurfaceRadius("SubSurfaceRadius", Range(0.0, 1.0)) = 0
_SubSurfaceRadiusMap("SubSurfaceRadiusMap", 2D) = "white" {}
//_Thickness("Thickness", Range(0.0, 1.0)) = 0

2
Assets/ScriptableRenderLoop/HDRenderPipeline/Material/Lit/LitDataInternal.hlsl


// This part of the code is not used in case of layered shader but we keep the same macro system for simplicity
#if !defined(LAYERED_LIT_SHADER)
surfaceData.materialId = _MaterialClass;
surfaceData.materialId = _MaterialID;
// TODO: think about using BC5
#ifdef _TANGENTMAP

2
Assets/ScriptableRenderLoop/HDRenderPipeline/Material/Lit/LitProperties.hlsl


TEXTURE2D(_AnisotropyMap);
SAMPLER2D(sampler_AnisotropyMap);
float _MaterialClass;
float _MaterialID;
//float _SubSurfaceRadius;
//TEXTURE2D(_SubSurfaceRadiusMap);

2
Assets/ScriptableRenderLoop/HDRenderPipeline/Material/Lit/LitTessellation.shader


_DetailHeightScale("_DetailHeightScale", Range(-2.0, 2.0)) = 1
_DetailAOScale("_DetailAOScale", Range(-2.0, 2.0)) = 1
[Enum(Standard, 0, Subsurface Scattering, 1, Hair, 2)] _MaterialClass("Material Class", Int) = 0
[Enum(Standard, 0, Subsurface Scattering, 1, Clear Coat, 2)] _MaterialID("Material Class", Int) = 0
_SubSurfaceRadius("SubSurfaceRadius", Range(0.0, 1.0)) = 0
_SubSurfaceRadiusMap("SubSurfaceRadiusMap", 2D) = "white" {}
//_Thickness("Thickness", Range(0.0, 1.0)) = 0

24
Assets/ScriptableRenderLoop/HDRenderPipeline/Utilities.cs


[Flags]
public enum StencilBits
{
None = 0,
SSS = 1, // BaseLitGUI.MaterialClass.SSS
Hair = 2, // BaseLitGUI.MaterialClass.Hair
All = 255 // 0xff
None = Lit.MaterialId.LitStandard,
SSS = Lit.MaterialId.LitSSS,
ClearCoat = Lit.MaterialId.LitClearCoat,
All = 255 // 0xff
}
public class Utilities

return renderContext;
}
static Mesh m_FullscreenTriangle = null;
static Mesh m_ScreenSpaceTriangle = null;
static Mesh GetFullscreenTriangle()
static Mesh GetScreenSpaceTriangle()
if (!m_FullscreenTriangle)
if (!m_ScreenSpaceTriangle)
m_FullscreenTriangle = new Mesh
m_ScreenSpaceTriangle = new Mesh
{
// Note: neither the vertex nor the index data is actually used if the vertex shader computes vertices
// using 'SV_VertexID'. However, there is currently no way to bind NULL vertex or index buffers.

}
return m_FullscreenTriangle;
return m_ScreenSpaceTriangle;
}
// Draws a full screen triangle as a faster alternative to drawing a full-screen quad.

{
SetupMaterialHDCamera(camera, material);
commandBuffer.SetRenderTarget(colorBuffer);
commandBuffer.DrawMesh(GetFullscreenTriangle(), Matrix4x4.identity, material, 0, shaderPassID, properties);
commandBuffer.DrawMesh(GetScreenSpaceTriangle(), Matrix4x4.identity, material, 0, shaderPassID, properties);
}
// Draws a full screen triangle as a faster alternative to drawing a full-screen quad.

{
SetupMaterialHDCamera(camera, material);
commandBuffer.SetRenderTarget(colorBuffer, depthStencilBuffer);
commandBuffer.DrawMesh(GetFullscreenTriangle(), Matrix4x4.identity, material, 0, shaderPassID, properties);
commandBuffer.DrawMesh(GetScreenSpaceTriangle(), Matrix4x4.identity, material, 0, shaderPassID, properties);
}
// Draws a full screen triangle as a faster alternative to drawing a full-screen quad.

{
SetupMaterialHDCamera(camera, material);
commandBuffer.SetRenderTarget(colorBuffers, depthStencilBuffer);
commandBuffer.DrawMesh(GetFullscreenTriangle(), Matrix4x4.identity, material, 0, shaderPassID, properties);
commandBuffer.DrawMesh(GetScreenSpaceTriangle(), Matrix4x4.identity, material, 0, shaderPassID, properties);
}
// Draws a full screen triangle as a faster alternative to drawing a full-screen quad.

正在加载...
取消
保存