mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-01-20 04:34:48 +00:00
depth correction
With Permission from Jeff Faust. // AFX CODE BLOCK (bug-fix) << // This fix prevents some bad rendering artifacts that occur at the edge of the visibleDistance. // The artifacts are most obvious when there is fog present.
This commit is contained in:
parent
84430a46a8
commit
b2a4f3fd44
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
#include "materials/materialFeatureTypes.h"
|
||||
#include "materials/materialFeatureData.h"
|
||||
|
||||
#include "terrain/terrFeatureTypes.h"
|
||||
|
||||
void EyeSpaceDepthOutHLSL::processVert( Vector<ShaderComponent*> &componentList,
|
||||
const MaterialFeatureData &fd )
|
||||
|
|
@ -85,7 +85,12 @@ void EyeSpaceDepthOutHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
LangElement *depthOutDecl = new DecOp( depthOut );
|
||||
|
||||
meta->addStatement( new GenOp( "#ifndef CUBE_SHADOW_MAP\r\n" ) );
|
||||
meta->addStatement( new GenOp( " @ = dot(@, (@.xyz / @.w));\r\n", depthOutDecl, vEye, wsEyeVec, wsEyeVec ) );
|
||||
|
||||
if (fd.features.hasFeature(MFT_TerrainBaseMap))
|
||||
meta->addStatement(new GenOp(" @ =min(0.9999, dot(@, (@.xyz / @.w)));\r\n", depthOutDecl, vEye, wsEyeVec, wsEyeVec));
|
||||
else
|
||||
meta->addStatement(new GenOp(" @ = dot(@, (@.xyz / @.w));\r\n", depthOutDecl, vEye, wsEyeVec, wsEyeVec));
|
||||
|
||||
meta->addStatement( new GenOp( "#else\r\n" ) );
|
||||
|
||||
Var *farDist = (Var*)Var::find( "oneOverFarplane" );
|
||||
|
|
|
|||
Loading…
Reference in a new issue