浏览代码

fix cookie coord for point light

fix cookie coord for point light
/main
mmikk 8 年前
当前提交
195cdbc5
共有 2 个文件被更改,包括 2 次插入3 次删除
  1. 2
      Assets/ScriptableRenderLoop/fptl/FptlLighting.cs
  2. 3
      Assets/ScriptableRenderLoop/fptl/Internal-DeferredShading.shader

2
Assets/ScriptableRenderLoop/fptl/FptlLighting.cs


boundData[i].vScaleXY = new Vec2(1.0f, 1.0f);
boundData[i].fRadius = range;
// represents a left hand coordinate system in world space
// represents a left hand coordinate system in world space since det(worldToView)<0
Matrix4x4 lightToView = worldToView * lightToWorld;
Vector3 vx = lightToView.GetColumn(0);
Vector3 vy = lightToView.GetColumn(1);

3
Assets/ScriptableRenderLoop/fptl/Internal-DeferredShading.shader


float atten = tex2Dlod(_LightTextureB0, float4(attLookUp.rr, 0.0, 0.0)).UNITY_ATTEN_CHANNEL;
float4 cookieColor = float4(1,1,1,1);
float3 cookieCoord = float3(dot(vL, lgtDat.vLaxisX.xyz), dot(vL, lgtDat.vLaxisY.xyz), -dot(vL, lgtDat.vLaxisZ.xyz));
float3 cookieCoord = -float3(dot(vL, lgtDat.vLaxisX.xyz), dot(vL, lgtDat.vLaxisY.xyz), dot(vL, lgtDat.vLaxisZ.xyz)); // negate to make vL a fromLight vector
cookieColor = UNITY_SAMPLE_TEXCUBEARRAY_LOD(_pointCookieTextures, float4(cookieCoord, lgtDat.iSliceIndex), 0.0);
atten *= cookieColor.w;
}

正在加载...
取消
保存