浏览代码

Merge remote-tracking branch 'refs/remotes/origin/master' into Refactor-GBuffer-with-material-feature

# Conflicts:

#	ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/RenderLoopSettings/FrameSettingsUI.cs

#	ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/RenderLoopSettings/SerializedFrameSettings.cs
#	ScriptableRenderPipeline/HDRenderPipeline/HDRP/HDStringConstants.cs
#	ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Lit/Lit.hlsl

#	ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/SubsurfaceScattering/SubsurfaceScattering.hlsl

#	ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/SubsurfaceScattering/SubsurfaceScatteringManager.cs

#	ScriptableRenderPipeline/HDRenderPipeline/HDRP/RenderPipeline/FrameSettings.cs
/iridesence
Sebastien Lagarde 7 年前
当前提交
f2d69eb4
共有 10 个文件被更改,包括 36 次插入17 次删除
  1. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/HDRenderPipelineInspector.Styles.cs
  2. 5
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/HDRenderPipelineInspector.cs
  3. 3
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/RenderLoopSettings/FrameSettingsUI.cs
  4. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/RenderLoopSettings/SerializedFrameSettings.cs
  5. 1
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/HDStringConstants.cs
  6. 22
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Lit/Lit.hlsl
  7. 1
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/SubsurfaceScattering/SubsurfaceScattering.hlsl
  8. 1
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/SubsurfaceScattering/SubsurfaceScatteringManager.cs
  9. 14
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/RenderPipeline/FrameSettings.cs
  10. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/RenderPipeline/RenderPipelineSettings.cs

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/HDRenderPipelineInspector.Styles.cs


public readonly GUIContent supportDBuffer = new GUIContent("Support Decal buffer");
public readonly GUIContent supportMSAA = new GUIContent("Support MSAA");
public readonly GUIContent supportSubsurfaceScattering = new GUIContent("Support SubsurfaceScattering");
// Shadow Settings
public readonly GUIContent shadowSettings = new GUIContent("Shadow Settings");
public readonly GUIContent shadowsAtlasWidth = new GUIContent("Atlas Width");

5
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/HDRenderPipelineInspector.cs


// Global Render settings
SerializedProperty m_supportDBuffer;
SerializedProperty m_supportMSAA;
SerializedProperty m_supportSubsurfaceScattering;
// Global Shadow settings
SerializedProperty m_ShadowAtlasWidth;
SerializedProperty m_ShadowAtlasHeight;

// Global Render settings
m_supportDBuffer = properties.Find(x => x.renderPipelineSettings.supportDBuffer);
m_supportMSAA = properties.Find(x => x.renderPipelineSettings.supportMSAA);
m_supportSubsurfaceScattering = properties.Find(x => x.renderPipelineSettings.supportSubsurfaceScattering);
// Global Shadow settings
m_ShadowAtlasWidth = properties.Find(x => x.renderPipelineSettings.shadowInitParams.shadowAtlasWidth);
m_ShadowAtlasHeight = properties.Find(x => x.renderPipelineSettings.shadowInitParams.shadowAtlasHeight);

EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(m_supportDBuffer, s_Styles.supportDBuffer);
EditorGUILayout.PropertyField(m_supportMSAA, s_Styles.supportMSAA);
EditorGUILayout.PropertyField(m_supportSubsurfaceScattering, s_Styles.supportSubsurfaceScattering);
EditorGUI.indentLevel--;
}

3
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/RenderLoopSettings/FrameSettingsUI.cs


{
EditorGUILayout.PropertyField(p.enableSSR, _.GetContent("Enable SSR"));
EditorGUILayout.PropertyField(p.enableSSAO, _.GetContent("Enable SSAO"));
EditorGUILayout.PropertyField(p.enableSubsurfaceScattering, _.GetContent("Enable Subsurface Scattering"));
EditorGUILayout.PropertyField(p.enableSubsurfaceScattering, _.GetContent("Enable SubsurfaceScattering"));
EditorGUILayout.PropertyField(p.enableTransmission, _.GetContent("Enable Transmission"));
EditorGUILayout.PropertyField(p.enableShadow, _.GetContent("Enable Shadow"));
EditorGUILayout.PropertyField(p.enableShadowMask, _.GetContent("Enable Shadow Masks"));
}

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/RenderLoopSettings/SerializedFrameSettings.cs


public SerializedProperty enableSSR;
public SerializedProperty enableSSAO;
public SerializedProperty enableSubsurfaceScattering;
public SerializedProperty enableTransmission;
public SerializedProperty diffuseGlobalDimmer;
public SerializedProperty specularGlobalDimmer;

enableSSR = root.Find((FrameSettings d) => d.enableSSR);
enableSSAO = root.Find((FrameSettings d) => d.enableSSAO);
enableSubsurfaceScattering = root.Find((FrameSettings d) => d.enableSubsurfaceScattering);
enableTransmission = root.Find((FrameSettings d) => d.enableTransmission);
diffuseGlobalDimmer = root.Find((FrameSettings d) => d.diffuseGlobalDimmer);
specularGlobalDimmer = root.Find((FrameSettings d) => d.specularGlobalDimmer);
enableForwardRenderingOnly = root.Find((FrameSettings d) => d.enableForwardRenderingOnly);

1
ScriptableRenderPipeline/HDRenderPipeline/HDRP/HDStringConstants.cs


public static readonly int _SkyTextureMipCount = Shader.PropertyToID("_SkyTextureMipCount");
public static readonly int _EnableSubsurfaceScattering = Shader.PropertyToID("_EnableSubsurfaceScattering");
public static readonly int _TransmittanceMultiplier = Shader.PropertyToID("_TransmittanceMultiplier");
public static readonly int _TexturingModeFlags = Shader.PropertyToID("_TexturingModeFlags");
public static readonly int _TransmissionFlags = Shader.PropertyToID("_TransmissionFlags");
public static readonly int _ThicknessRemaps = Shader.PropertyToID("_ThicknessRemaps");

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


// Note: ApplySubsurfaceScatteringTexturingMode also test the diffusionProfile for updating diffuseColor based on SSS
}
void FillMaterialTransmission(int diffusionProfile, , float thickness, uint transmissionMode, inout BSDFData bsdfData)
void FillMaterialTransmission(int diffusionProfile, float thickness, uint transmissionMode, inout BSDFData bsdfData)
bsdfData.enableTransmission = _EnableTransmission != 0;
bsdfData.enableTransmission = (transmissionMode != TRANSMISSION_MODE_NONE);
if (bsdfData.enableTransmission && transmissionMode != TRANSMISSION_MODE_NONE)
if (bsdfData.enableTransmission)
bsdfData.transmittance = _EnableTransmission * ComputeTransmittanceDisney( _ShapeParams[diffusionProfile].rgb,
bsdfData.transmittance = _TransmittanceMultiplier * ComputeTransmittanceDisney( _ShapeParams[diffusionProfile].rgb,
bsdfData.thickness, bsdfData.subsurfaceMask);
bsdfData.thickness, 1.0);
bsdfData.transmittance = _EnableTransmission * ComputeTransmittanceJimenez( _HalfRcpVariancesAndWeights[diffusionProfile][0].rgb,
_HalfRcpVariancesAndWeights[diffusionProfile][0].a,
_HalfRcpVariancesAndWeights[diffusionProfile][1].rgb,
_HalfRcpVariancesAndWeights[diffusionProfile][1].a,
_TransmissionTintsAndFresnel0[diffusionProfile].rgb,
bsdfData.thickness, bsdfData.subsurfaceMask);
bsdfData.transmittance = _TransmittanceMultiplier * ComputeTransmittanceJimenez( _HalfRcpVariancesAndWeights[diffusionProfile][0].rgb,
_HalfRcpVariancesAndWeights[diffusionProfile][0].a,
_HalfRcpVariancesAndWeights[diffusionProfile][1].rgb,
_HalfRcpVariancesAndWeights[diffusionProfile][1].a,
_TransmissionTintsAndFresnel0[diffusionProfile].rgb,
bsdfData.thickness, 1.0);
#endif
}
}

1
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/SubsurfaceScattering/SubsurfaceScattering.hlsl


// Warning: Unity is not able to losslessly transfer integers larger than 2^24 to the shader system.
// Therefore, we bitcast uint to float in C#, and bitcast back to uint in the shader.
uint _EnableSubsurfaceScattering; // Globally toggles subsurface and transmission scattering on/off
float _TransmittanceMultiplier; // Allow to switch on/off the transmittance but doesn't save the cost
float _TexturingModeFlags; // 1 bit/profile; 0 = PreAndPostScatter, 1 = PostScatter
float _TransmissionFlags; // 2 bit/profile; 0 = inf. thick, 1 = thin, 2 = regular
// Old SSS Model >>>

1
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/SubsurfaceScattering/SubsurfaceScatteringManager.cs


{
// Broadcast SSS parameters to all shaders.
cmd.SetGlobalInt(HDShaderIDs._EnableSubsurfaceScattering, frameSettings.enableSubsurfaceScattering ? 1 : 0);
cmd.SetGlobalFloat(HDShaderIDs._TransmittanceMultiplier, frameSettings.enableTransmission ? 1.0f : 0.0f);
unsafe
{
// Warning: Unity is not able to losslessly transfer integers larger than 2^24 to the shader system.

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


public static string kEnableShadow = "Enable Shadow";
public static string kEnableSSR = "Enable SSR";
public static string kEnableSSAO = "Enable SSAO";
public static string kEnableSSSAndTransmission = "Enable SSS and Transmission";
public static string kEnableSubsurfaceScattering = "Enable SubsurfaceScattering";
public static string kEnableTransmission = "Enable Transmission";
public static string kForwardOnly = "Forward Only";
public static string kDeferredDepthPrepass = "Deferred Depth Prepass";

public bool enableSSR = true; // Depends on DepthPyramid
public bool enableSSAO = true;
public bool enableSubsurfaceScattering = true;
public bool enableTransmission = true; // Caution: this is only for debug, it doesn't save the cost of Transmission execution
// Setup by system
public float diffuseGlobalDimmer = 1.0f;

frameSettings.enableSSR = this.enableSSR;
frameSettings.enableSSAO = this.enableSSAO;
frameSettings.enableSubsurfaceScattering = this.enableSubsurfaceScattering;
frameSettings.enableTransmission = this.enableTransmission;
frameSettings.diffuseGlobalDimmer = this.diffuseGlobalDimmer;
frameSettings.specularGlobalDimmer = this.specularGlobalDimmer;

aggregate.enableShadow = frameSettings.enableShadow;
aggregate.enableSSR = camera.cameraType == CameraType.Reflection ? false : frameSettings.enableSSR && renderPipelineSettings.supportSSR;
aggregate.enableSSAO = frameSettings.enableSSAO && renderPipelineSettings.supportSSAO;
aggregate.enableSubsurfaceScattering = camera.cameraType == CameraType.Reflection ? false : frameSettings.enableSubsurfaceScattering && renderPipelineSettings.supportSSSAndTransmission;
aggregate.enableSubsurfaceScattering = camera.cameraType == CameraType.Reflection ? false : frameSettings.enableSubsurfaceScattering && renderPipelineSettings.supportSubsurfaceScattering;
aggregate.enableTransmission = frameSettings.enableTransmission;
// We have to fall back to forward-only rendering when scene view is using wireframe rendering mode
// as rendering everything in wireframe + deferred do not play well together

DebugMenuManager.instance.AddDebugItem<bool>(menuName, kEnableShadow, () => frameSettings.enableShadow, (value) => frameSettings.enableShadow = (bool)value);
DebugMenuManager.instance.AddDebugItem<bool>(menuName, kEnableSSR, () => frameSettings.enableSSR, (value) => frameSettings.enableSSR = (bool)value);
DebugMenuManager.instance.AddDebugItem<bool>(menuName, kEnableSSAO, () => frameSettings.enableSSAO, (value) => frameSettings.enableSSAO = (bool)value);
DebugMenuManager.instance.AddDebugItem<bool>(menuName, kEnableSSSAndTransmission, () => frameSettings.enableSubsurfaceScattering, (value) => frameSettings.enableSubsurfaceScattering = (bool)value);
DebugMenuManager.instance.AddDebugItem<bool>(menuName, kEnableSubsurfaceScattering, () => frameSettings.enableSubsurfaceScattering, (value) => frameSettings.enableSubsurfaceScattering = (bool)value);
DebugMenuManager.instance.AddDebugItem<bool>(menuName, kEnableTransmission, () => frameSettings.enableTransmission, (value) => frameSettings.enableTransmission = (bool)value);
DebugMenuManager.instance.AddDebugItem<bool>(menuName, kForwardOnly, () => frameSettings.enableForwardRenderingOnly, (value) => frameSettings.enableForwardRenderingOnly = (bool)value);
DebugMenuManager.instance.AddDebugItem<bool>(menuName, kDeferredDepthPrepass, () => frameSettings.enableDepthPrepassWithDeferredRendering, (value) => frameSettings.enableDepthPrepassWithDeferredRendering = (bool)value);

DebugMenuManager.instance.RemoveDebugItem(menuName, kEnableShadow);
DebugMenuManager.instance.RemoveDebugItem(menuName, kEnableSSR);
DebugMenuManager.instance.RemoveDebugItem(menuName, kEnableSSAO);
DebugMenuManager.instance.RemoveDebugItem(menuName, kEnableSSSAndTransmission);
DebugMenuManager.instance.RemoveDebugItem(menuName, kEnableSubsurfaceScattering);
DebugMenuManager.instance.RemoveDebugItem(menuName, kEnableTransmission);
DebugMenuManager.instance.RemoveDebugItem(menuName, kForwardOnly);
DebugMenuManager.instance.RemoveDebugItem(menuName, kDeferredDepthPrepassATestOnly);

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/RenderPipeline/RenderPipelineSettings.cs


public bool supportShadowMask = true;
public bool supportSSR = true;
public bool supportSSAO = true;
public bool supportSSSAndTransmission = true;
public bool supportSubsurfaceScattering = true;
// Engine
public bool supportDBuffer = false;

正在加载...
取消
保存