mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-03-24 14:49:27 +00:00
suggested alterations to the probe.worldToLocal math feeding and usage (and a divnull safety for attenuation)
This commit is contained in:
parent
3afbdff871
commit
edcdd21379
2 changed files with 10 additions and 3 deletions
|
|
@ -344,7 +344,14 @@ void RenderProbeMgr::_setupStaticParameters()
|
|||
probePositionsData[mEffectiveProbeCount] = Point4F(probePos.x, probePos.y, probePos.z,0);
|
||||
probeRefPositionsData[mEffectiveProbeCount] = Point4F(refPos.x, refPos.y, refPos.z, 0);
|
||||
|
||||
probeWorldToObjData[mEffectiveProbeCount] = curEntry.getTransform();
|
||||
Point3F projectScale=curEntry.mBounds.getExtents();
|
||||
MatrixF transform = curEntry.getTransform();
|
||||
transform.scale(projectScale);
|
||||
//transform.setPosition(curEntry.getTransform().getPosition());
|
||||
transform.fullInverse();
|
||||
//transform.transpose();
|
||||
|
||||
probeWorldToObjData[mEffectiveProbeCount] = transform;// curEntry.getTransform();
|
||||
Point3F bbMin = refPos - curEntry.mProbeRefScale/2;
|
||||
Point3F bbMax = refPos + curEntry.mProbeRefScale/2;
|
||||
probeBBMinData[mEffectiveProbeCount] = Point4F(bbMin.x, bbMin.y, bbMin.z, 0);
|
||||
|
|
|
|||
|
|
@ -69,11 +69,11 @@ float defineBoxSpaceInfluence(Surface surface, ProbeData probe, float3 wsEyeRay)
|
|||
float3 boxMinLS = mul(probe.worldToLocal, float4(probe.boxMin, 1.0)).xyz;
|
||||
float3 boxMaxLS = mul(probe.worldToLocal, float4(probe.boxMax, 1.0)).xyz;
|
||||
|
||||
float boxOuterRange = length(boxMaxLS - boxMinLS);
|
||||
float boxOuterRange = 2;//length(boxMaxLS - boxMinLS);
|
||||
float boxInnerRange = boxOuterRange / probe.attenuation;
|
||||
|
||||
float3 localDir = float3(abs(surfPosLS.x), abs(surfPosLS.y), abs(surfPosLS.z));
|
||||
localDir = (localDir - boxInnerRange) / (boxOuterRange - boxInnerRange);
|
||||
localDir = (localDir - boxInnerRange) / max((boxOuterRange - boxInnerRange),0.0001);
|
||||
|
||||
float contribution = max(localDir.x, max(localDir.y, localDir.z)) * -1;
|
||||
return contribution;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue