浏览代码

Improve comments

/main
Evgenii Golubev 8 年前
当前提交
2e758936
共有 1 个文件被更改,包括 3 次插入3 次删除
  1. 6
      Assets/ScriptableRenderLoop/ShaderLibrary/CommonLighting.hlsl

6
Assets/ScriptableRenderLoop/ShaderLibrary/CommonLighting.hlsl


// Helper functions
//-----------------------------------------------------------------------------
// Performs the mapping of the vector 'v' centered within the cube of dimensions [-1, 1]^3
// to a vector centered within the sphere of radius 1.
// Performs the mapping of the vector 'v' centered within the axis-aligned cube
// of dimensions [-1, 1]^3 to a vector centered within the sphere of radius 1.
// The function expects 'v' to be within the cube (possibly unexpected results otherwise).
// Ref: http://mathproofs.blogspot.com/2005/07/mapping-cube-to-sphere.html
float3 MapCubeToSphere(float3 v)

return SmoothDistanceAttenuation(dot(unL, unL), invSqrAttenuationRadius);
}
// Applies SmoothDistanceAttenuation() after performing the box to sphere mapping.
// Applies SmoothDistanceAttenuation() after mapping the axis-aligned box to a sphere.
// If the length of the diagonal of the box is 'd', invHalfDiag = rcp(0.5 * d).
// Both the box (e.i. 'invHalfDiag') and 'unL' should be in the same coordinate system.
// 'unL' should be computed from the center of the box.

正在加载...
取消
保存