比较提交

...
此合并请求有变更与目标分支冲突。
/ScriptableRenderPipeline/LightweightPipeline/LWRP/Shaders/LightweightScreenSpaceShadows.shader
/ScriptableRenderPipeline/LightweightPipeline/LWRP/Shaders/LightweightStandardSimpleLighting.shader
/ScriptableRenderPipeline/LightweightPipeline/LWRP/LightweightPipeline.cs

1 次代码提交

作者 SHA1 备注 提交日期
Robert Srinivasiah 56d9be64 Experimental debugging code, nothing works 7 年前
共有 3 个文件被更改,包括 46 次插入9 次删除
  1. 15
      ScriptableRenderPipeline/LightweightPipeline/LWRP/LightweightPipeline.cs
  2. 37
      ScriptableRenderPipeline/LightweightPipeline/LWRP/Shaders/LightweightScreenSpaceShadows.shader
  3. 3
      ScriptableRenderPipeline/LightweightPipeline/LWRP/Shaders/LightweightStandardSimpleLighting.shader

15
ScriptableRenderPipeline/LightweightPipeline/LWRP/LightweightPipeline.cs


{
var desc = XRSettings.eyeTextureDesc;
desc.depthBufferBits = 0;
desc.colorFormat = RenderTextureFormat.R8;
desc.colorFormat = RenderTextureFormat.RFloat;
SetRenderTarget(cmd, m_ScreenSpaceShadowMapRT, ClearFlag.Color);
cmd.Blit(null, m_ScreenSpaceShadowMapRT, m_ScreenSpaceShadowsMaterial);
//cmd.DrawProcedural(Matrix4x4.identity, m_ScreenSpaceShadowsMaterial, 0, MeshTopology.Triangles, 3, 2);
cmd.Blit(null, m_ScreenSpaceShadowMapRT, m_ScreenSpaceShadowsMaterial);
cmd.Blit(null, m_ScreenSpaceShadowMapRT, m_ScreenSpaceShadowsMaterial);
if (LightweightUtils.HasFlag(frameRenderingConfiguration, FrameRenderingConfiguration.Stereo))
context.StartMultiEye(m_CurrCamera);

var cmd = CommandBufferPool.Get("Blit");
if (m_IntermediateTextureArray)
{
cmd.Blit(m_CurrCameraColorRT, BuiltinRenderTextureType.CameraTarget);
//cmd.Blit(m_CurrCameraColorRT, BuiltinRenderTextureType.CameraTarget);
cmd.Blit(m_ScreenSpaceShadowMapRT, BuiltinRenderTextureType.CameraTarget);
}
else if (LightweightUtils.HasFlag(renderingConfig, FrameRenderingConfiguration.IntermediateTexture))
{

// If PostProcessing is enabled, it is already blit to CameraTarget.
if (!LightweightUtils.HasFlag(renderingConfig, FrameRenderingConfiguration.PostProcess))
Blit(cmd, renderingConfig, m_CurrCameraColorRT, BuiltinRenderTextureType.CameraTarget, blitMaterial);
Blit(cmd, renderingConfig, m_ScreenSpaceShadowMapRT, BuiltinRenderTextureType.CameraTarget, blitMaterial);
//Blit(cmd, renderingConfig, m_CurrCameraColorRT, BuiltinRenderTextureType.CameraTarget, blitMaterial);
}
SetRenderTarget(cmd, BuiltinRenderTextureType.CameraTarget);

37
ScriptableRenderPipeline/LightweightPipeline/LWRP/Shaders/LightweightScreenSpaceShadows.shader


HLSLINCLUDE
//#pragma enable_d3d11_debug_symbols
//Keep compiler quiet about Shadows.hlsl.
#include "CoreRP/ShaderLibrary/Common.hlsl"
#include "CoreRP/ShaderLibrary/EntityLighting.hlsl"

TEXTURE2D(_CameraDepthTexture);
SAMPLER(sampler_CameraDepthTexture);
#endif
//struct FragInfo
//{
// uint eyeIndex;
// half4 pos;
// half4 texcoord;
//};
//AppendStructuredBuffer<FragInfo> FragInfoAppendBuffer;
struct VertexInput
{

{
half4 pos : SV_POSITION;
half4 texcoord : TEXCOORD0;
UNITY_VERTEX_INPUT_INSTANCE_ID
//UNITY_VERTEX_INPUT_INSTANCE_ID
#if defined(UNITY_STEREO_INSTANCING_ENABLED)
//uint testSlice : SV_RenderTargetArrayIndex;
#endif
};
Interpolators Vertex(VertexInput i)

UNITY_TRANSFER_INSTANCE_ID(i, o);
//UNITY_TRANSFER_INSTANCE_ID(i, o);
#if defined(UNITY_STEREO_INSTANCING_ENABLED)
//o.stereoEyeIndex = 1;
#endif
o.pos = TransformObjectToHClip(i.vertex.xyz);
float4 projPos = o.pos * 0.5;

// Doesn't seem like saturate messes anything up here...
o.texcoord.xy = UnityStereoTransformScreenSpaceTex(i.texcoord.xy);
o.texcoord.zw = projPos.xy;

half Fragment(Interpolators i) : SV_Target
{
UNITY_SETUP_INSTANCE_ID(i);
//UNITY_SETUP_INSTANCE_ID(i);
//FragInfo debugInfo;
//debugInfo.eyeIndex = unity_StereoEyeIndex;
//debugInfo.pos = i.pos;
//debugInfo.texcoord = i.texcoord;
//FragInfoAppendBuffer.Append(debugInfo);
// TODO
// declare texture correctly as tex2darray

float deviceDepth = SAMPLE_TEXTURE2D_ARRAY(_CameraDepthTexture, sampler_CameraDepthTexture, i.texcoord.xy, unity_StereoEyeIndex).r;
//float deviceDepth = SAMPLE_TEXTURE2D_ARRAY(_CameraDepthTexture, sampler_CameraDepthTexture, i.texcoord.xy, unity_StereoEyeIndex).r;
//deviceDepth = SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, sampler_CameraDepthTexture, i.texcoord.xy);
float deviceDepth = SAMPLE_TEXTURE2D_ARRAY(_CameraDepthTexture, sampler_CameraDepthTexture, i.texcoord.xy, 0).r;
#else
float deviceDepth = SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, sampler_CameraDepthTexture, i.texcoord.xy);
#endif

//Fetch shadow coordinates for cascade.
float4 coords = ComputeScreenSpaceShadowCoords(wpos);
return SampleShadowmap(coords);
//return SampleShadowmap(coords);
//return deviceDepth;
return i.texcoord.x;
//return unity_StereoEyeIndex;
}
ENDHLSL

3
ScriptableRenderPipeline/LightweightPipeline/LWRP/Shaders/LightweightStandardSimpleLighting.shader


ZWrite[_ZWrite]
HLSLPROGRAM
#pragma enable_d3d11_debug_symbols
// Required to compile gles 2.0 with standard srp library
#pragma prefer_hlslcc gles
#pragma target 3.0

正在加载...
取消
保存