浏览代码

HDR is disabled by default in LW pipeline asset. This was causing a major performance difference because builtin will only have HDR enabled in forward if a tonemapping fx is enabled.

/main
Felipe Lira 7 年前
当前提交
d66bbf81
共有 4 个文件被更改,包括 23 次插入5 次删除
  1. 6
      ScriptableRenderPipeline/LightweightPipeline/LWRP/Data/LightweightPipelineAsset.cs
  2. 4
      ScriptableRenderPipeline/LightweightPipeline/LWRP/Editor/LightweightAssetEditor.cs
  3. 9
      ScriptableRenderPipeline/LightweightPipeline/LWRP/Editor/LightweightCameraEditor.cs
  4. 9
      ScriptableRenderPipeline/LightweightPipeline/LWRP/LightweightPipeline.cs

6
ScriptableRenderPipeline/LightweightPipeline/LWRP/Data/LightweightPipelineAsset.cs


[SerializeField] private int m_MaxPixelLights = 4;
[SerializeField] private bool m_SupportsVertexLight = false;
[SerializeField] private bool m_RequireCameraDepthTexture = false;
[SerializeField] private bool m_SupportsHDR = false;
[SerializeField] private MSAAQuality m_MSAA = MSAAQuality._4x;
[SerializeField] private float m_RenderScale = 1.0f;
[SerializeField] private ShadowType m_ShadowType = ShadowType.HARD_SHADOWS;

public bool RequireCameraDepthTexture
{
get { return m_RequireCameraDepthTexture; }
}
public bool SupportsHDR
{
get { return m_SupportsHDR; }
}
public int MSAASampleCount

4
ScriptableRenderPipeline/LightweightPipeline/LWRP/Editor/LightweightAssetEditor.cs


public static GUIContent shadowCascadeSplit = new GUIContent("Cascades Split",
"Percentages to split shadow volume");
public static GUIContent hdrContent = new GUIContent("HDR", "Controls the global HDR settings.");
public static GUIContent msaaContent = new GUIContent("Anti Aliasing (MSAA)", "Controls the global anti aliasing settings.");
public static string[] shadowTypeOptions = {"No Shadows", "Hard Shadows", "Hard and Soft Shadows"};

private SerializedProperty m_ShadowCascadesProp;
private SerializedProperty m_ShadowCascade2SplitProp;
private SerializedProperty m_ShadowCascade4SplitProp;
private SerializedProperty m_HDR;
private SerializedProperty m_MSAA;
void OnEnable()

m_ShadowCascadesProp = serializedObject.FindProperty("m_ShadowCascades");
m_ShadowCascade2SplitProp = serializedObject.FindProperty("m_Cascade2Split");
m_ShadowCascade4SplitProp = serializedObject.FindProperty("m_Cascade4Split");
m_HDR = serializedObject.FindProperty("m_SupportsHDR");
m_MSAA = serializedObject.FindProperty("m_MSAA");
}

EditorGUILayout.EndHorizontal();
EditorGUILayout.PropertyField(m_SupportsVertexLightProp, Styles.enableVertexLightLabel);
EditorGUILayout.PropertyField(m_RequireCameraDepthTextureProp, Styles.requireCameraDepthTexture);
EditorGUILayout.PropertyField(m_HDR, Styles.hdrContent);
EditorGUILayout.PropertyField(m_MSAA, Styles.msaaContent);
EditorGUI.indentLevel--;

9
ScriptableRenderPipeline/LightweightPipeline/LWRP/Editor/LightweightCameraEditor.cs


EditorGUILayout.HelpBox(s_Styles.renderingPathInfo.text, MessageType.Info);
}
private void DrawHDR()
{
settings.DrawHDR();
if (settings.HDR.boolValue && !lightweightPipeline.SupportsHDR)
EditorGUILayout.HelpBox("HDR rendering is disabled in Lightweight Pipeline asset.", MessageType.Warning);
}
private void DrawTargetTexture()
{
EditorGUILayout.PropertyField(settings.targetTexture);

DrawRenderingPath();
DrawTargetTexture();
settings.DrawOcclusionCulling();
settings.DrawHDR();
DrawHDR();
DrawMSAA();
settings.DrawVR();
settings.DrawMultiDisplay();

9
ScriptableRenderPipeline/LightweightPipeline/LWRP/LightweightPipeline.cs


else
m_IntermediateTextureArray = false;
bool hdrEnabled = m_Asset.SupportsHDR && m_CurrCamera.allowHDR;
m_Asset.RenderScale < 1.0f || m_CurrCamera.allowHDR;
m_Asset.RenderScale < 1.0f || hdrEnabled;
m_ColorFormat = m_CurrCamera.allowHDR ? RenderTextureFormat.ARGBHalf : RenderTextureFormat.ARGB32;
m_ColorFormat = hdrEnabled ? RenderTextureFormat.DefaultHDR : RenderTextureFormat.Default;
m_RequiredDepth = false;
m_CameraPostProcessLayer = m_CurrCamera.GetComponent<PostProcessLayer>();

bias = light.shadowBias * proj.m22 * 0.5f * sign;
// Currently only square POT cascades resolutions are used.
// We scale normalBias
// We scale normalBias
double frustumWidth = 2.0 / (double)proj.m00;
double frustumHeight = 2.0 / (double)proj.m11;
float texelSizeX = (float)(frustumWidth / (double)cascadeResolution);

worldToShadow = cascadeAtlas * worldToShadow;
m_ShadowSlices[cascadeIndex].atlasX = atlasX;
m_ShadowSlices[cascadeIndex].atlasY = atlasY;
m_ShadowSlices[cascadeIndex].atlasY = atlasY;
m_ShadowSlices[cascadeIndex].shadowResolution = shadowResolution;
m_ShadowSlices[cascadeIndex].shadowTransform = worldToShadow;
}

正在加载...
取消
保存