浏览代码

Use only a single screen space setting for SSR

Updated UI
/main
Frédéric Vauchelles 6 年前
当前提交
92fe8d5d
共有 9 个文件被更改,包括 34 次插入30 次删除
  1. 20
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/Reflection/HDScreenSpaceReflectionEditor.cs
  2. 16
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/Reflection/ScreenSpaceLightingEditor.cs
  3. 5
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/Reflection/ScreenSpaceRefractionEditor.cs
  4. 9
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Material/Lit/LitUI.cs
  5. 1
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/LightLoop/LightLoop.cs
  6. 5
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/Reflection/ScreenSpaceReflection.cs
  7. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Lit/Lit.hlsl
  8. 3
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Lit/Lit.shader
  9. 3
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Lit/LitTessellation.shader

20
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/Reflection/HDScreenSpaceReflectionEditor.cs


using System.Collections;
using UnityEngine;
using UnityEditor;
using UnityEditor.Experimental.Rendering;
using UnityEngine.Experimental.Rendering.HDPipeline;
namespace UnityEngine.Experimental.Rendering.HDPipeline
namespace UnityEditor.Experimental.Rendering.HDPipeline
{
[CanEditMultipleObjects]
[VolumeComponentEditor(typeof(ScreenSpaceReflection))]

public override void OnInspectorGUI()
{
base.OnInspectorGUI();
OnCommonInspectorGUI();
var projectionModel = (Lit.ProjectionModel)m_DeferredProjectionModel.value.enumValueIndex;
switch (projectionModel)
{
case Lit.ProjectionModel.HiZ:
EditorGUILayout.Separator();
OnHiZInspectorGUI();
break;
}
}
EditorGUILayout.LabelField(CoreEditorUtils.GetContent("Deferred Settings"));
protected override void OnCommonInspectorGUI()
{
base.OnCommonInspectorGUI();
PropertyField(m_DeferredProjectionModel, CoreEditorUtils.GetContent("Projection Model"));
}
}

16
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/Reflection/ScreenSpaceLightingEditor.cs


using System.Collections;
using UnityEngine;
using UnityEditor;
using UnityEditor.Experimental.Rendering;
using UnityEngine.Experimental.Rendering.HDPipeline;
namespace UnityEngine.Experimental.Rendering.HDPipeline
namespace UnityEditor.Experimental.Rendering.HDPipeline
{
public class ScreenSpaceLightingEditor : VolumeComponentEditor
{

public override void OnInspectorGUI()
{
OnCommonInspectorGUI();
EditorGUILayout.Separator();
OnHiZInspectorGUI();
}
protected virtual void OnHiZInspectorGUI()
{
}
EditorGUILayout.Separator();
protected virtual void OnCommonInspectorGUI()
{
EditorGUILayout.LabelField(CoreEditorUtils.GetContent("Common Settings"));
PropertyField(m_ScreenWeightDistance, CoreEditorUtils.GetContent("Screen Weight Distance"));
}

5
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/Reflection/ScreenSpaceRefractionEditor.cs


using System.Collections;
using UnityEngine;
using UnityEditor;
using UnityEditor.Experimental.Rendering;
using UnityEngine.Experimental.Rendering.HDPipeline;
namespace UnityEngine.Experimental.Rendering.HDPipeline
namespace UnityEditor.Experimental.Rendering.HDPipeline
{
[CanEditMultipleObjects]
[VolumeComponentEditor(typeof(ScreenSpaceRefraction))]

9
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("SS Reflection Projection Model", "Screen Space Projection Model For Reflections");
// Details
public static string detailText = "Detail Inputs";

protected const string kRefractionModel = "_RefractionModel";
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);
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);

DoDistortionInputsGUI();
--EditorGUI.indentLevel;
}
else if (surfaceTypeValue == SurfaceType.Opaque)
{
m_MaterialEditor.ShaderProperty(ssreflectionProjectionModel, Styles.reflectionProjectionModelText);
}
}

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


// TODO: Is it possible to setup this outside the loop ? Can figure out how, get this: Property (specularLightingUAV) at kernel index (21) is not set
cmd.SetComputeTextureParam(deferredComputeShader, kernel, HDShaderIDs.specularLightingUAV, colorBuffers[0]);
cmd.SetComputeTextureParam(deferredComputeShader, kernel, HDShaderIDs.diffuseLightingUAV, colorBuffers[1]);
cmd.SetComputeIntParam(deferredComputeShader, HDShaderIDs._SSReflectionProjectionModel, (int)ssReflection.deferredProjectionModel.value);
if (debugDisplaySettings.lightingDebugSettings.debugLightingMode == DebugLightingMode.ScreenSpaceTracingReflection)
cmd.SetComputeBufferParam(deferredComputeShader, kernel, HDShaderIDs._DebugScreenSpaceTracingData, debugSSTBuffer);

5
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/Reflection/ScreenSpaceReflection.cs


namespace UnityEngine.Experimental.Rendering.HDPipeline
{
[Serializable]
public sealed class LitProjectionModelParameter : VolumeParameter<Lit.ProjectionModel> { }
public sealed class LitProjectionModelParameter : VolumeParameter<Lit.ProjectionModel>
{
public LitProjectionModelParameter() : base(Lit.ProjectionModel.Proxy, false) { }
}
[Serializable]
public class ScreenSpaceReflection : ScreenSpaceLighting

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


static const uint kFeatureVariantFlags[NUM_FEATURE_VARIANTS] =
{
// Precomputed illumination (no dynamic lights) for all material types
/* 0 */ LIGHTFEATUREFLAGS_SKY | LIGHTFEATUREFLAGS_ENV | MATERIAL_FEATURE_MASK_FLAGS,
/* 0 */ LIGHTFEATUREFLAGS_SKY | LIGHTFEATUREFLAGS_ENV | LIGHTFEATUREFLAGS_SSREFLECTION | MATERIAL_FEATURE_MASK_FLAGS,
/* 1 */ LIGHTFEATUREFLAGS_SKY | LIGHTFEATUREFLAGS_DIRECTIONAL | LIGHTFEATUREFLAGS_PUNCTUAL | MATERIALFEATUREFLAGS_LIT_STANDARD,
/* 2 */ LIGHTFEATUREFLAGS_SKY | LIGHTFEATUREFLAGS_DIRECTIONAL | LIGHTFEATUREFLAGS_AREA | MATERIALFEATUREFLAGS_LIT_STANDARD,

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


_ATDistance("Transmittance Absorption Distance", Float) = 1.0
[ToggleUI] _PreRefractionPass("PreRefractionPass", Float) = 0.0
// SSReflection
[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)
[HideInInspector] _StencilWriteMask("_StencilWriteMask", Int) = 7 // StencilMask.Lighting (fixed at compile time)

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


_ATDistance("Transmittance Absorption Distance", Float) = 1.0
[ToggleUI] _PreRefractionPass("PreRefractionPass", Float) = 0.0
// SSReflection
[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)
[HideInInspector] _StencilWriteMask("_StencilWriteMask", Int) = 7 // StencilMask.Lighting (fixed at compile time)

正在加载...
取消
保存