mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-29 16:25:42 +00:00
Merge pull request #1847 from Azaezel/ParallaxLight
factoring in tangentW causes parallax to swap specular highlight directions.
This commit is contained in:
commit
0c2a5be23e
4 changed files with 0 additions and 20 deletions
|
|
@ -291,14 +291,6 @@ void ParallaxFeatGLSL::processVert( Vector<ShaderComponent*> &componentList,
|
||||||
meta->addStatement( new GenOp( " @ = tMul( @, float3( @.xyz - @ ) );\r\n",
|
meta->addStatement( new GenOp( " @ = tMul( @, float3( @.xyz - @ ) );\r\n",
|
||||||
outNegViewTS, objToTangentSpace, inPos, eyePos ) );
|
outNegViewTS, objToTangentSpace, inPos, eyePos ) );
|
||||||
|
|
||||||
// TODO: I'm at a loss at why i need to flip the binormal/y coord
|
|
||||||
// to get a good view vector for parallax. Lighting works properly
|
|
||||||
// with the TS matrix as is... but parallax does not.
|
|
||||||
//
|
|
||||||
// Someone figure this out!
|
|
||||||
//
|
|
||||||
meta->addStatement( new GenOp( " @.y = -@.y;\r\n", outNegViewTS, outNegViewTS ) );
|
|
||||||
|
|
||||||
// If we have texture anim matrix the tangent
|
// If we have texture anim matrix the tangent
|
||||||
// space view vector may need to be rotated.
|
// space view vector may need to be rotated.
|
||||||
Var *texMat = (Var*)LangElement::find( "texMat" );
|
Var *texMat = (Var*)LangElement::find( "texMat" );
|
||||||
|
|
|
||||||
|
|
@ -67,8 +67,6 @@ LangElement * ShaderFeatureGLSL::setupTexSpaceMat( Vector<ShaderComponent*> &, /
|
||||||
{
|
{
|
||||||
if(dStricmp((char*)T->type, "vec4") == 0)
|
if(dStricmp((char*)T->type, "vec4") == 0)
|
||||||
meta->addStatement( new GenOp( " tSetMatrixRow(@, 1, cross( @, normalize(@) ) * @.w);\r\n", *texSpaceMat, T, N, T ) );
|
meta->addStatement( new GenOp( " tSetMatrixRow(@, 1, cross( @, normalize(@) ) * @.w);\r\n", *texSpaceMat, T, N, T ) );
|
||||||
else if(tangentW)
|
|
||||||
meta->addStatement( new GenOp( " tSetMatrixRow(@, 1, cross( @, normalize(@) ) * @);\r\n", *texSpaceMat, T, N, tangentW ) );
|
|
||||||
else
|
else
|
||||||
meta->addStatement( new GenOp( " tSetMatrixRow(@, 1, cross( @, normalize(@) ));\r\n", *texSpaceMat, T, N ) );
|
meta->addStatement( new GenOp( " tSetMatrixRow(@, 1, cross( @, normalize(@) ));\r\n", *texSpaceMat, T, N ) );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -323,14 +323,6 @@ void ParallaxFeatHLSL::processVert( Vector<ShaderComponent*> &componentList,
|
||||||
meta->addStatement( new GenOp( " @ = mul( @, float3( @.xyz - @ ) );\r\n",
|
meta->addStatement( new GenOp( " @ = mul( @, float3( @.xyz - @ ) );\r\n",
|
||||||
outNegViewTS, objToTangentSpace, inPos, eyePos ) );
|
outNegViewTS, objToTangentSpace, inPos, eyePos ) );
|
||||||
|
|
||||||
// TODO: I'm at a loss at why i need to flip the binormal/y coord
|
|
||||||
// to get a good view vector for parallax. Lighting works properly
|
|
||||||
// with the TS matrix as is... but parallax does not.
|
|
||||||
//
|
|
||||||
// Someone figure this out!
|
|
||||||
//
|
|
||||||
meta->addStatement( new GenOp( " @.y = -@.y;\r\n", outNegViewTS, outNegViewTS ) );
|
|
||||||
|
|
||||||
// If we have texture anim matrix the tangent
|
// If we have texture anim matrix the tangent
|
||||||
// space view vector may need to be rotated.
|
// space view vector may need to be rotated.
|
||||||
Var *texMat = (Var*)LangElement::find( "texMat" );
|
Var *texMat = (Var*)LangElement::find( "texMat" );
|
||||||
|
|
|
||||||
|
|
@ -67,8 +67,6 @@ LangElement * ShaderFeatureHLSL::setupTexSpaceMat( Vector<ShaderComponent*> &, /
|
||||||
{
|
{
|
||||||
if(dStricmp((char*)T->type, "float4") == 0)
|
if(dStricmp((char*)T->type, "float4") == 0)
|
||||||
meta->addStatement( new GenOp( " @[1] = cross( @, normalize(@) ) * @.w;\r\n", *texSpaceMat, T, N, T ) );
|
meta->addStatement( new GenOp( " @[1] = cross( @, normalize(@) ) * @.w;\r\n", *texSpaceMat, T, N, T ) );
|
||||||
else if(tangentW)
|
|
||||||
meta->addStatement( new GenOp( " @[1] = cross( @, normalize(@) ) * @;\r\n", *texSpaceMat, T, N, tangentW ) );
|
|
||||||
else
|
else
|
||||||
meta->addStatement( new GenOp( " @[1] = cross( @, normalize(@) );\r\n", *texSpaceMat, T, N ) );
|
meta->addStatement( new GenOp( " @[1] = cross( @, normalize(@) );\r\n", *texSpaceMat, T, N ) );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue