diff --git a/Engine/source/lighting/advanced/advancedLightingFeatures.cpp b/Engine/source/lighting/advanced/advancedLightingFeatures.cpp index 1a58c3431..4d765a5fe 100644 --- a/Engine/source/lighting/advanced/advancedLightingFeatures.cpp +++ b/Engine/source/lighting/advanced/advancedLightingFeatures.cpp @@ -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); diff --git a/Engine/source/lighting/advanced/glsl/advancedLightingFeaturesGLSL.cpp b/Engine/source/lighting/advanced/glsl/advancedLightingFeaturesGLSL.cpp index d55fbcd1c..ae36fe6d1 100644 --- a/Engine/source/lighting/advanced/glsl/advancedLightingFeaturesGLSL.cpp +++ b/Engine/source/lighting/advanced/glsl/advancedLightingFeaturesGLSL.cpp @@ -388,7 +388,7 @@ void DeferredBumpFeatGLSL::processPix( Vector &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 &componentList, - const MaterialFeatureData &fd ) -{ - if( !fd.features[MFT_isDeferred] || !fd.features[MFT_RTLighting] ) - { - Parent::processVert( componentList, fd ); - return; - } - output = NULL; -} - -void DeferredPixelSpecularGLSL::processPix( Vector &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; diff --git a/Engine/source/lighting/advanced/glsl/advancedLightingFeaturesGLSL.h b/Engine/source/lighting/advanced/glsl/advancedLightingFeaturesGLSL.h index f55dcbeb5..ffda4105b 100644 --- a/Engine/source/lighting/advanced/glsl/advancedLightingFeaturesGLSL.h +++ b/Engine/source/lighting/advanced/glsl/advancedLightingFeaturesGLSL.h @@ -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 &componentList, - const MaterialFeatureData &fd ); - - virtual void processPix( Vector &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_ \ No newline at end of file +#endif // _DEFERREDFEATURESGLSL_H_ diff --git a/Engine/source/lighting/advanced/hlsl/advancedLightingFeaturesHLSL.cpp b/Engine/source/lighting/advanced/hlsl/advancedLightingFeaturesHLSL.cpp index 6301e9f3e..cd963f32f 100644 --- a/Engine/source/lighting/advanced/hlsl/advancedLightingFeaturesHLSL.cpp +++ b/Engine/source/lighting/advanced/hlsl/advancedLightingFeaturesHLSL.cpp @@ -419,7 +419,7 @@ void DeferredBumpFeatHLSL::processPix( Vector &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 &componentList, - const MaterialFeatureData &fd ) -{ - if( !fd.features[MFT_isDeferred] || !fd.features[MFT_RTLighting] ) - { - Parent::processVert( componentList, fd ); - return; - } - output = NULL; -} - -void DeferredPixelSpecularHLSL::processPix( Vector &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; diff --git a/Engine/source/lighting/advanced/hlsl/advancedLightingFeaturesHLSL.h b/Engine/source/lighting/advanced/hlsl/advancedLightingFeaturesHLSL.h index 9d81a8104..8087516b2 100644 --- a/Engine/source/lighting/advanced/hlsl/advancedLightingFeaturesHLSL.h +++ b/Engine/source/lighting/advanced/hlsl/advancedLightingFeaturesHLSL.h @@ -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 &componentList, - const MaterialFeatureData &fd ); - - virtual void processPix( Vector &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_ \ No newline at end of file +#endif // _DEFERREDFEATURESHLSL_H_ diff --git a/Engine/source/lighting/basic/basicLightManager.cpp b/Engine/source/lighting/basic/basicLightManager.cpp index 903121fcc..9b13f023c 100644 --- a/Engine/source/lighting/basic/basicLightManager.cpp +++ b/Engine/source/lighting/basic/basicLightManager.cpp @@ -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 } diff --git a/Engine/source/materials/matInstance.cpp b/Engine/source/materials/matInstance.cpp index e242a2059..88a2e0353 100644 --- a/Engine/source/materials/matInstance.cpp +++ b/Engine/source/materials/matInstance.cpp @@ -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!]" ); diff --git a/Engine/source/materials/materialDefinition.cpp b/Engine/source/materials/materialDefinition.cpp index 8be75501f..bcec30202 100644 --- a/Engine/source/materials/materialDefinition.cpp +++ b/Engine/source/materials/materialDefinition.cpp @@ -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; diff --git a/Engine/source/materials/materialDefinition.h b/Engine/source/materials/materialDefinition.h index 1c15c79b8..143f3d1c2 100644 --- a/Engine/source/materials/materialDefinition.h +++ b/Engine/source/materials/materialDefinition.h @@ -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 diff --git a/Engine/source/materials/materialFeatureTypes.cpp b/Engine/source/materials/materialFeatureTypes.cpp index 0b5c76b1e..cb209d3e6 100644 --- a/Engine/source/materials/materialFeatureTypes.cpp +++ b/Engine/source/materials/materialFeatureTypes.cpp @@ -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 ); diff --git a/Engine/source/materials/materialFeatureTypes.h b/Engine/source/materials/materialFeatureTypes.h index d976b0054..b5cbce2e6 100644 --- a/Engine/source/materials/materialFeatureTypes.h +++ b/Engine/source/materials/materialFeatureTypes.h @@ -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 ); diff --git a/Engine/source/materials/materialManager.cpp b/Engine/source/materials/materialManager.cpp index 0f8519bb5..1980e401e 100644 --- a/Engine/source/materials/materialManager.cpp +++ b/Engine/source/materials/materialManager.cpp @@ -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 ) ); diff --git a/Engine/source/materials/processedFFMaterial.cpp b/Engine/source/materials/processedFFMaterial.cpp index 8f767eeb4..2ce79e127 100644 --- a/Engine/source/materials/processedFFMaterial.cpp +++ b/Engine/source/materials/processedFFMaterial.cpp @@ -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] ) diff --git a/Engine/source/materials/processedShaderMaterial.cpp b/Engine/source/materials/processedShaderMaterial.cpp index cb4cf7fee..73687cdf3 100644 --- a/Engine/source/materials/processedShaderMaterial.cpp +++ b/Engine/source/materials/processedShaderMaterial.cpp @@ -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. diff --git a/Engine/source/renderInstance/renderDeferredMgr.cpp b/Engine/source/renderInstance/renderDeferredMgr.cpp index aad88e115..d5035629b 100644 --- a/Engine/source/renderInstance/renderDeferredMgr.cpp +++ b/Engine/source/renderInstance/renderDeferredMgr.cpp @@ -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 ) diff --git a/Engine/source/shaderGen/GLSL/pixSpecularGLSL.cpp b/Engine/source/shaderGen/GLSL/pixSpecularGLSL.cpp index 8b5f0d473..59a291cc8 100644 --- a/Engine/source/shaderGen/GLSL/pixSpecularGLSL.cpp +++ b/Engine/source/shaderGen/GLSL/pixSpecularGLSL.cpp @@ -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 &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 &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 &componentList, const MaterialFeatureData &fd) { MultiLine *meta = new MultiLine; diff --git a/Engine/source/shaderGen/GLSL/pixSpecularGLSL.h b/Engine/source/shaderGen/GLSL/pixSpecularGLSL.h index b7a79f6fc..7450c5286 100644 --- a/Engine/source/shaderGen/GLSL/pixSpecularGLSL.h +++ b/Engine/source/shaderGen/GLSL/pixSpecularGLSL.h @@ -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 &componentList, - const MaterialFeatureData &fd ); - - virtual void processPix( Vector &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 { diff --git a/Engine/source/shaderGen/GLSL/shaderGenGLSLInit.cpp b/Engine/source/shaderGen/GLSL/shaderGenGLSLInit.cpp index 5353eac9e..026461038 100644 --- a/Engine/source/shaderGen/GLSL/shaderGenGLSLInit.cpp +++ b/Engine/source/shaderGen/GLSL/shaderGenGLSLInit.cpp @@ -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 ); diff --git a/Engine/source/shaderGen/HLSL/pixSpecularHLSL.cpp b/Engine/source/shaderGen/HLSL/pixSpecularHLSL.cpp index abb31b71e..f5f62da32 100644 --- a/Engine/source/shaderGen/HLSL/pixSpecularHLSL.cpp +++ b/Engine/source/shaderGen/HLSL/pixSpecularHLSL.cpp @@ -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 &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 &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 &componentList, const MaterialFeatureData &fd) { MultiLine *meta = new MultiLine; diff --git a/Engine/source/shaderGen/HLSL/pixSpecularHLSL.h b/Engine/source/shaderGen/HLSL/pixSpecularHLSL.h index 9f550e4ba..3e3825ffb 100644 --- a/Engine/source/shaderGen/HLSL/pixSpecularHLSL.h +++ b/Engine/source/shaderGen/HLSL/pixSpecularHLSL.h @@ -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 &componentList, - const MaterialFeatureData &fd ); - - virtual void processPix( Vector &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 { diff --git a/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp b/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp index baa00a3d6..3da4fe5ff 100644 --- a/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp +++ b/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp @@ -2952,7 +2952,6 @@ void ReflectionProbeFeatHLSL::processVert(Vector& 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); diff --git a/Engine/source/shaderGen/HLSL/shaderGenHLSLInit.cpp b/Engine/source/shaderGen/HLSL/shaderGenHLSLInit.cpp index c20cb5a8d..dcdabc9e2 100644 --- a/Engine/source/shaderGen/HLSL/shaderGenHLSLInit.cpp +++ b/Engine/source/shaderGen/HLSL/shaderGenHLSLInit.cpp @@ -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" ) );