浏览代码

Small SSR fixes

/main
Frédéric Vauchelles 7 年前
当前提交
8434e359
共有 4 个文件被更改,包括 15 次插入15 次删除
  1. 20
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Material/Lit/LitUI.cs
  2. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Lit/Lit.hlsl
  3. 4
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Lit/Lit.shader
  4. 4
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Lit/LitTessellation.shader

20
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Material/Lit/LitUI.cs


public static GUIContent UVBaseMappingText = new GUIContent("Base UV mapping", "");
public static GUIContent texWorldScaleText = new GUIContent("World scale", "Tiling factor applied to Planar/Trilinear mapping");
// SSReflection
public static GUIContent reflectionProjectionModelText = new GUIContent("Projection Model", "Screen Space Projection Model");
public static GUIContent reflectionProjectionModelText = new GUIContent("SS Reflection Projection Model", "Screen Space Projection Model For Reflections");
// Details
public static string detailText = "Detail Inputs";

protected const string kThicknessMultiplier = "_ThicknessMultiplier";
protected MaterialProperty refractionModel = null;
protected const string kRefractionModel = "_RefractionModel";
protected MaterialProperty refractionProjectionModel = null;
protected const string kRefractionProjectionModel = "_RefractionProjectionModel";
protected MaterialProperty reflectionProjectionModel = null;
protected const string kReflectionProjectionModel = "_ReflectionProjectionModel";
protected MaterialProperty ssrefractionProjectionModel = null;
protected const string kSSRefractionProjectionModel = "_SSRefractionProjectionModel";
protected MaterialProperty ssreflectionProjectionModel = null;
protected const string kSSReflectionProjectionModel = "_SSReflectionProjectionModel";
protected override bool showBlendModePopup
{

// Transparency
refractionModel = FindProperty(kRefractionModel, props, false);
refractionProjectionModel = FindProperty(kRefractionProjectionModel, props, false);
reflectionProjectionModel = FindProperty(kReflectionProjectionModel, props, false);
ssrefractionProjectionModel = FindProperty(kSSRefractionProjectionModel, props, false);
ssreflectionProjectionModel = FindProperty(kSSReflectionProjectionModel, props, false);
transmittanceColor = FindProperty(kTransmittanceColor, props, false);
transmittanceColorMap = FindProperty(kTransmittanceColorMap, props, false);
atDistance = FindProperty(kATDistance, props, false);

var mode = (Lit.RefractionModel)refractionModel.floatValue;
if (mode != Lit.RefractionModel.None)
{
m_MaterialEditor.ShaderProperty(refractionProjectionModel, Styles.refractionProjectionModelText);
m_MaterialEditor.ShaderProperty(ssrefractionProjectionModel, Styles.refractionProjectionModelText);
m_MaterialEditor.ShaderProperty(ior, Styles.refractionIorText);
blendMode.floatValue = (float)BlendMode.Alpha;

}
else if (surfaceTypeValue == SurfaceType.Opaque)
{
m_MaterialEditor.ShaderProperty(reflectionProjectionModel, Styles.reflectionProjectionModelText);
m_MaterialEditor.ShaderProperty(ssreflectionProjectionModel, Styles.reflectionProjectionModelText);
}
}

CoreUtils.SetKeyword(material, "_MATERIAL_FEATURE_SPECULAR_COLOR", materialId == BaseLitGUI.MaterialId.LitSpecular);
var refractionModelValue = (Lit.RefractionModel)material.GetFloat(kRefractionModel);
var refractionProjectionModelValue = (Lit.ProjectionModel)material.GetFloat(kRefractionProjectionModel);
var refractionProjectionModelValue = (Lit.ProjectionModel)material.GetFloat(kSSRefractionProjectionModel);
// We can't have refraction in pre-refraction queue
var canHaveRefraction = !material.HasProperty(kPreRefractionPass) || material.GetFloat(kPreRefractionPass) <= 0.0;
CoreUtils.SetKeyword(material, "_REFRACTION_PLANE", (refractionModelValue == Lit.RefractionModel.Plane) && canHaveRefraction);

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


{
#if defined(_REFRACTION_SSRAY_HIZ)
projectionModel = PROJECTIONMODEL_HI_Z;
#else defined(_REFRACTION_SSRAY_PROXY)
#elif defined(_REFRACTION_SSRAY_PROXY)
projectionModel = PROJECTIONMODEL_PROXY;
#endif
}

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


// Transparency
[Enum(None, 0, Plane, 1, Sphere, 2)]_RefractionModel("Refraction Model", Int) = 0
[Enum(Proxy, 1, HiZ, 2)]_RefractionProjectionModel("Refraction Projection Model", Int) = 0
[Enum(Proxy, 1, HiZ, 2)]_SSRefractionProjectionModel("Refraction Projection Model", Int) = 0
_Ior("Index Of Refraction", Range(1.0, 2.5)) = 1.0
_ThicknessMultiplier("Thickness Multiplier", Float) = 1.0
_TransmittanceColor("Transmittance Color", Color) = (1.0, 1.0, 1.0)

// SSReflection
[Enum(None, 0, Proxy, 1, HiZ, 2)]_ReflectionProjectionModel("Reflection Projection Model", Int) = 0
[Enum(None, 0, Proxy, 1, HiZ, 2)]_SSReflectionProjectionModel("Reflection Projection Model", Int) = 0
// Stencil state
[HideInInspector] _StencilRef("_StencilRef", Int) = 2 // StencilLightingUsage.RegularLighting (fixed at compile time)

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


// Transparency
[Enum(None, 0, Plane, 1, Sphere, 2)]_RefractionModel("Refraction Model", Int) = 0
[Enum(Proxy, 1, HiZ, 2)]_RefractionProjectionModel("Refraction Projection Model", Int) = 0
[Enum(Proxy, 1, HiZ, 2)]_SSRefractionProjectionModel("Refraction Projection Model", Int) = 0
_Ior("Index Of Refraction", Range(1.0, 2.5)) = 1.0
_ThicknessMultiplier("Thickness Multiplier", Float) = 1.0
_TransmittanceColor("Transmittance Color", Color) = (1.0, 1.0, 1.0)

// SSReflection
[Enum(None, 0, Proxy, 1, HiZ, 2)]_ReflectionProjectionModel("Reflection Projection Model", Int) = 0
[Enum(None, 0, Proxy, 1, HiZ, 2)]_SSReflectionProjectionModel("Reflection Projection Model", Int) = 0
// Stencil state
[HideInInspector] _StencilRef("_StencilRef", Int) = 2 // StencilLightingUsage.RegularLighting (fixed at compile time)

正在加载...
取消
保存