浏览代码

Merge pull request #3 from Unity-Technologies/DebugShader

Debugshader
/main
GitHub 8 年前
当前提交
61e8c0e0
共有 19 个文件被更改,包括 1090 次插入39 次删除
  1. 181
      Assets/ScriptableRenderLoop/HDRenderLoop/HDRenderLoop.cs
  2. 102
      Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/DisneyGGX.shader
  3. 3
      Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Material/DisneyGGX.hlsl
  4. 11
      Assets/ScriptableRenderLoop/ShaderLibrary/Common.hlsl
  5. 103
      Assets/TestScenes/HDTest/EnlightenTest.unity
  6. 26
      Assets/TestScenes/HDTest/Material/HDRenderLoopMaterials/Gray.mat
  7. 26
      Assets/TestScenes/HDTest/Material/HDRenderLoopMaterials/Green.mat
  8. 26
      Assets/TestScenes/HDTest/Material/HDRenderLoopMaterials/Red.mat
  9. 95
      Assets/TestScenes/HDTest/Material/HDRenderLoopMaterials/Terrain.mat
  10. 104
      Assets/ScriptableRenderLoop/HDRenderLoop/HDRenderLoopInspector.cs
  11. 12
      Assets/ScriptableRenderLoop/HDRenderLoop/HDRenderLoopInspector.cs.meta
  12. 9
      Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Debug.meta
  13. 264
      Assets/TestScenes/HDTest/Material/HDRenderLoopMaterials/Blue_Alpha.mat
  14. 8
      Assets/TestScenes/HDTest/Material/HDRenderLoopMaterials/Blue_Alpha.mat.meta
  15. 25
      Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Debug/DebugCommon.hlsl
  16. 9
      Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Debug/DebugCommon.hlsl.meta
  17. 9
      Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Debug/GBufferDebug.shader.meta
  18. 116
      Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Debug/GBufferDebug.shader

181
Assets/ScriptableRenderLoop/HDRenderLoop/HDRenderLoop.cs


using UnityEngine;
using UnityEngine;
using System.Collections;
using UnityEngine.Rendering;
using System.Collections.Generic;

// This HDRenderLoop assume linear lighting. Don't work with gamma.
public class HDRenderLoop : ScriptableRenderLoop
{
private static string m_HDRenderLoopPath = "Assets/ScriptableRenderLoop/HDRenderLoop/HDRenderLoop.asset";
// Debugging
public enum MaterialDebugMode
{
None = 0,
DiffuseColor = 1,
Normal = 2,
Depth = 3,
AmbientOcclusion = 4,
SpecularColor = 5,
SpecularOcclustion = 6,
Smoothness = 7,
MaterialId = 8,
UV0 = 9,
Tangent = 10,
Bitangent = 11
}
public enum GBufferDebugMode
{
None = 0,
DiffuseColor = 1,
Normal = 2,
Depth = 3,
BakedDiffuse = 4,
SpecularColor = 5,
SpecularOcclustion = 6,
Smoothness = 7,
MaterialId = 8,
}
public class DebugParameters
{
// Material Debugging
public MaterialDebugMode materialDebugMode = MaterialDebugMode.None;
public GBufferDebugMode gBufferDebugMode = GBufferDebugMode.None;
public bool displayMaterialDebugForTransparent = false;
// Rendering debugging
public bool displayOpaqueObjects = true;
public bool displayTransparentObjects = true;
}
private DebugParameters m_DebugParameters = new DebugParameters();
public DebugParameters debugParameters
{
get { return m_DebugParameters; }
}
[MenuItem("Renderloop/CreateHDRenderLoop")]
[MenuItem("Renderloop/CreateHDRenderLoop")]
UnityEditor.AssetDatabase.CreateAsset(instance, "Assets/ScriptableRenderLoop/HDRenderLoop/HDRenderLoop.asset");
UnityEditor.AssetDatabase.CreateAsset(instance, m_HDRenderLoopPath);
}
#endif

Material m_DeferredMaterial;
Material m_FinalPassMaterial;
// Debug
Material m_GBufferDebugMaterial;
GBufferManager gbufferManager = new GBufferManager();
static private int s_CameraColorBuffer;

s_punctualLightList.Release();
}
Material CreateEngineMaterial(string shaderPath)
{
Material mat = new Material(Shader.Find(shaderPath) as Shader);
mat.hideFlags = HideFlags.HideAndDontSave;
return mat;
}
public override void Rebuild()
{
ClearComputeBuffers();

s_punctualLightList = new ComputeBuffer(MaxLights, System.Runtime.InteropServices.Marshal.SizeOf(typeof(PunctualLightData)));
Shader deferredMaterial = Shader.Find("Hidden/Unity/LightingDeferred") as Shader;
m_DeferredMaterial = new Material(deferredMaterial);
m_DeferredMaterial.hideFlags = HideFlags.HideAndDontSave;
m_DeferredMaterial = CreateEngineMaterial("Hidden/Unity/LightingDeferred");
m_FinalPassMaterial = CreateEngineMaterial("Hidden/Unity/FinalPass");
Shader finalPassShader = Shader.Find("Hidden/Unity/FinalPass") as Shader;
m_FinalPassMaterial = new Material(finalPassShader);
m_FinalPassMaterial.hideFlags = HideFlags.HideAndDontSave;
// Debug
m_GBufferDebugMaterial = CreateEngineMaterial("Hidden/Unity/GBufferDebug");
// m_ShadowPass = new ShadowRenderPass (m_ShadowSettings);
}

renderLoop.DrawRenderers(ref settings);
}
void RenderMaterialDebug(CullResults cull, Camera camera, RenderLoop renderLoop)
{
// setup GBuffer for rendering
var cmd = new CommandBuffer();
cmd.name = "Debug Pass";
cmd.GetTemporaryRT(s_CameraColorBuffer, -1, -1, 0, FilterMode.Point, RenderTextureFormat.ARGBHalf, RenderTextureReadWrite.Linear);
cmd.GetTemporaryRT(s_CameraDepthBuffer, -1, -1, 24, FilterMode.Point, RenderTextureFormat.Depth);
cmd.SetRenderTarget(new RenderTargetIdentifier(s_CameraColorBuffer), new RenderTargetIdentifier(s_CameraDepthBuffer));
cmd.ClearRenderTarget(true, true, new Color(0, 0, 0, 0));
renderLoop.ExecuteCommandBuffer(cmd);
cmd.Dispose();
Shader.SetGlobalInt("g_MaterialDebugMode", (int)debugParameters.materialDebugMode);
DrawRendererSettings settings = new DrawRendererSettings(cull, camera, new ShaderPassName("Debug"));
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";
cmd.Blit(s_CameraColorBuffer, BuiltinRenderTextureType.CameraTarget, m_FinalPassMaterial, 0);
renderLoop.ExecuteCommandBuffer(cmd);
cmd.Dispose();
}
void RenderGBufferDebug(Camera camera, RenderLoop renderLoop)
{
Matrix4x4 invViewProj = GetViewProjectionMatrix(camera).inverse;
m_GBufferDebugMaterial.SetMatrix("_InvViewProjMatrix", invViewProj);
Vector4 screenSize = ComputeScreenSize(camera);
m_GBufferDebugMaterial.SetVector("_ScreenSize", screenSize);
m_GBufferDebugMaterial.SetFloat("_DebugMode", (float)debugParameters.gBufferDebugMode);
// gbufferManager.BindBuffers(m_DeferredMaterial);
// TODO: Bind depth textures
var cmd = new CommandBuffer();
cmd.name = "GBuffer Debug";
cmd.Blit(null, new RenderTargetIdentifier(s_CameraColorBuffer), m_GBufferDebugMaterial, 0);
renderLoop.ExecuteCommandBuffer(cmd);
cmd.Dispose();
}
Matrix4x4 GetViewProjectionMatrix(Camera camera)
{
// The actual projection matrix used in shaders is actually massaged a bit to work across all platforms

return gpuVP;
}
Vector4 ComputeScreenSize(Camera camera)
{
Vector4 screenSize = new Vector4();
screenSize.x = camera.pixelWidth;
screenSize.y = camera.pixelHeight;
screenSize.z = 1.0f / camera.pixelWidth;
screenSize.w = 1.0f / camera.pixelHeight;
return screenSize;
}
Vector4 screenSize = new Vector4();
screenSize.x = camera.pixelWidth;
screenSize.y = camera.pixelHeight;
screenSize.z = 1.0f / camera.pixelWidth;
screenSize.w = 1.0f / camera.pixelHeight;
Vector4 screenSize = ComputeScreenSize(camera);
m_DeferredMaterial.SetVector("_ScreenSize", screenSize);
// gbufferManager.BindBuffers(m_DeferredMaterial);

renderLoop.ExecuteCommandBuffer(cmd);
cmd.Dispose();
DrawRendererSettings settings = new DrawRendererSettings(cullResults, camera, new ShaderPassName("Forward"));
settings.rendererConfiguration = RendererConfiguration.ConfigureOneLightProbePerRenderer | RendererConfiguration.ConfigureReflectionProbesProbePerRenderer;
settings.sorting.sortOptions = SortOptions.SortByMaterialThenMesh;
settings.inputCullingOptions.SetQueuesTransparent();
DrawRendererSettings settings = new DrawRendererSettings(cullResults, camera, new ShaderPassName("Forward"));
settings.rendererConfiguration = RendererConfiguration.ConfigureOneLightProbePerRenderer | RendererConfiguration.ConfigureReflectionProbesProbePerRenderer;
settings.sorting.sortOptions = SortOptions.SortByMaterialThenMesh;
settings.inputCullingOptions.SetQueuesTransparent();
renderLoop.DrawRenderers(ref settings);
renderLoop.DrawRenderers(ref settings);
}
void FinalPass(RenderLoop renderLoop)

//UpdateLightConstants(cullResults.culledLights /*, ref shadows */);
UpdatePunctualLights(cullResults.culledLights);
if (debugParameters.materialDebugMode == MaterialDebugMode.None)
{
UpdatePunctualLights(cullResults.culledLights);
InitAndClearBuffer(camera, renderLoop);
InitAndClearBuffer(camera, renderLoop);
RenderGBuffer(cullResults, camera, renderLoop);
if(debugParameters.displayOpaqueObjects)
RenderGBuffer(cullResults, camera, renderLoop);
RenderDeferredLighting(camera, renderLoop);
RenderDeferredLighting(camera, renderLoop);
RenderForward(cullResults, camera, renderLoop);
if(debugParameters.displayTransparentObjects)
RenderForward(cullResults, camera, renderLoop);
FinalPass(renderLoop);
if (debugParameters.gBufferDebugMode != GBufferDebugMode.None)
{
RenderGBufferDebug(camera, renderLoop);
}
FinalPass(renderLoop);
}
else
{
RenderMaterialDebug(cullResults, camera, renderLoop);
}
renderLoop.Submit ();
}

}
#endif
}
}
}

102
Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/DisneyGGX.shader


ENDHLSL
}
// ------------------------------------------------------------------
// Debug pass
Pass
{
Name "Debug"
Tags { "LightMode" = "Debug" }
Cull[_CullMode]
HLSLPROGRAM
#pragma target 5.0
#pragma only_renderers d3d11 // TEMP: unitl we go futher in dev
#pragma vertex VertDefault
#pragma fragment FragDebug
int g_MaterialDebugMode;
#include "Assets/ScriptableRenderLoop/ShaderLibrary/Color.hlsl"
#include "Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Debug/DebugCommon.hlsl"
#include "TemplateDisneyGGX.hlsl"
#if SHADER_STAGE_FRAGMENT
float4 FragDebug( PackedVaryings packedInput ) : SV_Target
{
Varyings input = UnpackVaryings(packedInput);
SurfaceData surfaceData;
BuiltinData builtinData;
GetSurfaceAndBuiltinData(input, surfaceData, builtinData);
float3 result = float3(1.0, 1.0, 0.0);
bool outputIsLinear = false;
if(g_MaterialDebugMode == MaterialDebugDiffuseColor)
{
result = surfaceData.diffuseColor;
}
else if (g_MaterialDebugMode == MaterialDebugNormal)
{
result = surfaceData.normalWS * 0.5 + 0.5;
outputIsLinear = true;
}
else if (g_MaterialDebugMode == MaterialDebugDepth)
{
float linearDepth = frac(LinearEyeDepth(input.positionHS.z, _ZBufferParams) * 0.1);
result = linearDepth.xxx;
outputIsLinear = true;
}
else if (g_MaterialDebugMode == MaterialDebugAO)
{
result = surfaceData.ambientOcclusion.xxx;
outputIsLinear = true;
}
else if (g_MaterialDebugMode == MaterialDebugSpecularColor)
{
result = surfaceData.specularColor;
}
else if (g_MaterialDebugMode == MaterialDebugSpecularOcclusion)
{
result = surfaceData.specularOcclusion.xxx;
outputIsLinear = true;
}
else if (g_MaterialDebugMode == MaterialDebugSmoothness)
{
result = surfaceData.perceptualSmoothness.xxx;
outputIsLinear = true;
}
else if (g_MaterialDebugMode == MaterialDebugMaterialId)
{
result = surfaceData.materialId.xxx;
outputIsLinear = true;
}
else if (g_MaterialDebugMode == MaterialDebugUV0)
{
result = float3(input.texCoord0, 0.0);
outputIsLinear = true;
}
else if (g_MaterialDebugMode == MaterialDebugTangent)
{
result = input.tangentToWorld[0].xyz * 0.5 + 0.5;
outputIsLinear = true;
}
else if (g_MaterialDebugMode == MaterialDebugBitangent)
{
result = input.tangentToWorld[1].xyz * 0.5 + 0.5;
outputIsLinear = true;
}
// For now, the final blit in the backbuffer performs an sRGB write
// So in the meantime we apply the inverse transform to linear data to compensate.
if(outputIsLinear)
result = SRGBToLinear(max(0, result));
return float4(result, 0.0);
}
#endif
ENDHLSL
}
}
CustomEditor "DisneyGGXGUI"

3
Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Material/DisneyGGX.hlsl


// SurfaceData and BSDFData
//-----------------------------------------------------------------------------
// Main structure that store the user data (i.e user input of master node in material graph)
struct SurfaceData
{

}
}
#endif // UNITY_MATERIAL_DISNEYGGX_INCLUDED
#endif // UNITY_MATERIAL_DISNEYGGX_INCLUDED

11
Assets/ScriptableRenderLoop/ShaderLibrary/Common.hlsl


return hpositionWS.xyz / hpositionWS.w;
}
// Z buffer to linear 0..1 depth
float Linear01Depth(float depth, float4 zBufferParam)
{
return 1.0 / (zBufferParam.x * depth + zBufferParam.y);
}
// Z buffer to linear depth
float LinearEyeDepth(float depth, float4 zBufferParam)
{
return 1.0 / (zBufferParam.z * depth + zBufferParam.w);
}
#endif // UNITY_COMMON_INCLUDED

103
Assets/TestScenes/HDTest/EnlightenTest.unity


m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0.1837731, g: 0.22831294, b: 0.29965004, 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.99, z: -2.72}
m_LocalScale: {x: 0.7180612, y: 1, z: 2.3734639}
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: 399229767}
m_Father: {fileID: 0}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}

m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1197900219}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0.093494415, y: -2.4372234, z: -4.1745696}
m_LocalPosition: {x: 0, y: -2.4372234, z: -4.1745696}
m_LocalScale: {x: 4, y: 4, z: 4}
m_Children: []
m_Father: {fileID: 1027688891}

m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1457550750}
m_LocalRotation: {x: 0.92876834, y: -0.23633997, z: -0.1055043, w: 0.26533297}
m_LocalRotation: {x: 0.045570496, y: -0.4738639, z: 0.48278427, w: 0.73504806}
m_LocalEulerAnglesHint: {x: 26.295002, y: -158.992, z: -146.487}
m_LocalEulerAnglesHint: {x: 31.637001, y: 309.955, z: -308.473}
--- !u!1 &1879932837
GameObject:
m_ObjectHideFlags: 0

m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 1
m_AllowMSAA: 1
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022

m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1879932837}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 1, z: -10}
m_LocalRotation: {x: 0.07759436, y: -0.72047704, z: 0.08170084, w: 0.6842638}
m_LocalPosition: {x: 25.43, y: 9.08, z: 40.21}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_LocalEulerAnglesHint: {x: 12.939001, y: -92.953, z: 0}
--- !u!114 &1879932843
MonoBehaviour:
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

m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1893534339}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0.093494415, y: -2.4372234, z: -4.1745696}
m_LocalPosition: {x: 0.093494415, y: 0.3, z: -4.1745696}
m_LocalScale: {x: 2, y: 2, z: 2}
m_Children: []
m_Father: {fileID: 1027688891}

26
Assets/TestScenes/HDTest/Material/HDRenderLoopMaterials/Gray.mat


m_PrefabInternal: {fileID: 0}
m_Name: Gray
m_Shader: {fileID: 4800000, guid: e1a84346ee54f9f4993c2f05c59805a0, type: 3}
m_ShaderKeywords: _EMISSION
m_ShaderKeywords: _EMISSION _NORMALMAP_TANGENT_SPACE
m_LightmapFlags: 1
m_CustomRenderQueue: -1
stringTagMap: {}

m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- first:
name: _MaskMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- first:
name: _MetallicGlossMap
second:
m_Texture: {fileID: 0}

m_Offset: {x: 0, y: 0}
m_Floats:
- first:
name: _AlphaCutoff
second: 0.5
- first:
name: _AlphaCutoffEnable
second: 0
- first:
name: _BlendMode
second: 0
- first:

name: _DoubleSidedLigthing
second: 1
- first:
name: _DoubleSidedMode
second: 0
- first:
- first:
name: _EmissiveColorMode
second: 1
- first:
name: _EmissiveIntensity
second: 0

name: _HeightBias
second: 0
- first:
name: _HeightMapMode
second: 0
- first:
name: _HeightScale
second: 1
- first:

second: 0
- first:
name: _Mode
second: 0
- first:
name: _NormalMapSpace
second: 0
- first:
name: _OcclusionStrength

26
Assets/TestScenes/HDTest/Material/HDRenderLoopMaterials/Green.mat


m_PrefabInternal: {fileID: 0}
m_Name: Green
m_Shader: {fileID: 4800000, guid: e1a84346ee54f9f4993c2f05c59805a0, type: 3}
m_ShaderKeywords: _EMISSION
m_ShaderKeywords: _EMISSION _NORMALMAP_TANGENT_SPACE
m_LightmapFlags: 1
m_CustomRenderQueue: -1
stringTagMap: {}

m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- first:
name: _MaskMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- first:
name: _MetallicGlossMap
second:
m_Texture: {fileID: 0}

m_Offset: {x: 0, y: 0}
m_Floats:
- first:
name: _AlphaCutoff
second: 0.5
- first:
name: _AlphaCutoffEnable
second: 0
- first:
name: _BlendMode
second: 0
- first:

name: _DoubleSidedLigthing
second: 1
- first:
name: _DoubleSidedMode
second: 0
- first:
- first:
name: _EmissiveColorMode
second: 1
- first:
name: _EmissiveIntensity
second: 0

name: _HeightBias
second: 0
- first:
name: _HeightMapMode
second: 0
- first:
name: _HeightScale
second: 1
- first:

second: 0
- first:
name: _Mode
second: 0
- first:
name: _NormalMapSpace
second: 0
- first:
name: _OcclusionStrength

26
Assets/TestScenes/HDTest/Material/HDRenderLoopMaterials/Red.mat


m_PrefabInternal: {fileID: 0}
m_Name: Red
m_Shader: {fileID: 4800000, guid: e1a84346ee54f9f4993c2f05c59805a0, type: 3}
m_ShaderKeywords: _EMISSION
m_ShaderKeywords: _EMISSION _NORMALMAP_TANGENT_SPACE
m_LightmapFlags: 1
m_CustomRenderQueue: -1
stringTagMap: {}

m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- first:
name: _MaskMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- first:
name: _MetallicGlossMap
second:
m_Texture: {fileID: 0}

m_Offset: {x: 0, y: 0}
m_Floats:
- first:
name: _AlphaCutoff
second: 0.5
- first:
name: _AlphaCutoffEnable
second: 0
- first:
name: _BlendMode
second: 0
- first:

name: _DoubleSidedLigthing
second: 1
- first:
name: _DoubleSidedMode
second: 0
- first:
- first:
name: _EmissiveColorMode
second: 1
- first:
name: _EmissiveIntensity
second: 0

name: _HeightBias
second: 0
- first:
name: _HeightMapMode
second: 0
- first:
name: _HeightScale
second: 1
- first:

second: 0
- first:
name: _Mode
second: 0
- first:
name: _NormalMapSpace
second: 0
- first:
name: _OcclusionStrength

95
Assets/TestScenes/HDTest/Material/HDRenderLoopMaterials/Terrain.mat


m_PrefabInternal: {fileID: 0}
m_Name: Terrain
m_Shader: {fileID: 4800000, guid: e1a84346ee54f9f4993c2f05c59805a0, type: 3}
m_ShaderKeywords: _EMISSION
m_ShaderKeywords: _EMISSION _NORMALMAP_TANGENT_SPACE
m_LightmapFlags: 1
m_CustomRenderQueue: -1
stringTagMap: {}

- first:
name: _BaseColorMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- first:
name: _BumpMap
second:

m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- first:
name: _DiffuseLightingMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- first:
name: _DiffuseMap
second:
m_Texture: {fileID: 0}

m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- first:
name: _EmissiveColorMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- first:
name: _HeightMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- first:
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- first:
name: _MaskMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}

m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- first:
name: _SpecularOcclusionMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- first:
name: _SubSurfaceRadiusMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
name: _AlphaCutoff
second: 0.5
- first:
name: _AlphaCutoffEnable
second: 0
- first:
name: _BlendMode
second: 0
- first:
name: _CullMode
second: 2
- first:
name: _Cutoff
second: 0.5
- first:

name: _DoubleSidedMode
second: 0
- first:
name: _EmissiveColorMode
second: 1
- first:
name: _EmissiveIntensity
second: 0
- first:
name: _GlossMapScale
second: 1
- first:

name: _GlossyReflections
second: 1
- first:
name: _HeightBias
second: 0
- first:
name: _HeightMapMode
second: 0
- first:
name: _HeightScale
second: 1
- first:
name: _MaterialId
second: 0
- first:
name: _Mettalic
second: 0
- first:
second: 0
- first:
name: _NormalMapSpace
second: 0
- first:
name: _OcclusionStrength

name: _SrcBlend
second: 1
- first:
name: _SubSurfaceRadius
second: 0
- first:
name: _SurfaceType
second: 0
- first:
name: _UVSec
second: 0
- first:

- first:
name: _BaseColor
second: {r: 1, g: 1, b: 1, a: 1}
- first:
name: _Color
second: {r: 0.5, g: 0.5, b: 0.5, a: 1}
- first:

name: _EmissionColor
second: {r: 0, g: 0, b: 0, a: 1}
- first:
name: _EmissiveColor
second: {r: 0, g: 0, b: 0, a: 1}
- first:
name: _SpecColor

104
Assets/ScriptableRenderLoop/HDRenderLoop/HDRenderLoopInspector.cs


using UnityEngine;
using System.Collections;
using UnityEngine.Rendering;
using System.Collections.Generic;
using System;
using UnityEditor;
//using EditorGUIUtility=UnityEditor.EditorGUIUtility;
namespace UnityEngine.ScriptableRenderLoop
{
[CustomEditor(typeof(HDRenderLoop))]
public class HDRenderLoopInspector : Editor
{
private class Styles
{
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 displayOpaqueObjects = new GUIContent("Display Opaque Objects", "Toggle opaque objects rendering on and off.");
public readonly GUIContent displayTransparentObjects = new GUIContent("Display Transparent Objects", "Toggle transparent objects rendering on and off.");
public readonly GUIContent[] materialDebugStrings = { new GUIContent("None"),
new GUIContent("Diffuse Color"),
new GUIContent("Normal"),
new GUIContent("Depth"),
new GUIContent("Ambient Occlusion"),
new GUIContent("Specular Color"),
new GUIContent("Specular Occlusion"),
new GUIContent("Smoothness"),
new GUIContent("MaterialId"),
new GUIContent("UV0"),
new GUIContent("Tangent"),
new GUIContent("Bitangent")
};
public readonly int[] materialDebugValues = { (int)HDRenderLoop.MaterialDebugMode.None,
(int)HDRenderLoop.MaterialDebugMode.DiffuseColor,
(int)HDRenderLoop.MaterialDebugMode.Normal,
(int)HDRenderLoop.MaterialDebugMode.Depth,
(int)HDRenderLoop.MaterialDebugMode.AmbientOcclusion,
(int)HDRenderLoop.MaterialDebugMode.SpecularColor,
(int)HDRenderLoop.MaterialDebugMode.SpecularOcclustion,
(int)HDRenderLoop.MaterialDebugMode.Smoothness,
(int)HDRenderLoop.MaterialDebugMode.MaterialId,
(int)HDRenderLoop.MaterialDebugMode.UV0,
(int)HDRenderLoop.MaterialDebugMode.Tangent,
(int)HDRenderLoop.MaterialDebugMode.Bitangent
};
public readonly GUIContent[] gBufferDebugStrings = { new GUIContent("None"),
new GUIContent("Diffuse Color"),
new GUIContent("Normal"),
new GUIContent("Depth"),
new GUIContent("Baked Diffuse"),
new GUIContent("Specular Color"),
new GUIContent("Specular Occlusion"),
new GUIContent("Smoothness"),
new GUIContent("MaterialId")
};
public readonly int[] gBufferDebugValues = { (int)HDRenderLoop.GBufferDebugMode.None,
(int)HDRenderLoop.GBufferDebugMode.DiffuseColor,
(int)HDRenderLoop.GBufferDebugMode.Normal,
(int)HDRenderLoop.GBufferDebugMode.Depth,
(int)HDRenderLoop.GBufferDebugMode.BakedDiffuse,
(int)HDRenderLoop.GBufferDebugMode.SpecularColor,
(int)HDRenderLoop.GBufferDebugMode.SpecularOcclustion,
(int)HDRenderLoop.GBufferDebugMode.Smoothness,
(int)HDRenderLoop.GBufferDebugMode.MaterialId
};
}
private static Styles s_Styles = null;
private static Styles styles { get { if (s_Styles == null) s_Styles = new Styles(); return s_Styles; } }
public override void OnInspectorGUI()
{
HDRenderLoop renderLoop = target as HDRenderLoop;
if(renderLoop)
{
HDRenderLoop.DebugParameters debugParameters = renderLoop.debugParameters;
EditorGUILayout.LabelField(styles.debugParameters);
EditorGUI.indentLevel++;
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);
EditorGUILayout.Space();
debugParameters.displayOpaqueObjects = EditorGUILayout.Toggle(styles.displayOpaqueObjects, debugParameters.displayOpaqueObjects);
debugParameters.displayTransparentObjects = EditorGUILayout.Toggle(styles.displayTransparentObjects, debugParameters.displayTransparentObjects);
if(EditorGUI.EndChangeCheck())
{
EditorUtility.SetDirty(renderLoop); // Repaint
}
EditorGUI.indentLevel--;
}
}
}
}

12
Assets/ScriptableRenderLoop/HDRenderLoop/HDRenderLoopInspector.cs.meta


fileFormatVersion: 2
guid: 6e8669cdde22f4948a090da4b5fb5b7c
timeCreated: 1475763911
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

9
Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Debug.meta


fileFormatVersion: 2
guid: ee4b12281385a0a4791e3128dd34eae4
folderAsset: yes
timeCreated: 1475748186
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

264
Assets/TestScenes/HDTest/Material/HDRenderLoopMaterials/Blue_Alpha.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: Blue_Alpha
m_Shader: {fileID: 4800000, guid: e1a84346ee54f9f4993c2f05c59805a0, type: 3}
m_ShaderKeywords: _ALPHACUTOFFENABLE_OFF _DOUBLESIDED_LIGHTING_MIRROR _EMISSION
_NORMALMAP_TANGENT_SPACE
m_LightmapFlags: 1
m_CustomRenderQueue: 3000
stringTagMap:
RenderType: Transparent
m_SavedProperties:
serializedVersion: 2
m_TexEnvs:
- first:
name: _AmbientOcclusionMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- first:
name: _BaseColorMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- first:
name: _BumpMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- first:
name: _DetailAlbedoMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- first:
name: _DetailMask
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- first:
name: _DetailNormalMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- first:
name: _DiffuseLightingMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- first:
name: _EmissionMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- first:
name: _EmissiveColorMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- first:
name: _HeightMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- first:
name: _MainTex
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- first:
name: _MaskMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- first:
name: _MetallicGlossMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- first:
name: _MettalicMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- first:
name: _NormalMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- first:
name: _OcclusionMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- first:
name: _ParallaxMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- first:
name: _SmoothnessMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- first:
name: _SpecularOcclusionMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- first:
name: _SubSurfaceRadiusMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- first:
name: _AlphaCutoff
second: 0.5
- first:
name: _AlphaCutoffEnable
second: 0
- first:
name: _BlendMode
second: 0
- first:
name: _BumpScale
second: 1
- first:
name: _CullMode
second: 0
- first:
name: _Cutoff
second: 0.5
- first:
name: _DetailNormalMapScale
second: 1
- first:
name: _DistortionDepthTest
second: 0
- first:
name: _DistortionOnly
second: 0
- first:
name: _DoubleSided
second: 1
- first:
name: _DoubleSidedLigthing
second: 1
- first:
name: _DoubleSidedMode
second: 3
- first:
name: _DstBlend
second: 10
- first:
name: _EmissiveColorMode
second: 1
- first:
name: _EmissiveIntensity
second: 0
- first:
name: _GlossMapScale
second: 1
- first:
name: _Glossiness
second: 0.5
- first:
name: _GlossyReflections
second: 1
- first:
name: _HeightBias
second: 0
- first:
name: _HeightMapMode
second: 0
- first:
name: _HeightScale
second: 1
- first:
name: _MaterialID
second: 0
- first:
name: _MaterialId
second: 0
- first:
name: _Metallic
second: 0
- first:
name: _Mettalic
second: 0
- first:
name: _Mode
second: 0
- first:
name: _NormalMapSpace
second: 0
- first:
name: _OcclusionStrength
second: 1
- first:
name: _Parallax
second: 0.02
- first:
name: _Smoothness
second: 0.5
- first:
name: _SmoothnessTextureChannel
second: 0
- first:
name: _SpecularHighlights
second: 1
- first:
name: _SrcBlend
second: 5
- first:
name: _SubSurfaceRadius
second: 0
- first:
name: _SurfaceType
second: 1
- first:
name: _UVSec
second: 0
- first:
name: _ZWrite
second: 0
m_Colors:
- first:
name: _BaseColor
second: {r: 0.3118512, g: 0.49926913, b: 0.75735295, a: 0.672}
- first:
name: _Color
second: {r: 0.5019608, g: 0.5019608, b: 0.5019608, a: 1}
- first:
name: _EmissionColor
second: {r: 0, g: 0, b: 0, a: 1}
- first:
name: _EmissiveColor
second: {r: 0, g: 0, b: 0, a: 1}

8
Assets/TestScenes/HDTest/Material/HDRenderLoopMaterials/Blue_Alpha.mat.meta


fileFormatVersion: 2
guid: 6816da50441b49245843695729d8968c
timeCreated: 1475573357
licenseType: Pro
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

25
Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Debug/DebugCommon.hlsl


// List of material debug modes. Keep in sync with HDRenderLoop.MaterialDebugMode
#define MaterialDebugNone 0,
#define MaterialDebugDiffuseColor 1
#define MaterialDebugNormal 2
#define MaterialDebugDepth 3
#define MaterialDebugAO 4
#define MaterialDebugSpecularColor 5
#define MaterialDebugSpecularOcclusion 6
#define MaterialDebugSmoothness 7
#define MaterialDebugMaterialId 8
#define MaterialDebugUV0 9
#define MaterialDebugTangent 10
#define MaterialDebugBitangent 11
// List of GBuffer debug modes. Keep in sync with HDRenderLoop.GBufferDebugMode
#define GBufferDebugNone 0
#define GBufferDebugDiffuseColor 1
#define GBufferDebugNormal 2
#define GBufferDebugDepth 3
#define GBufferDebugBakedDiffuse 4
#define GBufferDebugSpecularColor 5
#define GBufferDebugSpecularOcclustion 6
#define GBufferDebugSmoothness 7
#define GBufferDebugMaterialId 8

9
Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Debug/DebugCommon.hlsl.meta


fileFormatVersion: 2
guid: 3babddf8b47eecd48ac0a07efc211c0c
timeCreated: 1475754031
licenseType: Pro
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

9
Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Debug/GBufferDebug.shader.meta


fileFormatVersion: 2
guid: beffb29605949f0429be0427db7a9993
timeCreated: 1475748193
licenseType: Pro
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

116
Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Debug/GBufferDebug.shader


Shader "Hidden/Unity/GBufferDebug"
{
SubShader
{
Pass
{
ZWrite Off
Blend One Zero
HLSLPROGRAM
#pragma target 5.0
#pragma only_renderers d3d11 // TEMP: unitl we go futher in dev
#pragma vertex VertDeferred
#pragma fragment FragDeferred
// CAUTION: In case deferred lighting need to support various lighting model statically, we will require to do multicompile with different define like UNITY_MATERIAL_DISNEYGXX
#define UNITY_MATERIAL_DISNEYGGX // Need to be define before including Material.hlsl
#include "Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Lighting/Lighting.hlsl" // This include Material.hlsl
#include "Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/ShaderVariables.hlsl"
#include "Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Debug/DebugCommon.hlsl"
#include "Assets/ScriptableRenderLoop/ShaderLibrary/Color.hlsl"
DECLARE_GBUFFER_TEXTURE(_CameraGBufferTexture);
DECLARE_GBUFFER_BAKE_LIGHTING(_CameraGBufferTexture);
Texture2D _CameraDepthTexture;
float4 _ScreenSize;
float _DebugMode;
float4x4 _InvViewProjMatrix;
struct Attributes
{
float3 positionOS : POSITION;
};
struct Varyings
{
float4 positionHS : SV_POSITION;
};
Varyings VertDeferred(Attributes input)
{
// TODO: implement SV_vertexID full screen quad
// Lights are draw as one fullscreen quad
Varyings output;
float3 positionWS = TransformObjectToWorld(input.positionOS);
output.positionHS = TransformWorldToHClip(positionWS);
return output;
}
float4 FragDeferred(Varyings input) : SV_Target
{
Coordinate coord = GetCoordinate(input.positionHS.xy, _ScreenSize.zw);
float depth = _CameraDepthTexture.Load(uint3(coord.unPositionSS, 0)).x;
FETCH_GBUFFER(gbuffer, _CameraGBufferTexture, coord.unPositionSS);
BSDFData bsdfData = DECODE_FROM_GBUFFER(gbuffer);
float3 result = float3(1.0, 1.0, 0.0);
bool outputIsLinear = false;
if (_DebugMode == GBufferDebugDiffuseColor)
{
result = bsdfData.diffuseColor;
}
else if (_DebugMode == GBufferDebugNormal)
{
result = bsdfData.normalWS * 0.5 + 0.5;
outputIsLinear = true;
}
else if (_DebugMode == GBufferDebugDepth)
{
float linearDepth = frac(LinearEyeDepth(depth, _ZBufferParams) * 0.1);
result = linearDepth.xxx;
outputIsLinear = true;
}
else if (_DebugMode == GBufferDebugBakedDiffuse)
{
FETCH_BAKE_LIGHTING_GBUFFER(gbuffer, _CameraGBufferTexture, coord.unPositionSS);
result = DECODE_BAKE_LIGHTING_FROM_GBUFFER(gbuffer);
outputIsLinear = true;
}
else if (_DebugMode == GBufferDebugSpecularColor)
{
result = bsdfData.fresnel0;
}
else if (_DebugMode == GBufferDebugSpecularOcclustion)
{
result = bsdfData.specularOcclusion.xxx;
outputIsLinear = true;
}
else if (_DebugMode == GBufferDebugSmoothness)
{
result = (1.0 - bsdfData.perceptualRoughness).xxx;
outputIsLinear = true;
}
else if (_DebugMode == GBufferDebugMaterialId)
{
result = bsdfData.materialId.xxx;
outputIsLinear = true;
}
if (outputIsLinear)
result = SRGBToLinear(max(0, result));
return float4(result, 1.0);
}
ENDHLSL
}
}
Fallback Off
}
正在加载...
取消
保存