浏览代码

Added RenderScale support.

/RenderPassXR_Sandbox
Felipe Lira 7 年前
当前提交
47b306b8
共有 3 个文件被更改,包括 20 次插入10 次删除
  1. 14
      ScriptableRenderPipeline/LightweightPipeline/Editor/LightweightAssetInspector.cs
  2. 7
      ScriptableRenderPipeline/LightweightPipeline/LightweightPipeline.cs
  3. 9
      ScriptableRenderPipeline/LightweightPipeline/LightweightPipelineAsset.cs

14
ScriptableRenderPipeline/LightweightPipeline/Editor/LightweightAssetInspector.cs


public static GUIContent defaults = new GUIContent("Defaults");
public static GUIContent linearRenderingLabel = new GUIContent("Force Linear Colorspace", "When enabled Lightweight shader will perform gamma to linear conversion in the shader when linear rendering is not supported or disabled");
public static GUIContent renderScaleLabel = new GUIContent("Render Scale", "Allows game to render at a resolution different than native resolution. UI is always rendered at native resolution.");
public static GUIContent maxPixelLights = new GUIContent("Per-Object Pixel Lights",
"Max amount of dynamic per-object pixel lights.");

public static GUIContent enableLightmap = new GUIContent("Enable Lightmap",
"Enabled/Disable support for non-directional lightmaps.");
public static GUIContent enableAmbientProbe = new GUIContent("Enable Light Probes",
"Enables/Disable light probe support.");
public static GUIContent shadowType = new GUIContent("Shadow Type",
"Single directional shadow supported. SOFT_SHADOWS applies shadow filtering.");

}
private SerializedProperty m_LinearRenderingProperty;
private SerializedProperty m_RenderScale;
private SerializedProperty m_MaxPixelLights;
private SerializedProperty m_SupportsVertexLightProp;
private SerializedProperty m_ShadowTypeProp;

void OnEnable()
{
m_LinearRenderingProperty = serializedObject.FindProperty("m_LinearRendering");
m_RenderScale = serializedObject.FindProperty("m_RenderScale");
m_MaxPixelLights = serializedObject.FindProperty("m_MaxPixelLights");
m_SupportsVertexLightProp = serializedObject.FindProperty("m_SupportsVertexLight");
m_ShadowTypeProp = serializedObject.FindProperty("m_ShadowType");

EditorGUILayout.LabelField(Styles.renderingLabel, EditorStyles.boldLabel);
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(m_LinearRenderingProperty, Styles.linearRenderingLabel);
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField(Styles.renderScaleLabel);
m_RenderScale.floatValue = EditorGUILayout.Slider(m_RenderScale.floatValue, 0.1f, 1.0f);
EditorGUILayout.EndHorizontal();
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField(Styles.maxPixelLights);
m_MaxPixelLights.intValue = EditorGUILayout.IntSlider(m_MaxPixelLights.intValue, 0, 4);

7
ScriptableRenderPipeline/LightweightPipeline/LightweightPipeline.cs


else
renderingConfig |= RenderingConfiguration.DefaultViewport;
intermediateTexture |= m_CurrCamera.targetTexture != null;
intermediateTexture |= (m_CurrCamera.targetTexture != null || m_Asset.RenderScale < 1.0f);
if (intermediateTexture && !LightweightUtils.HasFlag(renderingConfig, RenderingConfiguration.IntermediateTextureArray))
renderingConfig |= RenderingConfiguration.IntermediateTexture;

{
RenderTargetIdentifier colorRT = BuiltinRenderTextureType.CameraTarget;
RenderTargetIdentifier depthRT = BuiltinRenderTextureType.None;
int rtWidth = m_CurrCamera.pixelWidth;
int rtHeight = m_CurrCamera.pixelHeight;
// When postprocess is enabled, msaa is forced to be disabled due to lack of depth resolve.
int msaaSamples = (LightweightUtils.HasFlag(renderingConfig, RenderingConfiguration.Msaa)) ? m_Asset.MSAASampleCount : 1;

{
int rtWidth = (int)((float)m_CurrCamera.pixelWidth * m_Asset.RenderScale);
int rtHeight = (int)((float)m_CurrCamera.pixelHeight * m_Asset.RenderScale);
if (m_CurrCamera.targetTexture == null)
{
RenderTextureDescriptor rtDesc = new RenderTextureDescriptor();

9
ScriptableRenderPipeline/LightweightPipeline/LightweightPipelineAsset.cs


[SerializeField] private int m_MaxPixelLights = 1;
[SerializeField] private bool m_SupportsVertexLight = true;
[SerializeField] private MSAAQuality m_MSAA = MSAAQuality.Disabled;
[SerializeField] private float m_RenderScale = 1.0f;
[SerializeField] private ShadowType m_ShadowType = ShadowType.HARD_SHADOWS;
[SerializeField] private ShadowResolution m_ShadowAtlasResolution = ShadowResolution._1024;
[SerializeField] private float m_ShadowNearPlaneOffset = 2.0f;

[SerializeField] private Vector3 m_Cascade4Split = new Vector3(0.067f, 0.2f, 0.467f);
[SerializeField] private bool m_LinearRendering = true;
[SerializeField] private Texture2D m_AttenuationTexture;
[SerializeField] private Material m_DefaultDiffuseMaterial;
[SerializeField] private Material m_DefaultParticleMaterial;
[SerializeField] private Material m_DefaultLineMaterial;

{
get { return (int)m_MSAA; }
set { m_MSAA = (MSAAQuality)value; }
}
public float RenderScale
{
get { return m_RenderScale; }
set { m_RenderScale = value; }
}
public ShadowType CurrShadowType

正在加载...
取消
保存