浏览代码

Optimize ImportanceSamplePunctualLight() - more work is needed

/Yibing-Project-2
Evgenii Golubev 7 年前
当前提交
fc439d60
共有 2 个文件被更改,包括 15 次插入12 次删除
  1. 22
      ScriptableRenderPipeline/Core/ShaderLibrary/VolumeRendering.hlsl
  2. 5
      ScriptableRenderPipeline/HDRenderPipeline/Lighting/Volumetrics/Resources/VolumetricLighting.compute

22
ScriptableRenderPipeline/Core/ShaderLibrary/VolumeRendering.hlsl


}
// Implements equiangular light sampling.
// Returns the distance from 0 and the reciprocal of the PDF.
// Returns the distance from the origin of the ray, the squared (radial) distance from the light,
// and the reciprocal of the PDF.
out float dist, out float rcpPdf)
out float dist, out float rSq, out float rcpPdf)
float rayToLightDist = sqrt(rayToLightDistSq);
float a = tMin - originToLightProj;
float b = tMax - originToLightProj;
float d = rayToLightDist;
float a = tMin - originToLightProj;
float b = tMax - originToLightProj;
float dSq = rayToLightDistSq;
float d = sqrt(dSq);
float dInv = rsqrt(dSq);
float theta0 = atan(a / d);
float theta1 = atan(b / d);
float theta0 = FastATan(a * dInv);
float theta1 = FastATan(b * dInv);
float gamma = theta1 - theta0;
rcpPdf = (theta1 - theta0) * (d + t * tan(theta));
rSq = dSq + t * t;
rcpPdf = gamma * rSq * dInv;
}
// Absorption coefficient from Disney: http://blog.selfshadow.com/publications/s2015-shading-course/burley/s2015_pbs_disney_bsdf_notes.pdf

5
ScriptableRenderPipeline/HDRenderPipeline/Lighting/Volumetrics/Resources/VolumetricLighting.compute


// TODO...
if (lightType != GPULIGHTTYPE_POINT) continue;
float t, rcpPdf;
float t, distSq, rcpPdf;
tMin, tMax, t, rcpPdf);
tMin, tMax, t, distSq, rcpPdf);
float distSq = dot(lightToSample, lightToSample);
float dist = sqrt(distSq);
float3 L = lightToSample * -rsqrt(distSq);
float intensity = GetPunctualShapeAttenuation(lightData, L, distSq);

正在加载...
取消
保存