浏览代码

fptl: fixed point light cookie transform

/main
vlad-andreev 8 年前
当前提交
2ef69948
共有 4 个文件被更改,包括 17 次插入5 次删除
  1. 10
      Assets/ScriptableRenderLoop/fptl/FptlLighting.cs
  2. 4
      Assets/ScriptableRenderLoop/fptl/Internal-DeferredShading.shader
  3. 2
      Assets/ScriptableRenderLoop/fptl/renderloopfptl.asset
  4. 6
      Assets/TestScenes/FPTL/FPTL.unity

10
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
Matrix4x4 lightToView = worldToView * lightToWorld;
Vector3 vx = lightToView.GetColumn(0);
Vector3 vy = lightToView.GetColumn(1);
Vector3 vz = lightToView.GetColumn(2);
lightData[i].vLaxisX = vx;
lightData[i].vLaxisY = vy;
lightData[i].vLaxisZ = vz;
lightData[i].flags |= (bHasCookie ? LightDefinitions.HAS_COOKIE_TEXTURE : 0);
lightData[i].flags |= (bHasShadow ? LightDefinitions.HAS_SHADOW : 0);

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


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));
cookieColor = UNITY_SAMPLE_TEXCUBEARRAY_LOD(_pointCookieTextures, float4(-vLw, lgtDat.iSliceIndex), 0.0);
cookieColor = UNITY_SAMPLE_TEXCUBEARRAY_LOD(_pointCookieTextures, float4(cookieCoord, lgtDat.iSliceIndex), 0.0);
atten *= cookieColor.w;
}

2
Assets/ScriptableRenderLoop/fptl/renderloopfptl.asset


directionalLightCascades: {x: 0.05, y: 0.2, z: 0.3}
m_TextureSettings:
spotCookieSize: 512
pointCookieSize: 256
pointCookieSize: 512
m_DeferredShader: {fileID: 4800000, guid: 1c102a89f3460254a8c413dbdcd63a2a, type: 3}
m_DeferredReflectionShader: {fileID: 4800000, guid: 3899e06d641c2cb4cbff794df0da536b,
type: 3}

6
Assets/TestScenes/FPTL/FPTL.unity


m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 756999128}
m_LocalRotation: {x: -0.7251825, y: -0.5106002, z: -0.034586895, w: 0.46065348}
m_LocalPosition: {x: -10.009945, y: -6.4941626, z: -3}
m_LocalRotation: {x: 0.7071068, y: 0, z: 0, w: 0.7071068}
m_LocalPosition: {x: -8.2, y: -7.44, z: -5.59}
m_LocalEulerAnglesHint: {x: 224.703, y: -323.752, z: -85.629}
m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0}
--- !u!1 &942239534
GameObject:
m_ObjectHideFlags: 0

正在加载...
取消
保存