浏览代码

some commented out debug code in case its needed again

/main
Filip Iliescu 8 年前
当前提交
3b85d428
共有 2 个文件被更改,包括 22 次插入2 次删除
  1. 8
      Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/Internal-DeferredReflections.shader
  2. 16
      Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/LightingTemplate.hlsl

8
Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/Internal-DeferredReflections.shader


in half4 gbuffer1 : SV_Target1,
in half4 gbuffer2 : SV_Target2,
out half4 outEmission : SV_Target3,
in float outLinearDepth : SV_Target4)
in float linearDepth : SV_Target4)
#else
half4 frag (unity_v2f_deferred i) : SV_TARGET
#endif

#ifndef UNITY_FRAMEBUFFER_FETCH_AVAILABLE
OnChipDeferredFragSetup(i, uv, viewPos, worldPos, 0.0);
#else
OnChipDeferredFragSetup(i, uv, viewPos, worldPos, outLinearDepth);
OnChipDeferredFragSetup(i, uv, viewPos, worldPos, linearDepth);
#endif
#ifndef UNITY_FRAMEBUFFER_FETCH_AVAILABLE

half falloff = saturate(1.0 - length(distance)/blendDistance);
half4 ret = half4(rgb*falloff, 1-falloff);
//debug
//if (all(worldPos>specMin && worldPos<specMax))
//ret = half4(frac(0.2*worldPos), 1);
// UNITY_BRDF_PBS1 writes out alpha 1 to our emission alpha. TODO: Should preclear emission alpha after gbuffer pass in case this ever changes
#ifdef UNITY_FRAMEBUFFER_FETCH_AVAILABLE

16
Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/LightingTemplate.hlsl


return flShadowScalar;
}
//debug
//float3 GetViewPosFromLinDepth(float2 v2ScrPos, float fLinDepth)
//{
// float fSx = UNITY_MATRIX_P[0].x;
// float fCx = UNITY_MATRIX_P[0].z;
// float fSy = UNITY_MATRIX_P[1].y;
// float fCy = UNITY_MATRIX_P[1].z;
//
// return fLinDepth*float3( ((v2ScrPos.x-fCx)/fSx), ((v2ScrPos.y-fCy)/fSy), 1.0 );
//}
// --------------------------------------------------------
// Common lighting data calculation (direction, attenuation, ...)

{
i.ray = i.ray * (_ProjectionParams.z / i.ray.z);
float2 uv = i.uv.xy / i.uv.w;
//float2 uv = i.pos.xy / float2(_ScreenParams.xy);
// read depth and reconstruct world position
// if we have framebuffer fetch, its expected depth was passed in the parameter from the framebuffer so no need to fetch

depth = Linear01Depth (depth);
//debug
//float linDepth = depth * (_ProjectionParams.z-_ProjectionParams.y) + _ProjectionParams.y;
//float4 vpos = float4(GetViewPosFromLinDepth((2*uv-1)*float2(1, -1), linDepth), 1);
float4 vpos = float4(i.ray * depth,1);
float3 wpos = mul (unity_CameraToWorld, vpos).xyz;

正在加载...
取消
保存