浏览代码

Added support for UI rendering in LightweightPipeline.

/RenderPassXR_Sandbox
Felipe Lira 8 年前
当前提交
7b4dc0f8
共有 6 个文件被更改,包括 110 次插入1 次删除
  1. 5
      Assets/ScriptableRenderPipeline/LightweightPipeline/Editor/LightweightAssetInspector.cs
  2. 6
      Assets/ScriptableRenderPipeline/LightweightPipeline/LightweightPipeline.cs
  3. 1
      Assets/ScriptableRenderPipeline/LightweightPipeline/LightweightPipelineAsset.asset
  4. 3
      Assets/ScriptableRenderPipeline/LightweightPipeline/LightweightPipelineAsset.cs
  5. 86
      Assets/ScriptableRenderPipeline/LightweightPipeline/Materials/Lightweight-UIDefault.mat
  6. 10
      Assets/ScriptableRenderPipeline/LightweightPipeline/Materials/Lightweight-UIDefault.mat.meta

5
Assets/ScriptableRenderPipeline/LightweightPipeline/Editor/LightweightAssetInspector.cs


public static GUIContent defaultSpriteMaterial = new GUIContent("Default Sprite Material",
"Material to use when creating Sprites");
public static GUIContent defaultUIMaterial = new GUIContent("Default UI Material", "Material to use when creating UI Text");
public static GUIContent defaultShader = new GUIContent("Default Shader",
"Shader to use when creating materials");

private SerializedProperty m_ShadowCascade4SplitProp;
private SerializedProperty m_DefaultDiffuseMaterial;
private SerializedProperty m_DefaultSpriteMaterial;
private SerializedProperty m_DefaultUIMaterial;
private SerializedProperty m_DefaultShader;
private SerializedProperty m_MSAA;

m_ShadowCascade4SplitProp = serializedObject.FindProperty("m_Cascade4Split");
m_DefaultDiffuseMaterial = serializedObject.FindProperty("m_DefaultDiffuseMaterial");
m_DefaultSpriteMaterial = serializedObject.FindProperty("m_DefaultSpriteMaterial");
m_DefaultUIMaterial = serializedObject.FindProperty("m_DefaultUIMaterial");
m_DefaultShader = serializedObject.FindProperty("m_DefaultShader");
m_MSAA = serializedObject.FindProperty("m_MSAA");
}

EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(m_DefaultDiffuseMaterial, Styles.defaultDiffuseMaterial);
EditorGUILayout.PropertyField(m_DefaultSpriteMaterial, Styles.defaultSpriteMaterial);
EditorGUILayout.PropertyField(m_DefaultUIMaterial, Styles.defaultUIMaterial);
EditorGUILayout.PropertyField(m_DefaultShader, Styles.defaultShader);
EditorGUI.indentLevel--;

6
Assets/ScriptableRenderPipeline/LightweightPipeline/LightweightPipeline.cs


private ShadowSliceData[] m_ShadowSlices = new ShadowSliceData[kMaxCascades];
private static readonly ShaderPassName m_LitPassName = new ShaderPassName("LightweightForward");
private static readonly ShaderPassName m_UnlitPassName = new ShaderPassName("SRPDefaultUnlit");
public LightweightPipeline(LightweightPipelineAsset asset)
{

litSettings.inputFilter.SetQueuesOpaque();
litSettings.rendererConfiguration = configuration;
var unlitSettings = new DrawRendererSettings(m_CullResults, camera, m_UnlitPassName);
unlitSettings.sorting.flags = SortFlags.CommonTransparent;
unlitSettings.inputFilter.SetQueuesTransparent();
context.DrawRenderers(ref litSettings);
// Release temporary RT

litSettings.sorting.flags = SortFlags.CommonTransparent;
litSettings.inputFilter.SetQueuesTransparent();
context.DrawRenderers(ref litSettings);
context.DrawRenderers(ref unlitSettings);
EndForwardRendering(camera, ref context);
}

1
Assets/ScriptableRenderPipeline/LightweightPipeline/LightweightPipelineAsset.asset


type: 2}
m_DefaultSpriteMaterial: {fileID: 2100000, guid: e3ef893926d86c448a80512fe05b8a37,
type: 2}
m_DefaultUIMaterial: {fileID: 2100000, guid: 786cc499ea3906946b10ab7d24c8d0e7, type: 2}
m_DefaultShader: {fileID: 4800000, guid: 8d2bb70cbf9db8d4da26e15b26e74248, type: 3}

3
Assets/ScriptableRenderPipeline/LightweightPipeline/LightweightPipelineAsset.cs


[SerializeField] private Material m_DefaultDiffuseMaterial;
[SerializeField] private Material m_DefaultSpriteMaterial;
[SerializeField] private Material m_DefaultUIMaterial;
[SerializeField] private Shader m_DefaultShader;
public int MaxSupportedPixelLights

public override Material GetDefaultUIMaterial()
{
return m_DefaultDiffuseMaterial;
return m_DefaultUIMaterial;
}
public override Material GetDefaultUIOverdrawMaterial()

86
Assets/ScriptableRenderPipeline/LightweightPipeline/Materials/Lightweight-UIDefault.mat


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: Lightweight-UIDefault
m_Shader: {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _Cube:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _ColorMask: 15
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossinessSource: 0
- _GlossyReflections: 1
- _Mode: 0
- _Parallax: 0.02
- _ReflectionSource: 0
- _Shininess: 1
- _SmoothnessTextureChannel: 0
- _SpecSource: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _Stencil: 0
- _StencilComp: 8
- _StencilOp: 0
- _StencilReadMask: 255
- _StencilWriteMask: 255
- _UVSec: 0
- _UseUIAlphaClip: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecColor: {r: 1, g: 1, b: 1, a: 1}

10
Assets/ScriptableRenderPipeline/LightweightPipeline/Materials/Lightweight-UIDefault.mat.meta


fileFormatVersion: 2
guid: 786cc499ea3906946b10ab7d24c8d0e7
timeCreated: 1499329524
licenseType: Pro
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存