浏览代码

Optimize box lights

/Yibing-Project-2
Evgenii Golubev 7 年前
当前提交
674ea1ba
共有 1 个文件被更改,包括 4 次插入8 次删除
  1. 12
      ScriptableRenderPipeline/HDRenderPipeline/Lighting/Volumetrics/Resources/VolumetricLighting.compute

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


light.lightType = GPULIGHTTYPE_PROJECTOR_BOX;
// Convert the box light from OBB to AABB.
// TODO: precompute all of this.
float invHalfWidth = rsqrt(dot(light.right, light.right));
float invHalfHeight = rsqrt(dot(light.right, light.right));
float depth = rsqrt(light.invSqrAttenuationRadius);
float3x3 rotMat = float3x3(light.right * invHalfWidth, light.up * invHalfHeight, light.forward); // Normalize
// 'light.right' and 'light.up' vectors are pre-scaled on the CPU by (2/w) and (2/h).
float3x3 rotMat = float3x3(light.right, light.up, light.forward);
float3 boxPt0 = float3(-invHalfWidth, -invHalfHeight, 0);
float3 boxPt1 = float3( invHalfWidth, invHalfHeight, depth);
float3 boxPt0 = float3(-1, -1, 0);
float3 boxPt1 = float3( 1, 1, rsqrt(light.invSqrAttenuationRadius));
float tEntr, tExit;

正在加载...
取消
保存