浏览代码

Stripped UI options/pipeline config of feature. Relies on cascades for now.

/main
John 7 年前
当前提交
90cac197
共有 4 个文件被更改,包括 8 次插入23 次删除
  1. 6
      ScriptableRenderPipeline/LightweightPipeline/LWRP/Data/LightweightPipelineAsset.cs
  2. 9
      ScriptableRenderPipeline/LightweightPipeline/LWRP/Editor/LightweightAssetEditor.cs
  3. 12
      ScriptableRenderPipeline/LightweightPipeline/LWRP/LightweightPipeline.cs
  4. 4
      ScriptableRenderPipeline/LightweightPipeline/LWRP/ShaderLibrary/Shadows.hlsl

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


[SerializeField] private bool m_SupportsVertexLight = false;
[SerializeField] private bool m_RequireDepthTexture = false;
[SerializeField] private bool m_RequireSoftParticles = false;
[SerializeField] private bool m_RequireScreenSpaceShadows = false;
[SerializeField] private bool m_SupportsHDR = false;
[SerializeField] private MSAAQuality m_MSAA = MSAAQuality._4x;
[SerializeField] private float m_RenderScale = 1.0f;

public bool RequireSoftParticles
{
get { return m_RequireSoftParticles; }
}
public bool RequireScreenSpaceShadows
{
get { return m_RequireScreenSpaceShadows; }
}
public bool SupportsHDR

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


public static GUIContent requireSoftParticles = new GUIContent("Soft Particles", "If enabled the pipeline will enable SOFT_PARTICLES keyword.");
public static GUIContent requireScreenSpaceShadows = new GUIContent("Screen Space Shadows", "TODO");
public static GUIContent shadowType = new GUIContent("Type",
"Global shadow settings. Options are NO_SHADOW, HARD_SHADOWS and SOFT_SHADOWS.");

private SerializedProperty m_MaxPixelLights;
private SerializedProperty m_SupportsVertexLightProp;
private SerializedProperty m_RequireDepthTextureProp;
private SerializedProperty m_RequireScreenSpaceShadowsProp;
private SerializedProperty m_RequireSoftParticlesProp;
private SerializedProperty m_ShadowTypeProp;
private SerializedProperty m_ShadowNearPlaneOffsetProp;

m_SupportsVertexLightProp = serializedObject.FindProperty("m_SupportsVertexLight");
m_RequireDepthTextureProp = serializedObject.FindProperty("m_RequireDepthTexture");
m_RequireSoftParticlesProp = serializedObject.FindProperty("m_RequireSoftParticles");
m_RequireScreenSpaceShadowsProp = serializedObject.FindProperty("m_RequireScreenSpaceShadows");
m_ShadowTypeProp = serializedObject.FindProperty("m_ShadowType");
m_ShadowNearPlaneOffsetProp = serializedObject.FindProperty("m_ShadowNearPlaneOffset");
m_ShadowDistanceProp = serializedObject.FindProperty("m_ShadowDistance");

m_ShowSoftParticles.valueChanged.AddListener(Repaint);
m_ShowSoftParticles.value = m_RequireSoftParticlesProp.boolValue;
m_ShowScreenSpaceShadows.valueChanged.AddListener(Repaint);
m_ShowScreenSpaceShadows.value = m_RequireScreenSpaceShadowsProp.boolValue;
}
void OnDisable()

{
EditorGUILayout.PropertyField(m_ShadowCascade2SplitProp, Styles.shadowCascadeSplit);
}
DrawAnimatedProperty(m_RequireScreenSpaceShadowsProp, Styles.requireScreenSpaceShadows, m_ShowScreenSpaceShadows);
EditorGUI.indentLevel--;

12
ScriptableRenderPipeline/LightweightPipeline/LWRP/LightweightPipeline.cs


private bool m_RequireDepthTexture;
private bool m_RequireCopyColor;
private bool m_DepthRenderBuffer;
private bool m_RequireScreenSpaceShadows;
private MixedLightingSetup m_MixedLightingSetup;
private const int kDepthStencilBufferBits = 32;

if (LightweightUtils.HasFlag(frameRenderingConfiguration, FrameRenderingConfiguration.DepthPrePass))
{
DepthPass(ref context);
if(m_RequireScreenSpaceShadows)
if(m_ShadowCasterCascadesCount > 1)
ShadowCollectPass(ref context, visibleLights, ref lightData);
}

// TODO: PostProcessing and SoftParticles are currently not support for VR
bool postProcessEnabled = m_CameraPostProcessLayer != null && m_CameraPostProcessLayer.enabled && !stereoEnabled;
m_RequireDepthTexture = m_Asset.RequireDepthTexture && !stereoEnabled;
//Assume screen space shadows when cascades enabled, which requires depth texture before forward pass.
m_RequireDepthTexture = m_Asset.RequireDepthTexture && !stereoEnabled || m_Asset.CascadeCount > 1;
if (postProcessEnabled)
{
m_RequireDepthTexture = true;

{
// If msaa is enabled we don't use a depth renderbuffer as we might not have support to Texture2DMS to resolve depth.
// Instead we use a depth prepass and whenever depth is needed we use the 1 sample depth from prepass.
if (!msaaEnabled)
if (!msaaEnabled && m_Asset.CascadeCount <= 1)
{
bool supportsDepthCopy = m_CopyTextureSupport != CopyTextureSupport.None && m_Asset.CopyDepthShader.isSupported;
m_DepthRenderBuffer = true;

}
}
m_RequireScreenSpaceShadows = m_Asset.RequireScreenSpaceShadows && LightweightUtils.HasFlag(configuration, FrameRenderingConfiguration.DepthPrePass);
Rect cameraRect = m_CurrCamera.rect;
if (!(Math.Abs(cameraRect.x) > 0.0f || Math.Abs(cameraRect.y) > 0.0f || Math.Abs(cameraRect.width) < 1.0f || Math.Abs(cameraRect.height) < 1.0f))
configuration |= FrameRenderingConfiguration.DefaultViewport;

4
ScriptableRenderPipeline/LightweightPipeline/LWRP/ShaderLibrary/Shadows.hlsl


inline half SampleScreenSpaceShadowMap(float4 shadowCoord)
{
//NOTE: No macro for proj sample?
return SAMPLE_TEXTURE2D(_ScreenSpaceShadowMap, sampler_ScreenSpaceShadowMap, shadowCoord.xy / shadowCoord.w).x;
shadowCoord.xyz = shadowCoord.xyz / shadowCoord.w;
return SAMPLE_TEXTURE2D(_ScreenSpaceShadowMap, sampler_ScreenSpaceShadowMap, shadowCoord.xy).x;
}
inline half SampleShadowmap(float4 shadowCoord)

正在加载...
取消
保存