strip out unused pixspecular to cut down on sources of confusion

This commit is contained in:
AzaezelX 2019-05-05 20:10:14 -05:00
parent 8d2d357948
commit 54cf07fa94
22 changed files with 12 additions and 534 deletions

View file

@ -60,7 +60,6 @@ void AdvancedLightingFeatures::registerFeatures( const GFXFormat &deferredTarget
FEATUREMGR->registerFeature(MFT_DeferredConditioner, cond);
FEATUREMGR->registerFeature(MFT_RTLighting, new DeferredRTLightingFeatGLSL());
FEATUREMGR->registerFeature(MFT_NormalMap, new DeferredBumpFeatGLSL());
FEATUREMGR->registerFeature(MFT_PixSpecular, new DeferredPixelSpecularGLSL());
FEATUREMGR->registerFeature(MFT_MinnaertShading, new DeferredMinnaertGLSL());
FEATUREMGR->registerFeature(MFT_SubSurface, new DeferredSubSurfaceGLSL());
FEATUREMGR->registerFeature(MFT_ReflectionProbes, new ReflectionProbeFeatGLSL);
@ -73,7 +72,6 @@ void AdvancedLightingFeatures::registerFeatures( const GFXFormat &deferredTarget
FEATUREMGR->registerFeature(MFT_DeferredConditioner, cond);
FEATUREMGR->registerFeature(MFT_RTLighting, new DeferredRTLightingFeatHLSL());
FEATUREMGR->registerFeature(MFT_NormalMap, new DeferredBumpFeatHLSL());
FEATUREMGR->registerFeature(MFT_PixSpecular, new DeferredPixelSpecularHLSL());
FEATUREMGR->registerFeature(MFT_MinnaertShading, new DeferredMinnaertHLSL());
FEATUREMGR->registerFeature(MFT_SubSurface, new DeferredSubSurfaceHLSL());
FEATUREMGR->registerFeature(MFT_ReflectionProbes, new ReflectionProbeFeatHLSL);
@ -96,7 +94,6 @@ void AdvancedLightingFeatures::unregisterFeatures()
FEATUREMGR->unregisterFeature(MFT_DeferredConditioner);
FEATUREMGR->unregisterFeature(MFT_RTLighting);
FEATUREMGR->unregisterFeature(MFT_NormalMap);
FEATUREMGR->unregisterFeature(MFT_PixSpecular);
FEATUREMGR->unregisterFeature(MFT_MinnaertShading);
FEATUREMGR->unregisterFeature(MFT_SubSurface);

View file

@ -388,7 +388,7 @@ void DeferredBumpFeatGLSL::processPix( Vector<ShaderComponent*> &componentList,
Parent::processPix( componentList, fd );
return;
}
else if ( fd.features[MFT_PixSpecular] && !fd.features[MFT_SpecularMap] )
else if (!fd.features[MFT_SpecularMap] )
{
Var *bumpSample = (Var *)LangElement::find( "bumpSample" );
if( bumpSample == NULL )
@ -463,8 +463,7 @@ void DeferredBumpFeatGLSL::setTexData( Material::StageData &stageDat,
}
}
else if (!fd.features[MFT_Parallax] && !fd.features[MFT_SpecularMap] &&
( fd.features[MFT_DeferredConditioner] ||
fd.features[MFT_PixSpecular] ) )
( fd.features[MFT_DeferredConditioner]) )
{
passData.mTexType[ texIndex ] = Material::Bump;
passData.mSamplerNames[ texIndex ] = "bumpMap";
@ -481,112 +480,6 @@ void DeferredBumpFeatGLSL::setTexData( Material::StageData &stageDat,
}
void DeferredPixelSpecularGLSL::processVert( Vector<ShaderComponent*> &componentList,
const MaterialFeatureData &fd )
{
if( !fd.features[MFT_isDeferred] || !fd.features[MFT_RTLighting] )
{
Parent::processVert( componentList, fd );
return;
}
output = NULL;
}
void DeferredPixelSpecularGLSL::processPix( Vector<ShaderComponent*> &componentList,
const MaterialFeatureData &fd )
{
if( !fd.features[MFT_isDeferred] || !fd.features[MFT_RTLighting] )
{
Parent::processPix( componentList, fd );
return;
}
MultiLine *meta = new MultiLine;
Var *specular = new Var;
specular->setType( "float" );
specular->setName( "specular" );
LangElement * specDecl = new DecOp( specular );
Var *pbrConfig = (Var*)LangElement::find( "pbrConfig" );
if(pbrConfig == NULL)
{
pbrConfig = new Var;
pbrConfig->setType( "vec4" );
pbrConfig->setName( "pbrConfig" );
pbrConfig->uniform = true;
pbrConfig->constSortPos = cspPotentialPrimitive;
}
Var *smoothness = (Var*)LangElement::find("smoothness");
if (!smoothness)
{
smoothness = new Var("smoothness", "float");
// If the gloss map flag is set, than the specular power is in the alpha
// channel of the specular map
if (fd.features[MFT_GlossMap])
meta->addStatement(new GenOp(" @ = @.a;\r\n", new DecOp(smoothness), pbrConfig));
else
{
smoothness->uniform = true;
smoothness->constSortPos = cspPotentialPrimitive;
}
}
Var *metalness = (Var*)LangElement::find("metalness");
if (!metalness)
{
metalness = new Var("metalness", "float");
metalness->uniform = true;
metalness->constSortPos = cspPotentialPrimitive;
}
Var *lightInfoSamp = (Var *)LangElement::find( "lightInfoSample" );
Var *d_specular = (Var*)LangElement::find( "d_specular" );
Var *d_NL_Att = (Var*)LangElement::find( "d_NL_Att" );
AssertFatal( lightInfoSamp && d_specular && d_NL_Att,
"DeferredPixelSpecularGLSL::processPix - Something hosed the deferred features!" );
if (fd.features[MFT_AccuMap]) {
// change specularity where the accu texture is applied
Var *accuPlc = (Var*)LangElement::find("plc");
Var *accuSpecular = (Var*)LangElement::find("accuSpecular");
if (accuPlc != NULL && accuSpecular != NULL)
//d_specular = clamp(lerp( d_specular, accuSpecular * d_specular, plc.a), 0, 1)
meta->addStatement(new GenOp(" @ = clamp( lerp( @, @ * @, @.a), 0, 1);\r\n", d_specular, d_specular, accuSpecular, d_specular, accuPlc));
}
// (a^m)^n = a^(m*n)
meta->addStatement( new GenOp( " @ = pow( abs(@), max((@ / AL_ConstantSpecularPower),1.0f)) * @;\r\n",
specDecl, d_specular, smoothness, metalness));
LangElement *specMul = new GenOp( "vec4( @.rgb, 0 ) * @", pbrConfig, specular );
LangElement *final = specMul;
// We we have a normal map then mask the specular
if( !fd.features[MFT_SpecularMap] && fd.features[MFT_NormalMap] )
{
Var *bumpSample = (Var*)LangElement::find( "bumpSample" );
final = new GenOp( "@ * @.a", final, bumpSample );
}
// add to color
meta->addStatement( new GenOp( " @;\r\n", assignColor( final, Material::Add ) ) );
output = meta;
}
ShaderFeature::Resources DeferredPixelSpecularGLSL::getResources( const MaterialFeatureData &fd )
{
if( !fd.features[MFT_isDeferred] || !fd.features[MFT_RTLighting] )
return Parent::getResources( fd );
Resources res;
return res;
}
ShaderFeature::Resources DeferredMinnaertGLSL::getResources( const MaterialFeatureData &fd )
{
Resources res;

View file

@ -101,29 +101,6 @@ public:
}
};
/// Generates specular highlights in the forward pass
/// from the light deferred buffer.
class DeferredPixelSpecularGLSL : public PixelSpecularGLSL
{
typedef PixelSpecularGLSL Parent;
public:
virtual void processVert( Vector<ShaderComponent*> &componentList,
const MaterialFeatureData &fd );
virtual void processPix( Vector<ShaderComponent*> &componentList,
const MaterialFeatureData &fd );
virtual Resources getResources( const MaterialFeatureData &fd );
virtual String getName()
{
return "Pixel Specular [Deferred]";
}
};
///
class DeferredMinnaertGLSL : public ShaderFeatureGLSL
{
@ -167,4 +144,4 @@ public:
}
};
#endif // _DEFERREDFEATURESGLSL_H_
#endif // _DEFERREDFEATURESGLSL_H_

View file

@ -419,7 +419,7 @@ void DeferredBumpFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
Parent::processPix( componentList, fd );
return;
}
else if ( fd.features[MFT_PixSpecular] && !fd.features[MFT_SpecularMap] )
else if (!fd.features[MFT_SpecularMap] )
{
Var *bumpSample = (Var *)LangElement::find( "bumpSample" );
if( bumpSample == NULL )
@ -496,8 +496,7 @@ void DeferredBumpFeatHLSL::setTexData( Material::StageData &stageDat,
}
}
else if ( !fd.features[MFT_Parallax] && !fd.features[MFT_SpecularMap] &&
( fd.features[MFT_DeferredConditioner] ||
fd.features[MFT_PixSpecular] ) )
( fd.features[MFT_DeferredConditioner]) )
{
passData.mTexType[ texIndex ] = Material::Bump;
passData.mSamplerNames[ texIndex ] = "bumpMap";
@ -513,115 +512,6 @@ void DeferredBumpFeatHLSL::setTexData( Material::StageData &stageDat,
}
}
void DeferredPixelSpecularHLSL::processVert( Vector<ShaderComponent*> &componentList,
const MaterialFeatureData &fd )
{
if( !fd.features[MFT_isDeferred] || !fd.features[MFT_RTLighting] )
{
Parent::processVert( componentList, fd );
return;
}
output = NULL;
}
void DeferredPixelSpecularHLSL::processPix( Vector<ShaderComponent*> &componentList,
const MaterialFeatureData &fd )
{
if( !fd.features[MFT_isDeferred] || !fd.features[MFT_RTLighting] )
{
Parent::processPix( componentList, fd );
return;
}
MultiLine *meta = new MultiLine;
Var *specular = new Var;
specular->setType( "float" );
specular->setName( "specular" );
LangElement * specDecl = new DecOp( specular );
Var *pbrConfig = (Var*)LangElement::find( "pbrConfig" );
if(pbrConfig == NULL)
{
pbrConfig = new Var;
pbrConfig->setType( "float4" );
pbrConfig->setName( "pbrConfig" );
pbrConfig->uniform = true;
pbrConfig->constSortPos = cspPotentialPrimitive;
}
Var *smoothness = (Var*)LangElement::find("smoothness");
if (!smoothness)
{
smoothness = new Var("smoothness", "float");
// If the gloss map flag is set, than the specular power is in the alpha
// channel of the specular map
if (fd.features[MFT_GlossMap])
meta->addStatement(new GenOp(" @ = @.a;\r\n", new DecOp(smoothness), pbrConfig));
else
{
smoothness->uniform = true;
smoothness->constSortPos = cspPotentialPrimitive;
}
}
Var *metalness = (Var*)LangElement::find("metalness");
if (!metalness)
{
metalness = new Var("metalness", "float");
metalness->uniform = true;
metalness->constSortPos = cspPotentialPrimitive;
}
Var *lightInfoSamp = (Var *)LangElement::find( "lightInfoSample" );
Var *d_specular = (Var*)LangElement::find( "d_specular" );
Var *d_NL_Att = (Var*)LangElement::find( "d_NL_Att" );
AssertFatal( lightInfoSamp && d_specular && d_NL_Att,
"DeferredPixelSpecularHLSL::processPix - Something hosed the deferred features!" );
if (fd.features[ MFT_AccuMap ])
{
// change specularity where the accu texture is applied
Var *accuPlc = (Var*) LangElement::find( "plc" );
Var *accuSpecular = (Var*)LangElement::find( "accuSpecular" );
if(accuPlc != NULL && accuSpecular != NULL)
//d_specular = clamp(lerp( d_specular, accuSpecular * d_specular, plc.a), 0, 1)
meta->addStatement( new GenOp( " @ = clamp( lerp( @, @ * @, @.a), 0, 1);\r\n", d_specular, d_specular, accuSpecular, d_specular, accuPlc ) );
}
// (a^m)^n = a^(m*n)
meta->addStatement( new GenOp( " @ = pow( abs(@), max((@ / AL_ConstantSpecularPower),1.0f)) * @;\r\n",
specDecl, d_specular, smoothness, metalness));
LangElement *specMul = new GenOp( "float4( @.rgb, 0 ) * @", pbrConfig, specular );
LangElement *final = specMul;
// We we have a normal map then mask the specular
if( !fd.features[MFT_SpecularMap] && fd.features[MFT_NormalMap] )
{
Var *bumpSample = (Var*)LangElement::find( "bumpSample" );
final = new GenOp( "@ * @.a", final, bumpSample );
}
// add to color
meta->addStatement( new GenOp( " @;\r\n", assignColor( final, Material::Add ) ) );
output = meta;
}
ShaderFeature::Resources DeferredPixelSpecularHLSL::getResources( const MaterialFeatureData &fd )
{
if( !fd.features[MFT_isDeferred] || !fd.features[MFT_RTLighting] )
return Parent::getResources( fd );
Resources res;
return res;
}
ShaderFeature::Resources DeferredMinnaertHLSL::getResources( const MaterialFeatureData &fd )
{
Resources res;

View file

@ -102,28 +102,6 @@ public:
};
/// Generates specular highlights in the forward pass
/// from the light deferred buffer.
class DeferredPixelSpecularHLSL : public PixelSpecularHLSL
{
typedef PixelSpecularHLSL Parent;
public:
virtual void processVert( Vector<ShaderComponent*> &componentList,
const MaterialFeatureData &fd );
virtual void processPix( Vector<ShaderComponent*> &componentList,
const MaterialFeatureData &fd );
virtual Resources getResources( const MaterialFeatureData &fd );
virtual String getName()
{
return "Pixel Specular [Deferred]";
}
};
///
class DeferredMinnaertHLSL : public ShaderFeatureHLSL
{
@ -167,4 +145,4 @@ public:
}
};
#endif // _DEFERREDFEATURESHLSL_H_
#endif // _DEFERREDFEATURESHLSL_H_

View file

@ -167,7 +167,6 @@ void BasicLightManager::activate( SceneManager *sceneManager )
FEATUREMGR->registerFeature( MFT_ToneMap, new TonemapFeatGLSL );
FEATUREMGR->registerFeature( MFT_NormalMap, new BumpFeatGLSL );
FEATUREMGR->registerFeature( MFT_RTLighting, new RTLightingFeatGLSL );
FEATUREMGR->registerFeature( MFT_PixSpecular, new PixelSpecularGLSL );
FEATUREMGR->registerFeature(MFT_ReflectionProbes, new ReflectionProbeFeatGLSL);
#endif
}
@ -178,7 +177,6 @@ void BasicLightManager::activate( SceneManager *sceneManager )
FEATUREMGR->registerFeature( MFT_ToneMap, new TonemapFeatHLSL );
FEATUREMGR->registerFeature( MFT_NormalMap, new BumpFeatHLSL );
FEATUREMGR->registerFeature( MFT_RTLighting, new RTLightingFeatHLSL );
FEATUREMGR->registerFeature( MFT_PixSpecular, new PixelSpecularHLSL );
FEATUREMGR->registerFeature(MFT_ReflectionProbes, new ReflectionProbeFeatHLSL);
#endif
}

View file

@ -583,6 +583,7 @@ void MatInstance::dumpShaderInfo() const
Con::printf( "Material Info for object %s - %s", mMaterial->getName(), mMaterial->mMapTo.c_str() );
if ( mProcessedMaterial == NULL )
{
Con::printf( " [no processed material!]" );

View file

@ -120,8 +120,7 @@ Material::Material()
mSmoothness[i] = 0.0f;
mMetalness[i] = 0.0f;
mPixelSpecular[i] = false;
mIsSRGb[i] = false;
mIsSRGb[i] = false;
mInvertSmoothness[i] = false;
mSmoothnessChan[i] = 0;

View file

@ -237,9 +237,7 @@ public:
F32 mSmoothness[MAX_STAGES];
F32 mMetalness[MAX_STAGES];
bool mPixelSpecular[MAX_STAGES];
bool mVertLit[MAX_STAGES];
/// If true for a stage, vertex colors are multiplied

View file

@ -56,7 +56,6 @@ ImplementFeatureType( MFT_RTLighting, MFG_Lighting, 2.0f, true );
ImplementFeatureType( MFT_LightMap, MFG_Lighting, 3.0f, true );
ImplementFeatureType( MFT_ToneMap, MFG_Lighting, 4.0f, true );
ImplementFeatureType( MFT_VertLitTone, MFG_Lighting, 5.0f, false );
ImplementFeatureType( MFT_PixSpecular, MFG_Lighting, 6.0f, true );
ImplementFeatureType( MFT_StaticCubemap, U32(-1), -1.0, true );
ImplementFeatureType( MFT_CubeMap, MFG_Lighting, 7.0f, true );
ImplementFeatureType( MFT_SubSurface, MFG_Lighting, 8.0f, true );

View file

@ -124,7 +124,6 @@ DeclareFeatureType( MFT_VertLitTone );
DeclareFeatureType( MFT_StaticCubemap );
DeclareFeatureType( MFT_CubeMap );
DeclareFeatureType( MFT_PixSpecular );
DeclareFeatureType( MFT_InvertSmoothness );
DeclareFeatureType( MFT_SpecularMap );
DeclareFeatureType( MFT_GlossMap );

View file

@ -84,8 +84,6 @@ MaterialManager::MaterialManager()
Con::NotifyDelegate callabck2( this, &MaterialManager::_onDisableMaterialFeature );
Con::setVariable( "$pref::Video::disableNormalMapping", "false" );
Con::addVariableNotify( "$pref::Video::disableNormalMapping", callabck2 );
Con::setVariable( "$pref::Video::disablePixSpecular", "false" );
Con::addVariableNotify( "$pref::Video::disablePixSpecular", callabck2 );
Con::setVariable( "$pref::Video::disableCubemapping", "false" );
Con::addVariableNotify( "$pref::Video::disableCubemapping", callabck2 );
Con::setVariable( "$pref::Video::disableParallaxMapping", "false" );
@ -417,12 +415,6 @@ void MaterialManager::recalcFeaturesFromPrefs()
mExclusionFeatures.setFeature( MFT_NormalMap,
Con::getBoolVariable( "$pref::Video::disableNormalMapping", false ) );
mExclusionFeatures.setFeature( MFT_SpecularMap,
Con::getBoolVariable( "$pref::Video::disablePixSpecular", false ) );
mExclusionFeatures.setFeature( MFT_PixSpecular,
Con::getBoolVariable( "$pref::Video::disablePixSpecular", false ) );
mExclusionFeatures.setFeature( MFT_CubeMap,
Con::getBoolVariable( "$pref::Video::disableCubemapping", false ) );

View file

@ -136,11 +136,7 @@ U32 ProcessedFFMaterial::getNumStages()
// stage is active.
if ( mStages[i].hasValidTex() )
stageActive = true;
// If this stage has specular lighting, it's active
if ( mMaterial->mPixelSpecular[i] )
stageActive = true;
// If we have a Material that is vertex lit
// then it may not have a texture
if( mMaterial->mVertLit[i] )

View file

@ -267,11 +267,7 @@ U32 ProcessedShaderMaterial::getNumStages()
// stage is active.
if ( mStages[i].hasValidTex() )
stageActive = true;
// If this stage has specular lighting, it's active
if ( mMaterial->mPixelSpecular[i] )
stageActive = true;
// If this stage has diffuse color, it's active
if ( mMaterial->mDiffuse[i].alpha > 0 &&
mMaterial->mDiffuse[i] != LinearColorF::WHITE )
@ -424,12 +420,6 @@ void ProcessedShaderMaterial::_determineFeatures( U32 stageNum,
if ( mMaterial->mParallaxScale[stageNum] > 0.0f &&
fd.features[ MFT_NormalMap ] )
fd.features.addFeature( MFT_Parallax );
// If not parallax then allow per-pixel specular if
// we have real time lighting enabled.
else if ( fd.features[MFT_RTLighting] &&
mMaterial->mPixelSpecular[stageNum] )
fd.features.addFeature( MFT_PixSpecular );
}
// Without realtime lighting and on lower end
@ -441,8 +431,6 @@ void ProcessedShaderMaterial::_determineFeatures( U32 stageNum,
// have per-pixel specular enabled.
if( fd.features[ MFT_SpecularMap ] )
{
fd.features.addFeature( MFT_PixSpecular );
// Check for an alpha channel on the specular map. If it has one (and it
// has values less than 255) than the artist has put the gloss map into
// the alpha channel.

View file

@ -794,11 +794,7 @@ U32 ProcessedDeferredMaterial::getNumStages()
// stage is active.
if ( mStages[i].hasValidTex() )
stageActive = true;
// If this stage has specular lighting, it's active
if ( mMaterial->mPixelSpecular[i] )
stageActive = true;
// If this stage has diffuse color, it's active
if ( mMaterial->mDiffuse[i].alpha > 0 &&
mMaterial->mDiffuse[i] != LinearColorF::WHITE )

View file

@ -29,88 +29,6 @@
#include "gfx/gfxStructs.h"
#include "shaderGen/shaderGen.h"
PixelSpecularGLSL::PixelSpecularGLSL()
: mDep(ShaderGen::smCommonShaderPath + String("/gl/lighting.glsl" ))
{
addDependency( &mDep );
}
void PixelSpecularGLSL::processVert( Vector<ShaderComponent*> &componentList,
const MaterialFeatureData &fd )
{
AssertFatal( fd.features[MFT_RTLighting],
"PixelSpecularHLSL requires RTLighting to be enabled!" );
// Nothing to do here... MFT_RTLighting should have
// taken care of passing everything to the pixel shader.
}
void PixelSpecularGLSL::processPix( Vector<ShaderComponent*> &componentList,
const MaterialFeatureData &fd )
{
AssertFatal( fd.features[MFT_RTLighting],
"PixelSpecularHLSL requires RTLighting to be enabled!" );
// RTLighting should have spit out the 4 specular
// powers for the 4 potential lights on this pass.
//
// This can sometimes be NULL if RTLighting skips out
// on us for lightmaps or missing normals.
Var *specular = (Var*)LangElement::find( "specular" );
if ( !specular )
return;
MultiLine *meta = new MultiLine;
LangElement *specMul = new GenOp( "@", specular );
LangElement *final = specMul;
// mask out with lightmap if present
if ( fd.features[MFT_LightMap] )
{
LangElement *lmColor = NULL;
// find lightmap color
lmColor = LangElement::find( "lmColor" );
if ( !lmColor )
{
LangElement * lightMap = LangElement::find( "lightMap" );
LangElement * lmCoord = LangElement::find( "texCoord2" );
lmColor = new GenOp( "texture(@, @)", lightMap, lmCoord );
}
final = new GenOp( "@ * vec4(@.rgb,0)", specMul, lmColor );
}
// If we have a normal map then mask the specular
if ( fd.features[MFT_SpecularMap] )
{
Var *pbrConfig = (Var*)LangElement::find( "PBRConfig" );
if (pbrConfig)
final = new GenOp( "@ * @", final, pbrConfig);
}
else if ( fd.features[MFT_NormalMap] && !fd.features[MFT_IsBC3nm] && !fd.features[MFT_IsBC5nm])
{
Var *bumpColor = (Var*)LangElement::find( "bumpNormal" );
final = new GenOp( "@ * @.a", final, bumpColor );
}
// Add the specular to the final color.
// search for color var
Var *color = (Var*)LangElement::find( "col" );
meta->addStatement( new GenOp( " @.rgb += ( @ ).rgb;\r\n", color, final ) );
output = meta;
}
ShaderFeature::Resources PixelSpecularGLSL::getResources( const MaterialFeatureData &fd )
{
Resources res;
return res;
}
void SpecularMapGLSL::processVert(Vector<ShaderComponent*> &componentList, const MaterialFeatureData &fd)
{
MultiLine *meta = new MultiLine;

View file

@ -27,32 +27,6 @@
#include "shaderGen/GLSL/shaderFeatureGLSL.h"
#endif
/// A per-pixel specular feature.
class PixelSpecularGLSL : public ShaderFeatureGLSL
{
protected:
ShaderIncludeDependency mDep;
public:
PixelSpecularGLSL();
virtual void processVert( Vector<ShaderComponent*> &componentList,
const MaterialFeatureData &fd );
virtual void processPix( Vector<ShaderComponent*> &componentList,
const MaterialFeatureData &fd );
virtual Resources getResources( const MaterialFeatureData &fd );
virtual String getName()
{
return "Pixel Specular";
}
};
/// A texture source for the PixSpecular feature
class SpecularMapGLSL : public ShaderFeatureGLSL
{

View file

@ -65,7 +65,6 @@ void _initShaderGenGLSL( ShaderGen *shaderGen )
FEATUREMGR->registerFeature( MFT_DetailMap, new DetailFeatGLSL );
FEATUREMGR->registerFeature( MFT_StaticCubemap, new NamedFeatureGLSL( "Static Cubemap" ) );
FEATUREMGR->registerFeature( MFT_CubeMap, new ReflectCubeFeatGLSL );
FEATUREMGR->registerFeature( MFT_PixSpecular, new PixelSpecularGLSL );
FEATUREMGR->registerFeature( MFT_InvertSmoothness, new NamedFeatureGLSL("Roughest = 1.0"));
FEATUREMGR->registerFeature( MFT_SpecularMap, new SpecularMapGLSL );
FEATUREMGR->registerFeature( MFT_AccuMap, new AccuTexFeatGLSL );

View file

@ -29,92 +29,6 @@
#include "gfx/gfxStructs.h"
#include "shaderGen/shaderGen.h"
PixelSpecularHLSL::PixelSpecularHLSL()
: mDep(ShaderGen::smCommonShaderPath + String("/lighting.hlsl" ))
{
addDependency( &mDep );
}
void PixelSpecularHLSL::processVert( Vector<ShaderComponent*> &componentList,
const MaterialFeatureData &fd )
{
AssertFatal( fd.features[MFT_RTLighting],
"PixelSpecularHLSL requires RTLighting to be enabled!" );
// Nothing to do here... MFT_RTLighting should have
// taken care of passing everything to the pixel shader.
}
void PixelSpecularHLSL::processPix( Vector<ShaderComponent*> &componentList,
const MaterialFeatureData &fd )
{
AssertFatal( fd.features[MFT_RTLighting],
"PixelSpecularHLSL requires RTLighting to be enabled!" );
// RTLighting should have spit out the 4 specular
// powers for the 4 potential lights on this pass.
//
// This can sometimes be NULL if RTLighting skips out
// on us for lightmaps or missing normals.
Var *specular = (Var*)LangElement::find( "specular" );
if ( !specular )
return;
MultiLine *meta = new MultiLine;
LangElement *specMul = new GenOp( "@", specular );
LangElement *final = specMul;
// mask out with lightmap if present
if ( fd.features[MFT_LightMap] )
{
LangElement *lmColor = NULL;
// find lightmap color
lmColor = LangElement::find( "lmColor" );
if ( !lmColor )
{
LangElement * lightMap = LangElement::find( "lightMap" );
LangElement * lmCoord = LangElement::find( "texCoord2" );
LangElement * lightMapTex = LangElement::find("lightMapTex"); //used only DX11 shaders
if (lightMapTex)
lmColor = new GenOp("@.Sample(@, @)", lightMapTex, lightMap, lmCoord);
else
lmColor = new GenOp("tex2D(@, @)", lightMap, lmCoord);
}
final = new GenOp( "@ * float4(@.rgb,0)", specMul, lmColor );
}
// If we have a normal map then mask the specular
if ( fd.features[MFT_SpecularMap] )
{
Var *pbrConfig = (Var*)LangElement::find( "PBRConfig" );
if (pbrConfig)
final = new GenOp( "@ * @", final, pbrConfig);
}
else if ( fd.features[MFT_NormalMap] && !fd.features[MFT_IsBC3nm] && !fd.features[MFT_IsBC5nm])
{
Var *bumpColor = (Var*)LangElement::find( "bumpNormal" );
final = new GenOp( "@ * @.a", final, bumpColor );
}
// Add the specular to the final color.
// search for color var
Var *color = (Var*)LangElement::find( "col" );
meta->addStatement( new GenOp( " @.rgb += ( @ ).rgb;\r\n", color, final ) );
output = meta;
}
ShaderFeature::Resources PixelSpecularHLSL::getResources( const MaterialFeatureData &fd )
{
Resources res;
return res;
}
void SpecularMapHLSL::processVert(Vector<ShaderComponent*> &componentList, const MaterialFeatureData &fd)
{
MultiLine *meta = new MultiLine;

View file

@ -27,32 +27,6 @@
#include "shaderGen/HLSL/shaderFeatureHLSL.h"
#endif
/// A per-pixel specular feature.
class PixelSpecularHLSL : public ShaderFeatureHLSL
{
protected:
ShaderIncludeDependency mDep;
public:
PixelSpecularHLSL();
virtual void processVert( Vector<ShaderComponent*> &componentList,
const MaterialFeatureData &fd );
virtual void processPix( Vector<ShaderComponent*> &componentList,
const MaterialFeatureData &fd );
virtual Resources getResources( const MaterialFeatureData &fd );
virtual String getName()
{
return "Pixel Specular";
}
};
/// A texture source for the PixSpecular feature
class SpecularMapHLSL : public ShaderFeatureHLSL
{

View file

@ -2952,7 +2952,6 @@ void ReflectionProbeFeatHLSL::processVert(Vector<ShaderComponent*>& componentLis
{
MultiLine* meta = new MultiLine;
output = meta;
// Also output the worldToTanget transform which
// we use to create the world space normal.
getOutWorldToTangent(componentList, meta, fd);

View file

@ -65,7 +65,6 @@ void _initShaderGenHLSL( ShaderGen *shaderGen )
FEATUREMGR->registerFeature( MFT_StaticCubemap, new NamedFeatureHLSL( "Static Cubemap" ) );
FEATUREMGR->registerFeature( MFT_CubeMap, new ReflectCubeFeatHLSL );
FEATUREMGR->registerFeature( MFT_ReflectionProbes, new ReflectionProbeFeatHLSL);
FEATUREMGR->registerFeature( MFT_PixSpecular, new PixelSpecularHLSL );
FEATUREMGR->registerFeature( MFT_InvertSmoothness, new NamedFeatureHLSL( "Roughest = 1.0" ) );
FEATUREMGR->registerFeature( MFT_IsTranslucent, new NamedFeatureHLSL( "Translucent" ) );
FEATUREMGR->registerFeature( MFT_IsTranslucentZWrite, new NamedFeatureHLSL( "Translucent ZWrite" ) );