浏览代码

Added the possibility to display transparent objects for Material Debug

/main
Julien Ignace 8 年前
当前提交
d0e884be
共有 4 个文件被更改,包括 108 次插入89 次删除
  1. 15
      Assets/ScriptableRenderLoop/HDRenderLoop/HDRenderLoop.cs
  2. 2
      Assets/ScriptableRenderLoop/HDRenderLoop/HDRenderLoopInspector.cs
  3. 175
      Assets/TestScenes/HDTest/EnlightenTest.unity
  4. 5
      Assets/TestScenes/HDTest/Material/HDRenderLoopMaterials/Blue_Alpha.mat

15
Assets/ScriptableRenderLoop/HDRenderLoop/HDRenderLoop.cs


public class DebugParameters
{
// Material Debugging
private bool m_DisplayMaterialDebugForTransparent = false;
public MaterialDebugMode materialDebugMode
{

{
get { return m_GBufferDebugMode; }
set { m_GBufferDebugMode = value; }
}
public bool displayMaterialDebugForTransparent
{
get { return m_DisplayMaterialDebugForTransparent; }
set { m_DisplayMaterialDebugForTransparent = value; }
}
}

settings.sorting.sortOptions = SortOptions.SortByMaterialThenMesh;
settings.inputCullingOptions.SetQueuesOpaque();
renderLoop.DrawRenderers(ref settings);
if(debugParameters.displayMaterialDebugForTransparent)
{
settings.sorting.sortOptions = SortOptions.BackToFront;
settings.inputCullingOptions.SetQueuesTransparent();
renderLoop.DrawRenderers(ref settings);
}
cmd = new CommandBuffer();
cmd.name = "FinalPass";

2
Assets/ScriptableRenderLoop/HDRenderLoop/HDRenderLoopInspector.cs


{
public readonly GUIContent debugParameters = new GUIContent("Debug Parameters");
public readonly GUIContent materialDebugMode = new GUIContent("Material Debug Mode", "Display various properties of Materials.");
public readonly GUIContent transparentMaterialDebugMode = new GUIContent("Transparent Material Debug", "Display material debug for transparent objects.");
public readonly GUIContent gBufferDebugMode = new GUIContent("GBuffer Debug Mode", "Display various properties of contained in the GBuffer.");
public readonly GUIContent[] materialDebugStrings = { new GUIContent("None"),

EditorGUI.BeginChangeCheck();
debugParameters.gBufferDebugMode = (HDRenderLoop.GBufferDebugMode)EditorGUILayout.IntPopup(styles.gBufferDebugMode, (int)debugParameters.gBufferDebugMode, styles.gBufferDebugStrings, styles.gBufferDebugValues);
debugParameters.materialDebugMode = (HDRenderLoop.MaterialDebugMode)EditorGUILayout.IntPopup(styles.materialDebugMode, (int)debugParameters.materialDebugMode, styles.materialDebugStrings, styles.materialDebugValues);
debugParameters.displayMaterialDebugForTransparent = EditorGUILayout.Toggle(styles.transparentMaterialDebugMode, debugParameters.displayMaterialDebugForTransparent);
if(EditorGUI.EndChangeCheck())
{
EditorUtility.SetDirty(renderLoop); // Repaint

175
Assets/TestScenes/HDTest/EnlightenTest.unity


m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0.18230104, g: 0.22800739, b: 0.3073312, a: 1}
m_IndirectSpecularColor: {r: 0.18379468, g: 0.22912335, b: 0.3042184, a: 1}
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0

m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 124873432}
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
--- !u!1 &399229766
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 399229767}
- component: {fileID: 399229770}
- component: {fileID: 399229769}
- component: {fileID: 399229768}
m_Layer: 0
m_Name: Plane
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &399229767
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 399229766}
m_LocalRotation: {x: 0, y: 0, z: -0.7071068, w: 0.7071068}
m_LocalPosition: {x: 11.47, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1027688891}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: -90}
--- !u!23 &399229768
MeshRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 399229766}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_Materials:
- {fileID: 2100000, guid: 6816da50441b49245843695729d8968c, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 1
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingOrder: 0
--- !u!64 &399229769
MeshCollider:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 399229766}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Convex: 0
m_InflateMesh: 0
m_SkinWidth: 0.01
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
--- !u!33 &399229770
MeshFilter:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 399229766}
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
--- !u!1 &1027688890
GameObject:
m_ObjectHideFlags: 0

- {fileID: 1893534340}
- {fileID: 1330031309}
- {fileID: 124873433}
- {fileID: 1185747105}
- {fileID: 399229767}
m_Father: {fileID: 0}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}

m_Father: {fileID: 1271727142}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1185747104
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 1185747105}
- component: {fileID: 1185747108}
- component: {fileID: 1185747107}
- component: {fileID: 1185747106}
m_Layer: 0
m_Name: TransparentPlane
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1185747105
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1185747104}
m_LocalRotation: {x: 0, y: 0, z: 0.7071068, w: 0.7071068}
m_LocalPosition: {x: 11.384, y: 0, z: -5.31}
m_LocalScale: {x: 0.6293558, y: 0.6293558, z: 2.0375917}
m_Children: []
m_Father: {fileID: 1027688891}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 90}
--- !u!23 &1185747106
MeshRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1185747104}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_Materials:
- {fileID: 2100000, guid: 6816da50441b49245843695729d8968c, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 1
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingOrder: 0
--- !u!64 &1185747107
MeshCollider:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1185747104}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Convex: 0
m_InflateMesh: 0
m_SkinWidth: 0.01
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
--- !u!33 &1185747108
MeshFilter:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1185747104}
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
--- !u!1 &1192842089
GameObject:
m_ObjectHideFlags: 0

m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1457550750}
m_LocalRotation: {x: -0.24943511, y: -0.32029372, z: 0.39630613, w: -0.82348984}
m_LocalRotation: {x: 0.045570496, y: -0.4738639, z: 0.48278427, w: 0.73504806}
m_LocalEulerAnglesHint: {x: 41.658, y: 26.196001, z: -401.282}
m_LocalEulerAnglesHint: {x: 31.637001, y: 309.955, z: -308.473}
--- !u!1 &1879932837
GameObject:
m_ObjectHideFlags: 0

m_Name:
m_EditorClassIdentifier:
m_RenderLoop: {fileID: 11400000, guid: 2400b74f5ce370c4481e5dc417d03703, type: 2}
m_AssetVersion: 0
--- !u!1 &1893534339
GameObject:
m_ObjectHideFlags: 0

5
Assets/TestScenes/HDTest/Material/HDRenderLoopMaterials/Blue_Alpha.mat


m_PrefabInternal: {fileID: 0}
m_Name: Blue_Alpha
m_Shader: {fileID: 4800000, guid: e1a84346ee54f9f4993c2f05c59805a0, type: 3}
m_ShaderKeywords: _ALPHACUTOFFENABLE_OFF _DOUBLESIDED_LIGHTING_FLIP _EMISSION _NORMALMAP_TANGENT_SPACE
m_ShaderKeywords: _ALPHACUTOFFENABLE_OFF _DOUBLESIDED_LIGHTING_MIRROR _EMISSION
_NORMALMAP_TANGENT_SPACE
m_LightmapFlags: 1
m_CustomRenderQueue: 3000
stringTagMap:

second: 1
- first:
name: _DoubleSidedMode
second: 2
second: 3
- first:
name: _DstBlend
second: 10

正在加载...
取消
保存