Julien Ignace
8 年前
当前提交
3fdb1fb7
共有 4 个文件被更改,包括 153 次插入 和 0 次删除
-
50Assets/ScriptableRenderLoop/HDRenderPipeline/Debug/HDRenderPipelineDebug.cs
-
12Assets/ScriptableRenderLoop/HDRenderPipeline/Debug/HDRenderPipelineDebug.cs.meta
-
82Assets/ScriptableRenderLoop/HDRenderPipeline/Debug/Resources/DebugDisplayShadowMap.shader
-
9Assets/ScriptableRenderLoop/HDRenderPipeline/Debug/Resources/DebugDisplayShadowMap.shader.meta
|
|||
using System.Collections; |
|||
using System.Collections.Generic; |
|||
using UnityEngine; |
|||
using System; |
|||
|
|||
namespace UnityEngine.Experimental.Rendering.HDPipeline |
|||
{ |
|||
[Serializable] |
|||
public class GlobalDebugParameters |
|||
{ |
|||
public float debugOverlayRatio = 0.33f; |
|||
public bool displayDebug = false; |
|||
public bool displayShadowDebug = false; |
|||
|
|||
public ShadowDebugParameters shadowDebugParameters = new ShadowDebugParameters(); |
|||
} |
|||
|
|||
public class DebugParameters |
|||
{ |
|||
// Material Debugging
|
|||
public int debugViewMaterial = 0; |
|||
|
|||
// Rendering debugging
|
|||
public bool displayOpaqueObjects = true; |
|||
public bool displayTransparentObjects = true; |
|||
|
|||
public bool useForwardRenderingOnly = false; // TODO: Currently there is no way to strip the extra forward shaders generated by the shaders compiler, so we can switch dynamically.
|
|||
public bool useDepthPrepass = false; |
|||
public bool useDistortion = true; |
|||
|
|||
// we have to fallback to forward-only rendering when scene view is using wireframe rendering mode --
|
|||
// as rendering everything in wireframe + deferred do not play well together
|
|||
public bool ShouldUseForwardRenderingOnly() { return useForwardRenderingOnly || GL.wireframe; } |
|||
} |
|||
|
|||
public enum ShadowDebugMode |
|||
{ |
|||
None, |
|||
VisualizeAtlas, |
|||
VisualizeShadowMap |
|||
} |
|||
|
|||
[Serializable] |
|||
public class ShadowDebugParameters |
|||
{ |
|||
public bool enableShadows = true; |
|||
public ShadowDebugMode visualizationMode = ShadowDebugMode.None; |
|||
public uint visualizeShadowMapIndex = 0; |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: ae82efafe32ed1042a9360276bee62e6 |
|||
timeCreated: 1485277036 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
Shader "Hidden/HDRenderPipeline/DebugDisplayShadowMap" |
|||
{ |
|||
SubShader |
|||
{ |
|||
Pass |
|||
{ |
|||
ZWrite Off |
|||
ZTest Off |
|||
Blend One Zero |
|||
Cull Off |
|||
|
|||
HLSLPROGRAM |
|||
#pragma target 4.5 |
|||
#pragma only_renderers d3d11 ps4 metal // TEMP: unitl we go futher in dev |
|||
|
|||
#pragma vertex Vert |
|||
#pragma fragment Frag |
|||
|
|||
#include "Common.hlsl" |
|||
|
|||
TEXTURE2D(g_tShadowBuffer); |
|||
|
|||
TEXTURE2D(_DummyTexture); |
|||
SAMPLER2D(sampler_DummyTexture); |
|||
|
|||
float4 _TextureScaleBias; |
|||
|
|||
struct Attributes |
|||
{ |
|||
uint vertexID : SV_VertexID; |
|||
}; |
|||
|
|||
struct Varyings |
|||
{ |
|||
float4 positionCS : SV_POSITION; |
|||
float2 texcoord : TEXCOORD0; |
|||
}; |
|||
|
|||
Varyings Vert(Attributes input) |
|||
{ |
|||
float4 positions[] = |
|||
{ |
|||
float4(-1.0, -1.0, 0.0f, 1.0), |
|||
float4( 1.0, -1.0, 0.0f, 1.0), |
|||
float4( 1.0, 1.0, 0.0f, 1.0), |
|||
|
|||
float4( 1.0, 1.0, 0.0f, 1.0), |
|||
float4(-1.0, 1.0, 0.0f, 1.0), |
|||
float4(-1.0, -1.0, 0.0f, 1.0) |
|||
}; |
|||
|
|||
float2 texcoords[] = |
|||
{ |
|||
float2(0.0, 1.0), |
|||
float2(1.0, 1.0), |
|||
float2(1.0, 0.0), |
|||
|
|||
float2(1.0, 0.0), |
|||
float2(0.0, 0.0), |
|||
float2(0.0, 1.0), |
|||
}; |
|||
|
|||
Varyings output; |
|||
output.positionCS = positions[input.vertexID]; |
|||
output.texcoord = texcoords[input.vertexID] * _TextureScaleBias.xy + _TextureScaleBias.zw; |
|||
|
|||
return output; |
|||
} |
|||
|
|||
float4 Frag(Varyings input) : SV_Target |
|||
{ |
|||
// We need the dummy texture for the sampler, but we also need to sample it in order not to get a compile error. |
|||
float4 dummy = SAMPLE_TEXTURE2D(_DummyTexture, sampler_DummyTexture, input.texcoord) * 0.00001; |
|||
return SAMPLE_TEXTURE2D(g_tShadowBuffer, sampler_DummyTexture, input.texcoord).xxxx + dummy; |
|||
} |
|||
|
|||
ENDHLSL |
|||
} |
|||
|
|||
} |
|||
Fallback Off |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: ee25e539f5594f44085e0a9000c15d9b |
|||
timeCreated: 1476053153 |
|||
licenseType: Pro |
|||
ShaderImporter: |
|||
defaultTextures: [] |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue