浏览代码

minor cosmetics fixes to refl probes stuff

minor cosmetics fixes to refl probes stuff
/main
mmikk 8 年前
当前提交
e056bb2f
共有 3 个文件被更改,包括 9 次插入17 次删除
  1. 20
      Assets/ScriptableRenderLoop/fptl/FptlLighting.cs
  2. 4
      Assets/ScriptableRenderLoop/fptl/Internal-DeferredReflections.shader
  3. 2
      Assets/ScriptableRenderLoop/fptl/LightDefinitions.cs

20
Assets/ScriptableRenderLoop/fptl/FptlLighting.cs


// probe.m_BlendDistance
// Vector3f extents = 0.5*Abs(probe.m_BoxSize);
// C center of rendered refl box <-- GetComponent (Transform).GetPosition() + m_BoxOffset;
// P parameter position to shader: GetComponent (Transform).GetPosition()
// cube map capture point: GetComponent (Transform).GetPosition()
//Vector3[] Ps = new Vector3[3] { new Vector3(6.28f, -1.18f, -5.67f), new Vector3(14.23f, -1.18f, 0.21f), new Vector3(6.28f, -1.18f, 1.91f) };
//Vector3[] boxSizes = new Vector3[3] { new Vector3(20.0f, 10.0f, 10.0f), new Vector3(10.0f, 10.0f, 10.0f), new Vector3(10.0f, 10.0f, 10.0f) };
//Vector3 boxOffset = new Vector3(0.0f, 0.0f, 0.0f);
//float[] bd = new float[3] { 4.0f, 4.0f, 4.0f };
int numProbesOut = 0;
foreach (var rl in probes)

lightData[i].flags = 0;
Bounds bnds = rl.bounds;
Vector3 boxOffset = rl.center;
Vector3 boxOffset = rl.center; // reflection volume offset relative to cube map capture point
Vector3 reflPos = mat.GetColumn(3);
Vector3 cubeCapturePos = mat.GetColumn(3); // cube map capture position in world space
// implicit in CalculateHDRDecodeValues() --> float ints = rl.intensity;

// C is reflection volume center in world space (NOT same as cube map capture point)
Vector3 posForShaderParam = reflPos; // same as commented out line above when rot is identity
Vector3 posForShaderParam = cubeCapturePos; // same as commented out line above when rot is identity
//Vector3 vx = new Vector3(1, 0, 0); // always axis aligned in world space for now
//Vector3 vy = new Vector3(0, 1, 0);
//Vector3 vz = new Vector3(0, 0, 1);
Vector3 vx = mat.GetColumn(0);
Vector3 vy = mat.GetColumn(1);
Vector3 vz = mat.GetColumn(2);

lightData[i].vLaxisX = vx;
lightData[i].vLaxisY = vy;
lightData[i].vLaxisZ = vz;
lightData[i].vProbeBoxOffset = boxOffset;
lightData[i].vLocalCubeCapturePoint = -boxOffset;
lightData[i].fProbeBlendDistance = blendDistance;
lightData[i].fLightIntensity = decodeVals.x;

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


float4 vBoxOuterDistance = float4( lgtDat.vBoxInnerDist + float3(blendDistance, blendDistance, blendDistance), 0.0 );
#if 0
// if rotation is NOT supported
worldNormal0 = BoxProjectedCubemapDirection(worldNormalRefl, posInProbeSpace, float4(-lgtDat.vProbeBoxOffset, 1.0), -vBoxOuterDistance, vBoxOuterDistance);
worldNormal0 = BoxProjectedCubemapDirection(worldNormalRefl, posInProbeSpace, float4(lgtDat.vLocalCubeCapturePoint, 1.0), -vBoxOuterDistance, vBoxOuterDistance);
float3 vPR = BoxProjectedCubemapDirection(probeSpaceRefl, posInProbeSpace, float4(-lgtDat.vProbeBoxOffset, 1.0), -vBoxOuterDistance, vBoxOuterDistance); // probe space corrected reflection vector
float3 vPR = BoxProjectedCubemapDirection(probeSpaceRefl, posInProbeSpace, float4(lgtDat.vLocalCubeCapturePoint, 1.0), -vBoxOuterDistance, vBoxOuterDistance); // probe space corrected reflection vector
worldNormal0 = mul( (float3x3) g_mViewToWorld, vPR.x*lgtDat.vLaxisX + vPR.y*lgtDat.vLaxisY + vPR.z*lgtDat.vLaxisZ );
#endif
}

2
Assets/ScriptableRenderLoop/fptl/LightDefinitions.cs


public Vec3 vBoxInvRange;
public float fPad0;
public Vec3 vProbeBoxOffset;
public Vec3 vLocalCubeCapturePoint;
public float fProbeBlendDistance;
};

正在加载...
取消
保存