浏览代码

SSAO: Small tweaks

- UV clamping on depth sampling.
- Removed unused functions.
/RenderPassXR_Sandbox
sebastienlagarde 8 年前
当前提交
628ab21e
共有 2 个文件被更改,包括 1 次插入15 次删除
  1. 14
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/AmbientOcclusion/Resources/CommonAmbientOcclusion.hlsl
  2. 2
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/AmbientOcclusion/Resources/Estimation.hlsl

14
Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/AmbientOcclusion/Resources/CommonAmbientOcclusion.hlsl


// A small value used for avoiding self-occlusion.
static const float kEpsilon = 1e-6;
float2 SinCos(float theta)
{
float sn, cs;
sincos(theta, sn, cs);
return float2(sn, cs);
}
// Pseudo random number generator with 2D coordinates
float UVRandom(float u, float v)
{
float f = dot(float2(12.9898, 78.233), float2(u, v));
return frac(43758.5453 * sin(f));
}
// Interleaved gradient function from Jimenez 2014 http://goo.gl/eomGso
float GradientNoise(float2 uv)
{

2
Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/AmbientOcclusion/Resources/Estimation.hlsl


// Project the sample point and get the view-space position.
float2 spos_s1 = float2(dot(unity_CameraProjection[0].xyz, vpos_s1),
dot(unity_CameraProjection[1].xyz, vpos_s1));
float2 uv_s1_01 = (spos_s1 / vpos_s1.z + 1.0) * 0.5;
float2 uv_s1_01 = saturate((spos_s1 / vpos_s1.z + 1.0) * 0.5);
float depth_s1_raw = LOAD_TEXTURE2D(_MainDepthTexture, uint2(uv_s1_01 * _ScreenSize.xy)).x;
float3 vpos_s2 = ComputeViewSpacePosition(uv_s1_01, depth_s1_raw, _InvProjMatrix);

正在加载...
取消
保存