mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-11 14:44:36 +00:00
Fix to allow parallax mapping with dxtnm textures via the red channel.
This commit is contained in:
parent
feec36731e
commit
3c56bf3a56
5 changed files with 52 additions and 8 deletions
|
|
@ -389,11 +389,9 @@ void ProcessedShaderMaterial::_determineFeatures( U32 stageNum,
|
|||
// cannot do on SM 2.0 and below.
|
||||
if ( shaderVersion > 2.0f )
|
||||
{
|
||||
// Only allow parallax if we have a normal map and
|
||||
// we're not using DXTnm compression.
|
||||
|
||||
if ( mMaterial->mParallaxScale[stageNum] > 0.0f &&
|
||||
fd.features[ MFT_NormalMap ] &&
|
||||
!fd.features[ MFT_IsDXTnm ] )
|
||||
fd.features[ MFT_NormalMap ] )
|
||||
fd.features.addFeature( MFT_Parallax );
|
||||
|
||||
// If not parallax then allow per-pixel specular if
|
||||
|
|
|
|||
|
|
@ -345,8 +345,16 @@ void ParallaxFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
Var *normalMap = getNormalMapTex();
|
||||
|
||||
// Call the library function to do the rest.
|
||||
meta->addStatement( new GenOp( " @.xy += parallaxOffset( @, @.xy, @, @ );\r\n",
|
||||
texCoord, normalMap, texCoord, negViewTS, parallaxInfo ) );
|
||||
if(fd.features.hasFeature( MFT_IsDXTnm, getProcessIndex() ))
|
||||
{
|
||||
meta->addStatement( new GenOp( " @.xy += parallaxOffsetDxtnm( @, @.xy, @, @ );\r\n",
|
||||
texCoord, normalMap, texCoord, negViewTS, parallaxInfo ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
meta->addStatement( new GenOp( " @.xy += parallaxOffset( @, @.xy, @, @ );\r\n",
|
||||
texCoord, normalMap, texCoord, negViewTS, parallaxInfo ) );
|
||||
}
|
||||
|
||||
// TODO: Fix second UV maybe?
|
||||
|
||||
|
|
|
|||
|
|
@ -456,8 +456,16 @@ void TerrainDetailMapFeatHLSL::processPix( Vector<ShaderComponent*> &component
|
|||
Var *normalMap = _getNormalMapTex();
|
||||
|
||||
// Call the library function to do the rest.
|
||||
meta->addStatement( new GenOp( " @.xy += parallaxOffset( @, @.xy, @, @.z * @ );\r\n",
|
||||
inDet, normalMap, inDet, negViewTS, detailInfo, detailBlend ) );
|
||||
if(fd.features.hasFeature( MFT_IsDXTnm, detailIndex ) )
|
||||
{
|
||||
meta->addStatement( new GenOp( " @.xy += parallaxOffsetDxtnm( @, @.xy, @, @.z * @ );\r\n",
|
||||
inDet, normalMap, inDet, negViewTS, detailInfo, detailBlend ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
meta->addStatement( new GenOp( " @.xy += parallaxOffset( @, @.xy, @, @.z * @ );\r\n",
|
||||
inDet, normalMap, inDet, negViewTS, detailInfo, detailBlend ) );
|
||||
}
|
||||
}
|
||||
|
||||
// If this is a prepass then we skip color.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue