浏览代码

Initial UI additions, fixes

/main
John 7 年前
当前提交
31c4096c
共有 4 个文件被更改,包括 24 次插入7 次删除
  1. 6
      ScriptableRenderPipeline/LightweightPipeline/LWRP/Data/LightweightPipelineAsset.cs
  2. 12
      ScriptableRenderPipeline/LightweightPipeline/LWRP/Editor/LightweightAssetEditor.cs
  3. 1
      ScriptableRenderPipeline/LightweightPipeline/LWRP/LightweightPipeline.cs
  4. 12
      ScriptableRenderPipeline/LightweightPipeline/LWRP/Shaders/LightweightScreenSpaceShadows.shader

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_UsesScreenSpaceShadows = 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 UsesScreenSpaceShadows
{
get { return m_UsesScreenSpaceShadows; }
}
public bool SupportsHDR

12
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 usesScreenSpaceShadows = 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.");

}
AnimBool m_ShowSoftParticles = new AnimBool();
AnimBool m_ShowScreenSpaceShadows = new AnimBool();
private int kMaxSupportedPixelLights = 8;
private float kMinRenderScale = 0.1f;

private SerializedProperty m_SupportsVertexLightProp;
private SerializedProperty m_RequireDepthTextureProp;
private SerializedProperty m_UsesScreenSpaceShadowsProp;
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_UsesScreenSpaceShadowsProp = serializedObject.FindProperty("m_UsesScreenSpaceShadows");
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_UsesScreenSpaceShadowsProp.boolValue;
m_ShowScreenSpaceShadows.valueChanged.RemoveListener(Repaint);
m_ShowScreenSpaceShadows.target = m_RequireDepthTextureProp.boolValue;
}
void DrawAnimatedProperty(SerializedProperty prop, GUIContent content, AnimBool animation)

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

1
ScriptableRenderPipeline/LightweightPipeline/LWRP/LightweightPipeline.cs


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

12
ScriptableRenderPipeline/LightweightPipeline/LWRP/Shaders/LightweightScreenSpaceShadows.shader


HLSLINCLUDE
//Keeping the compiler quiet about Shadows.hlsl.
//Keep compiler quiet about Shadows.hlsl.
#include "CoreRP/ShaderLibrary/Common.hlsl"
#include "CoreRP/ShaderLibrary/EntityLighting.hlsl"
#include "CoreRP/ShaderLibrary/ImageBasedLighting.hlsl"

float3 ray : TEXCOORD1;
};
//NOTE: Core library reconstructs via inv projection.
float3 ComputeViewSpacePositionGeometric(Interpolators i)
{
float depth = SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, sampler_CameraDepthTexture, i.uv);

half Fragment(Interpolators i) : SV_Target
{
//Reconstruct the world position.
//TODO: More/less optimal to do unprojection method?
//TODO: Profile against unprojection method in core library.
//Calculate the shadow coordinates.
half cascade = ComputeCascadeIndex(wpos);
float4 coords = ComputeShadowCoord(wpos, cascade);
//Fetch shadow coordinates.
float4 coords = ComputeShadowCoord(wpos);
return SampleShadowmap(coords);
}

ZTest Always ZWrite Off
HLSLPROGRAM
// Lightweight Pipeline keywords
// We have no good approach exposed to skip shader variants, e.g, ideally we would like to skip _CASCADE for all puctual lights
// Lightweight combines light classification and shadows keywords to reduce shader variants.
// Lightweight shader library declares defines based on these keywords to avoid having to check them in the shaders

正在加载...
取消
保存