From 65cbf49c4acf4aefa88e50d0bcec6fb5ec3655b9 Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Wed, 16 Oct 2019 15:51:02 -0500 Subject: [PATCH] backend specularMap to PBRConfigMap alts. left: addField( "specularMap", TypeImageFilename, Offset(mPBRConfigMapFilename, Material), MAX_STAGES, scripthook till last since that *will* break all current materials. --- .../glsl/advancedLightingFeaturesGLSL.cpp | 6 +-- .../glsl/deferredShadingFeaturesGLSL.cpp | 18 ++++----- .../hlsl/advancedLightingFeaturesHLSL.cpp | 6 +-- .../hlsl/deferredShadingFeaturesHLSL.cpp | 32 ++++++++-------- .../source/materials/materialDefinition.cpp | 6 +-- Engine/source/materials/materialDefinition.h | 6 +-- .../source/materials/materialFeatureTypes.cpp | 2 +- .../source/materials/materialFeatureTypes.h | 2 +- Engine/source/materials/processedMaterial.cpp | 16 ++++---- .../materials/processedShaderMaterial.cpp | 8 ++-- .../materials/processedShaderMaterial.h | 2 +- .../renderInstance/renderDeferredMgr.cpp | 2 +- .../source/shaderGen/GLSL/pixSpecularGLSL.cpp | 26 ++++++------- .../source/shaderGen/GLSL/pixSpecularGLSL.h | 4 +- .../shaderGen/GLSL/shaderGenGLSLInit.cpp | 2 +- .../source/shaderGen/HLSL/pixSpecularHLSL.cpp | 38 +++++++++---------- .../source/shaderGen/HLSL/pixSpecularHLSL.h | 6 +-- .../shaderGen/HLSL/shaderFeatureHLSL.cpp | 2 +- .../shaderGen/HLSL/shaderGenHLSLInit.cpp | 2 +- Engine/source/shaderGen/shaderGenVars.cpp | 2 +- Engine/source/shaderGen/shaderGenVars.h | 2 +- .../source/ts/collada/colladaAppMaterial.cpp | 3 -- Engine/source/ts/collada/colladaAppMaterial.h | 1 - .../source/ts/collada/colladaShapeLoader.cpp | 1 - 24 files changed, 95 insertions(+), 100 deletions(-) diff --git a/Engine/source/lighting/advanced/glsl/advancedLightingFeaturesGLSL.cpp b/Engine/source/lighting/advanced/glsl/advancedLightingFeaturesGLSL.cpp index c0c769645..e5830a519 100644 --- a/Engine/source/lighting/advanced/glsl/advancedLightingFeaturesGLSL.cpp +++ b/Engine/source/lighting/advanced/glsl/advancedLightingFeaturesGLSL.cpp @@ -390,7 +390,7 @@ void DeferredBumpFeatGLSL::processPix( Vector &componentList, Parent::processPix( componentList, fd ); return; } - else if (!fd.features[MFT_SpecularMap] ) + else if (!fd.features[MFT_PBRConfigMap] ) { Var *bumpSample = (Var *)LangElement::find( "bumpSample" ); if( bumpSample == NULL ) @@ -421,7 +421,7 @@ ShaderFeature::Resources DeferredBumpFeatGLSL::getResources( const MaterialFeatu return Parent::getResources( fd ); Resources res; - if(!fd.features[MFT_SpecularMap]) + if(!fd.features[MFT_PBRConfigMap]) { res.numTex = 1; res.numTexReg = 1; @@ -464,7 +464,7 @@ void DeferredBumpFeatGLSL::setTexData( Material::StageData &stageDat, passData.mTexSlot[texIndex++].texObject = stageDat.getTex(MFT_DetailNormalMap); } } - else if (!fd.features[MFT_Parallax] && !fd.features[MFT_SpecularMap] && + else if (!fd.features[MFT_Parallax] && !fd.features[MFT_PBRConfigMap] && ( fd.features[MFT_DeferredConditioner]) ) { passData.mTexType[ texIndex ] = Material::Bump; diff --git a/Engine/source/lighting/advanced/glsl/deferredShadingFeaturesGLSL.cpp b/Engine/source/lighting/advanced/glsl/deferredShadingFeaturesGLSL.cpp index f63a646cf..e92bad5cd 100644 --- a/Engine/source/lighting/advanced/glsl/deferredShadingFeaturesGLSL.cpp +++ b/Engine/source/lighting/advanced/glsl/deferredShadingFeaturesGLSL.cpp @@ -56,13 +56,13 @@ void DeferredSpecMapGLSL::processPix( Vector &componentList, c } // create texture var - Var *specularMap = new Var; - specularMap->setType( "sampler2D" ); - specularMap->setName( "specularMap" ); - specularMap->uniform = true; - specularMap->sampler = true; - specularMap->constNum = Var::getTexUnitNum(); - LangElement *texOp = new GenOp( "tex2D(@, @)", specularMap, texCoord ); + Var *pbrConfigMap = new Var; + pbrConfigMap->setType( "sampler2D" ); + pbrConfigMap->setName( "PBRConfigMap" ); + pbrConfigMap->uniform = true; + pbrConfigMap->sampler = true; + pbrConfigMap->constNum = Var::getTexUnitNum(); + LangElement *texOp = new GenOp( "tex2D(@, @)", pbrConfigMap, texCoord ); Var *pbrConfig = (Var*)LangElement::find("PBRConfig"); if (!pbrConfig) pbrConfig = new Var("PBRConfig", "vec4"); @@ -97,11 +97,11 @@ void DeferredSpecMapGLSL::setTexData( Material::StageData &stageDat, RenderPassData &passData, U32 &texIndex ) { - GFXTextureObject *tex = stageDat.getTex( MFT_SpecularMap ); + GFXTextureObject *tex = stageDat.getTex(MFT_PBRConfigMap); if ( tex ) { passData.mTexType[ texIndex ] = Material::Standard; - passData.mSamplerNames[ texIndex ] = "specularMap"; + passData.mSamplerNames[ texIndex ] = "PBRConfigMap"; passData.mTexSlot[ texIndex++ ].texObject = tex; } } diff --git a/Engine/source/lighting/advanced/hlsl/advancedLightingFeaturesHLSL.cpp b/Engine/source/lighting/advanced/hlsl/advancedLightingFeaturesHLSL.cpp index 9b495e0ff..11718e3dd 100644 --- a/Engine/source/lighting/advanced/hlsl/advancedLightingFeaturesHLSL.cpp +++ b/Engine/source/lighting/advanced/hlsl/advancedLightingFeaturesHLSL.cpp @@ -421,7 +421,7 @@ void DeferredBumpFeatHLSL::processPix( Vector &componentList, Parent::processPix( componentList, fd ); return; } - else if (!fd.features[MFT_SpecularMap] ) + else if (!fd.features[MFT_PBRConfigMap] ) { Var *bumpSample = (Var *)LangElement::find( "bumpSample" ); if( bumpSample == NULL ) @@ -454,7 +454,7 @@ ShaderFeature::Resources DeferredBumpFeatHLSL::getResources( const MaterialFeatu return Parent::getResources( fd ); Resources res; - if(!fd.features[MFT_SpecularMap]) + if(!fd.features[MFT_PBRConfigMap]) { res.numTex = 1; res.numTexReg = 1; @@ -497,7 +497,7 @@ void DeferredBumpFeatHLSL::setTexData( Material::StageData &stageDat, passData.mTexSlot[ texIndex++ ].texObject = stageDat.getTex( MFT_DetailNormalMap ); } } - else if ( !fd.features[MFT_Parallax] && !fd.features[MFT_SpecularMap] && + else if ( !fd.features[MFT_Parallax] && !fd.features[MFT_PBRConfigMap] && ( fd.features[MFT_DeferredConditioner]) ) { passData.mTexType[ texIndex ] = Material::Bump; diff --git a/Engine/source/lighting/advanced/hlsl/deferredShadingFeaturesHLSL.cpp b/Engine/source/lighting/advanced/hlsl/deferredShadingFeaturesHLSL.cpp index 7840a4740..fb1a75995 100644 --- a/Engine/source/lighting/advanced/hlsl/deferredShadingFeaturesHLSL.cpp +++ b/Engine/source/lighting/advanced/hlsl/deferredShadingFeaturesHLSL.cpp @@ -56,20 +56,20 @@ void DeferredSpecMapHLSL::processPix( Vector &componentList, c } // create texture var - Var *specularMap = new Var; - specularMap->setType( "SamplerState" ); - specularMap->setName( "specularMap" ); - specularMap->uniform = true; - specularMap->sampler = true; - specularMap->constNum = Var::getTexUnitNum(); + Var * pbrConfigMap = new Var; + pbrConfigMap->setType( "SamplerState" ); + pbrConfigMap->setName( "PBRConfigMap" ); + pbrConfigMap->uniform = true; + pbrConfigMap->sampler = true; + pbrConfigMap->constNum = Var::getTexUnitNum(); - Var* specularMapTex = new Var; - specularMapTex->setName("specularMapTex"); - specularMapTex->setType("Texture2D"); - specularMapTex->uniform = true; - specularMapTex->texture = true; - specularMapTex->constNum = specularMap->constNum; - LangElement *texOp = new GenOp(" @.Sample(@, @)", specularMapTex, specularMap, texCoord); + Var* pbrConfigMapTex = new Var; + pbrConfigMapTex->setName("PBRConfigMapTex"); + pbrConfigMapTex->setType("Texture2D"); + pbrConfigMapTex->uniform = true; + pbrConfigMapTex->texture = true; + pbrConfigMapTex->constNum = pbrConfigMap->constNum; + LangElement *texOp = new GenOp(" @.Sample(@, @)", pbrConfigMapTex, pbrConfigMap, texCoord); Var * pbrConfig = (Var*)LangElement::find("pbrConfig"); if (!pbrConfig) pbrConfig = new Var("pbrConfig", "float4"); @@ -103,11 +103,11 @@ void DeferredSpecMapHLSL::setTexData( Material::StageData &stageDat, RenderPassData &passData, U32 &texIndex ) { - GFXTextureObject *tex = stageDat.getTex( MFT_SpecularMap ); + GFXTextureObject *tex = stageDat.getTex(MFT_PBRConfigMap); if ( tex ) { passData.mTexType[ texIndex ] = Material::Standard; - passData.mSamplerNames[ texIndex ] = "specularMap"; + passData.mSamplerNames[ texIndex ] = "PBRConfigMap"; passData.mTexSlot[ texIndex++ ].texObject = tex; } } @@ -200,4 +200,4 @@ void DeferredEmissiveHLSL::processPix(Vector &componentList, c } output = new GenOp("@ = float4(@.rgb,0);", sceneColorVar, diffuseTargetVar); -} \ No newline at end of file +} diff --git a/Engine/source/materials/materialDefinition.cpp b/Engine/source/materials/materialDefinition.cpp index b6c0cbfab..9d3b3430f 100644 --- a/Engine/source/materials/materialDefinition.cpp +++ b/Engine/source/materials/materialDefinition.cpp @@ -272,10 +272,10 @@ void Material::initPersistFields() "Used to scale the strength of the detail normal map when blended with the base normal map." ); addField("smoothness", TypeF32, Offset(mSmoothness, Material), MAX_STAGES, - "The degree of smoothness when not using a specularMap." ); + "The degree of smoothness when not using a PBRConfigMap." ); addField("metalness", TypeF32, Offset(mMetalness, Material), MAX_STAGES, - "The degree of Metalness when not using a specularMap." ); + "The degree of Metalness when not using a PBRConfigMap." ); addProtectedField( "accuEnabled", TYPEID< bool >(), Offset( mAccuEnabled, Material ), &_setAccuEnabled, &defaultProtectedGetFn, MAX_STAGES, "Accumulation texture." ); @@ -301,7 +301,7 @@ void Material::initPersistFields() addField("invertSmoothness", TypeBool, Offset(mInvertSmoothness, Material), MAX_STAGES, "Treat Smoothness as Roughness"); - addField( "specularMap", TypeImageFilename, Offset(mSpecularMapFilename, Material), MAX_STAGES, + addField( "specularMap", TypeImageFilename, Offset(mPBRConfigMapFilename, Material), MAX_STAGES, "Prepacked specular map texture. The RGB channels of this texture provide per-pixel reference values for: " "smoothness (R), Ambient Occlusion (G), and metalness(B)"); diff --git a/Engine/source/materials/materialDefinition.h b/Engine/source/materials/materialDefinition.h index 346218158..8250401c7 100644 --- a/Engine/source/materials/materialDefinition.h +++ b/Engine/source/materials/materialDefinition.h @@ -237,9 +237,9 @@ public: bool mIsSRGb[MAX_STAGES]; bool mInvertSmoothness[MAX_STAGES]; - FileName mSpecularMapFilename[MAX_STAGES]; - StringTableEntry mSpecularMapAssetId[MAX_STAGES]; - AssetPtr mSpecularMapAsset[MAX_STAGES]; + FileName mPBRConfigMapFilename[MAX_STAGES]; + StringTableEntry mPBRConfigMapAssetId[MAX_STAGES]; + AssetPtr mPBRConfigMapAsset[MAX_STAGES]; FileName mRoughMapFilename[MAX_STAGES]; StringTableEntry mRoughMapAssetId[MAX_STAGES]; AssetPtr mRoughMapAsset[MAX_STAGES]; diff --git a/Engine/source/materials/materialFeatureTypes.cpp b/Engine/source/materials/materialFeatureTypes.cpp index cb209d3e6..a1dc0ed80 100644 --- a/Engine/source/materials/materialFeatureTypes.cpp +++ b/Engine/source/materials/materialFeatureTypes.cpp @@ -44,7 +44,7 @@ ImplementFeatureType( MFT_DiffuseColor, MFG_Texture, 5.0f, true ); ImplementFeatureType( MFT_DiffuseVertColor, MFG_Texture, 6.0f, true ); ImplementFeatureType( MFT_AlphaTest, MFG_Texture, 7.0f, true ); ImplementFeatureType(MFT_InvertSmoothness, U32(-1), -1, true); -ImplementFeatureType( MFT_SpecularMap, MFG_Texture, 8.0f, true ); +ImplementFeatureType( MFT_PBRConfigMap, MFG_Texture, 8.0f, true ); ImplementFeatureType( MFT_NormalMap, MFG_Texture, 9.0f, true ); ImplementFeatureType( MFT_DetailNormalMap, MFG_Texture, 10.0f, true ); ImplementFeatureType( MFT_Imposter, U32(-1), -1, true ); diff --git a/Engine/source/materials/materialFeatureTypes.h b/Engine/source/materials/materialFeatureTypes.h index b5cbce2e6..b22413683 100644 --- a/Engine/source/materials/materialFeatureTypes.h +++ b/Engine/source/materials/materialFeatureTypes.h @@ -125,7 +125,7 @@ DeclareFeatureType( MFT_VertLitTone ); DeclareFeatureType( MFT_StaticCubemap ); DeclareFeatureType( MFT_CubeMap ); DeclareFeatureType( MFT_InvertSmoothness ); -DeclareFeatureType( MFT_SpecularMap ); +DeclareFeatureType( MFT_PBRConfigMap ); DeclareFeatureType( MFT_GlossMap ); DeclareFeatureType( MFT_ReflectionProbes ); diff --git a/Engine/source/materials/processedMaterial.cpp b/Engine/source/materials/processedMaterial.cpp index 3455257a6..abc330a14 100644 --- a/Engine/source/materials/processedMaterial.cpp +++ b/Engine/source/materials/processedMaterial.cpp @@ -472,12 +472,12 @@ void ProcessedMaterial::_setStageData() if (mMaterial->mIsSRGb[i]) profile = &GFXStaticTextureSRGBProfile; - // SpecularMap - if (mMaterial->mSpecularMapFilename[i].isNotEmpty()) + // PBRConfig + if (mMaterial->mPBRConfigMapFilename[i].isNotEmpty()) { - mStages[i].setTex(MFT_SpecularMap, _createTexture(mMaterial->mSpecularMapFilename[i], profile)); - if (!mStages[i].getTex(MFT_SpecularMap)) - mMaterial->logError("Failed to load specular map %s for stage %i", _getTexturePath(mMaterial->mSpecularMapFilename[i]).c_str(), i); + mStages[i].setTex(MFT_PBRConfigMap, _createTexture(mMaterial->mPBRConfigMapFilename[i], profile)); + if (!mStages[i].getTex(MFT_PBRConfigMap)) + mMaterial->logError("Failed to load specular map %s for stage %i", _getTexturePath(mMaterial->mPBRConfigMapFilename[i]).c_str(), i); } else { @@ -488,11 +488,11 @@ void ProcessedMaterial::_setStageData() inputKey[1] = mMaterial->mAOChan[i]; inputKey[2] = mMaterial->mMetalChan[i]; inputKey[3] = NULL; - mStages[i].setTex(MFT_SpecularMap, _createCompositeTexture(mMaterial->mRoughMapFilename[i], mMaterial->mAOMapFilename[i], + mStages[i].setTex(MFT_PBRConfigMap, _createCompositeTexture(mMaterial->mRoughMapFilename[i], mMaterial->mAOMapFilename[i], mMaterial->mMetalMapFilename[i], "", inputKey, profile)); - if (!mStages[i].getTex(MFT_SpecularMap)) - mMaterial->logError("Failed to load specular map %s for stage %i", _getTexturePath(mMaterial->mSpecularMapFilename[i]).c_str(), i); + if (!mStages[i].getTex(MFT_PBRConfigMap)) + mMaterial->logError("Failed to load specular map %s for stage %i", _getTexturePath(mMaterial->mPBRConfigMapFilename[i]).c_str(), i); } } } diff --git a/Engine/source/materials/processedShaderMaterial.cpp b/Engine/source/materials/processedShaderMaterial.cpp index 71dd22c09..dc07dc7d7 100644 --- a/Engine/source/materials/processedShaderMaterial.cpp +++ b/Engine/source/materials/processedShaderMaterial.cpp @@ -59,7 +59,7 @@ void ShaderConstHandles::init( GFXShader *shader, VectorgetShaderConstHandle("$diffuseMaterialColor"); mTexMatSC = shader->getShaderConstHandle(ShaderGenVars::texMat); mToneMapTexSC = shader->getShaderConstHandle(ShaderGenVars::toneMap); - mSpecularColorSC = shader->getShaderConstHandle(ShaderGenVars::specularColor); + mPBRConfigSC = shader->getShaderConstHandle(ShaderGenVars::pbrConfig); mSmoothnessSC = shader->getShaderConstHandle(ShaderGenVars::smoothness); mMetalnessSC = shader->getShaderConstHandle(ShaderGenVars::metalness); mAccuScaleSC = shader->getShaderConstHandle("$accuScale"); @@ -443,16 +443,16 @@ void ProcessedShaderMaterial::_determineFeatures( U32 stageNum, // Without realtime lighting and on lower end // shader models disable the specular map. if ( !fd.features[ MFT_RTLighting ] || shaderVersion == 2.0 ) - fd.features.removeFeature( MFT_SpecularMap ); + fd.features.removeFeature( MFT_PBRConfigMap ); // If we have a specular map then make sure we // have per-pixel specular enabled. - if( fd.features[ MFT_SpecularMap ] ) + if( fd.features[ MFT_PBRConfigMap ] ) { // 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. - if( mStages[stageNum].getTex( MFT_SpecularMap )->mHasTransparency ) + if( mStages[stageNum].getTex( MFT_PBRConfigMap )->mHasTransparency ) fd.features.addFeature( MFT_GlossMap ); } diff --git a/Engine/source/materials/processedShaderMaterial.h b/Engine/source/materials/processedShaderMaterial.h index e899137b4..c7e52368d 100644 --- a/Engine/source/materials/processedShaderMaterial.h +++ b/Engine/source/materials/processedShaderMaterial.h @@ -46,7 +46,7 @@ public: GFXShaderConstHandle* mDiffuseColorSC; GFXShaderConstHandle* mToneMapTexSC; GFXShaderConstHandle* mTexMatSC; - GFXShaderConstHandle* mSpecularColorSC; + GFXShaderConstHandle* mPBRConfigSC; GFXShaderConstHandle* mSmoothnessSC; GFXShaderConstHandle* mMetalnessSC; GFXShaderConstHandle* mParallaxInfoSC; diff --git a/Engine/source/renderInstance/renderDeferredMgr.cpp b/Engine/source/renderInstance/renderDeferredMgr.cpp index 22fe6164e..585a2d238 100644 --- a/Engine/source/renderInstance/renderDeferredMgr.cpp +++ b/Engine/source/renderInstance/renderDeferredMgr.cpp @@ -635,7 +635,7 @@ void ProcessedDeferredMaterial::_determineFeatures( U32 stageNum, newFeatures.addFeature(MFT_InvertSmoothness); // Deferred Shading : Specular - if( mStages[stageNum].getTex( MFT_SpecularMap ) ) + if( mStages[stageNum].getTex( MFT_PBRConfigMap ) ) { newFeatures.addFeature( MFT_DeferredSpecMap ); } diff --git a/Engine/source/shaderGen/GLSL/pixSpecularGLSL.cpp b/Engine/source/shaderGen/GLSL/pixSpecularGLSL.cpp index 59a291cc8..a28b78272 100644 --- a/Engine/source/shaderGen/GLSL/pixSpecularGLSL.cpp +++ b/Engine/source/shaderGen/GLSL/pixSpecularGLSL.cpp @@ -29,7 +29,7 @@ #include "gfx/gfxStructs.h" #include "shaderGen/shaderGen.h" -void SpecularMapGLSL::processVert(Vector &componentList, const MaterialFeatureData &fd) +void PBRConfigMapGLSL::processVert(Vector &componentList, const MaterialFeatureData &fd) { MultiLine *meta = new MultiLine; @@ -43,19 +43,19 @@ void SpecularMapGLSL::processVert(Vector &componentList, const output = meta; } -void SpecularMapGLSL::processPix( Vector &componentList, const MaterialFeatureData &fd ) +void PBRConfigMapGLSL::processPix( Vector &componentList, const MaterialFeatureData &fd ) { // Get the texture coord. Var *texCoord = getInTexCoord( "texCoord", "vec2", componentList ); // create texture var - Var *specularMap = new Var; - specularMap->setType( "sampler2D" ); - specularMap->setName( "specularMap" ); - specularMap->uniform = true; - specularMap->sampler = true; - specularMap->constNum = Var::getTexUnitNum(); - LangElement *texOp = new GenOp( "texture(@, @)", specularMap, texCoord ); + Var *pbrConfigMap = new Var; + pbrConfigMap->setType( "sampler2D" ); + pbrConfigMap->setName( "PBRConfigMap" ); + pbrConfigMap->uniform = true; + pbrConfigMap->sampler = true; + pbrConfigMap->constNum = Var::getTexUnitNum(); + LangElement *texOp = new GenOp( "texture(@, @)", pbrConfigMap, texCoord ); Var * pbrConfig = new Var( "PBRConfig", "vec4" ); Var *metalness = (Var*)LangElement::find("metalness"); @@ -74,23 +74,23 @@ void SpecularMapGLSL::processPix( Vector &componentList, const output = meta; } -ShaderFeature::Resources SpecularMapGLSL::getResources( const MaterialFeatureData &fd ) +ShaderFeature::Resources PBRConfigMapGLSL::getResources( const MaterialFeatureData &fd ) { Resources res; res.numTex = 1; return res; } -void SpecularMapGLSL::setTexData( Material::StageData &stageDat, +void PBRConfigMapGLSL::setTexData( Material::StageData &stageDat, const MaterialFeatureData &fd, RenderPassData &passData, U32 &texIndex ) { - GFXTextureObject *tex = stageDat.getTex( MFT_SpecularMap ); + GFXTextureObject *tex = stageDat.getTex( MFT_PBRConfigMap ); if ( tex ) { passData.mTexType[ texIndex ] = Material::Standard; - passData.mSamplerNames[ texIndex ] = "specularMap"; + passData.mSamplerNames[ texIndex ] = "PBRConfigMap"; passData.mTexSlot[ texIndex++ ].texObject = tex; } } diff --git a/Engine/source/shaderGen/GLSL/pixSpecularGLSL.h b/Engine/source/shaderGen/GLSL/pixSpecularGLSL.h index 7450c5286..7dc5f1397 100644 --- a/Engine/source/shaderGen/GLSL/pixSpecularGLSL.h +++ b/Engine/source/shaderGen/GLSL/pixSpecularGLSL.h @@ -28,7 +28,7 @@ #endif /// A texture source for the PixSpecular feature -class SpecularMapGLSL : public ShaderFeatureGLSL +class PBRConfigMapGLSL : public ShaderFeatureGLSL { public: @@ -47,7 +47,7 @@ public: virtual String getName() { - return "Specular Map"; + return "PBRConfig Map"; } }; diff --git a/Engine/source/shaderGen/GLSL/shaderGenGLSLInit.cpp b/Engine/source/shaderGen/GLSL/shaderGenGLSLInit.cpp index 026461038..82f14b63d 100644 --- a/Engine/source/shaderGen/GLSL/shaderGenGLSLInit.cpp +++ b/Engine/source/shaderGen/GLSL/shaderGenGLSLInit.cpp @@ -66,7 +66,7 @@ void _initShaderGenGLSL( ShaderGen *shaderGen ) FEATUREMGR->registerFeature( MFT_StaticCubemap, new NamedFeatureGLSL( "Static Cubemap" ) ); FEATUREMGR->registerFeature( MFT_CubeMap, new ReflectCubeFeatGLSL ); FEATUREMGR->registerFeature( MFT_InvertSmoothness, new NamedFeatureGLSL("Roughest = 1.0")); - FEATUREMGR->registerFeature( MFT_SpecularMap, new SpecularMapGLSL ); + FEATUREMGR->registerFeature( MFT_PBRConfigMap, new PBRConfigMapGLSL ); FEATUREMGR->registerFeature( MFT_AccuMap, new AccuTexFeatGLSL ); FEATUREMGR->registerFeature( MFT_GlossMap, new NamedFeatureGLSL( "Gloss Map" ) ); FEATUREMGR->registerFeature( MFT_IsTranslucent, new NamedFeatureGLSL( "Translucent" ) ); diff --git a/Engine/source/shaderGen/HLSL/pixSpecularHLSL.cpp b/Engine/source/shaderGen/HLSL/pixSpecularHLSL.cpp index f5f62da32..cdb50d147 100644 --- a/Engine/source/shaderGen/HLSL/pixSpecularHLSL.cpp +++ b/Engine/source/shaderGen/HLSL/pixSpecularHLSL.cpp @@ -29,7 +29,7 @@ #include "gfx/gfxStructs.h" #include "shaderGen/shaderGen.h" -void SpecularMapHLSL::processVert(Vector &componentList, const MaterialFeatureData &fd) +void PBRConfigMapHLSL::processVert(Vector &componentList, const MaterialFeatureData &fd) { MultiLine *meta = new MultiLine; @@ -43,26 +43,26 @@ void SpecularMapHLSL::processVert(Vector &componentList, const output = meta; } -void SpecularMapHLSL::processPix( Vector &componentList, const MaterialFeatureData &fd ) +void PBRConfigMapHLSL::processPix( Vector &componentList, const MaterialFeatureData &fd ) { // Get the texture coord. Var *texCoord = getInTexCoord("texCoord", "float2", componentList); // create texture var - Var *specularMap = new Var; - specularMap->setType( "SamplerState" ); - specularMap->setName( "specularMap" ); - specularMap->uniform = true; - specularMap->sampler = true; - specularMap->constNum = Var::getTexUnitNum(); + Var *pbrConfigMap = new Var; + pbrConfigMap->setType( "SamplerState" ); + pbrConfigMap->setName( "PBRConfigMap" ); + pbrConfigMap->uniform = true; + pbrConfigMap->sampler = true; + pbrConfigMap->constNum = Var::getTexUnitNum(); - Var *specularMapTex = new Var; - specularMapTex->setName("specularMapTex"); - specularMapTex->setType("Texture2D"); - specularMapTex->uniform = true; - specularMapTex->texture = true; - specularMapTex->constNum = specularMap->constNum; - LangElement *texOp = new GenOp("@.Sample(@, @)", specularMapTex, specularMap, texCoord); + Var *pbrConfigMapTex = new Var; + pbrConfigMapTex->setName("PBRConfigMapTex"); + pbrConfigMapTex->setType("Texture2D"); + pbrConfigMapTex->uniform = true; + pbrConfigMapTex->texture = true; + pbrConfigMapTex->constNum = pbrConfigMap->constNum; + LangElement *texOp = new GenOp("@.Sample(@, @)", pbrConfigMapTex, pbrConfigMap, texCoord); Var * pbrConfig = new Var( "PBRConfig", "float4" ); @@ -81,23 +81,23 @@ void SpecularMapHLSL::processPix( Vector &componentList, const output = meta; } -ShaderFeature::Resources SpecularMapHLSL::getResources( const MaterialFeatureData &fd ) +ShaderFeature::Resources PBRConfigMapHLSL::getResources( const MaterialFeatureData &fd ) { Resources res; res.numTex = 1; return res; } -void SpecularMapHLSL::setTexData( Material::StageData &stageDat, +void PBRConfigMapHLSL::setTexData( Material::StageData &stageDat, const MaterialFeatureData &fd, RenderPassData &passData, U32 &texIndex ) { - GFXTextureObject *tex = stageDat.getTex( MFT_SpecularMap ); + GFXTextureObject *tex = stageDat.getTex( MFT_PBRConfigMap ); if ( tex ) { passData.mTexType[ texIndex ] = Material::Standard; - passData.mSamplerNames[ texIndex ] = "specularMap"; + passData.mSamplerNames[ texIndex ] = "PBRConfigMap"; passData.mTexSlot[ texIndex++ ].texObject = tex; } } diff --git a/Engine/source/shaderGen/HLSL/pixSpecularHLSL.h b/Engine/source/shaderGen/HLSL/pixSpecularHLSL.h index 3e3825ffb..725e1085f 100644 --- a/Engine/source/shaderGen/HLSL/pixSpecularHLSL.h +++ b/Engine/source/shaderGen/HLSL/pixSpecularHLSL.h @@ -27,8 +27,8 @@ #include "shaderGen/HLSL/shaderFeatureHLSL.h" #endif -/// A texture source for the PixSpecular feature -class SpecularMapHLSL : public ShaderFeatureHLSL +/// A texture source for the PBRConfigMap feature +class PBRConfigMapHLSL : public ShaderFeatureHLSL { public: @@ -47,7 +47,7 @@ public: virtual String getName() { - return "Specular Map"; + return "PBRConfig Map"; } }; diff --git a/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp b/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp index 070096097..925d3a5f2 100644 --- a/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp +++ b/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp @@ -1304,7 +1304,7 @@ void LightmapFeatHLSL::processPix( Vector &componentList, lightMapTex->texture = true; lightMapTex->constNum = lightMap->constNum; - // argh, pixel specular should prob use this too + // argh, PBRConfigMap should prob use this too if( fd.features[MFT_NormalMap] ) { Var *lmColor = new Var; diff --git a/Engine/source/shaderGen/HLSL/shaderGenHLSLInit.cpp b/Engine/source/shaderGen/HLSL/shaderGenHLSLInit.cpp index dcdabc9e2..45d33d80e 100644 --- a/Engine/source/shaderGen/HLSL/shaderGenHLSLInit.cpp +++ b/Engine/source/shaderGen/HLSL/shaderGenHLSLInit.cpp @@ -70,7 +70,7 @@ void _initShaderGenHLSL( ShaderGen *shaderGen ) FEATUREMGR->registerFeature( MFT_IsTranslucentZWrite, new NamedFeatureHLSL( "Translucent ZWrite" ) ); FEATUREMGR->registerFeature( MFT_Visibility, new VisibilityFeatHLSL ); FEATUREMGR->registerFeature( MFT_Fog, new FogFeatHLSL ); - FEATUREMGR->registerFeature( MFT_SpecularMap, new SpecularMapHLSL ); + FEATUREMGR->registerFeature( MFT_PBRConfigMap, new PBRConfigMapHLSL ); FEATUREMGR->registerFeature( MFT_AccuMap, new AccuTexFeatHLSL ); FEATUREMGR->registerFeature( MFT_GlossMap, new NamedFeatureHLSL( "Gloss Map" ) ); FEATUREMGR->registerFeature( MFT_LightbufferMRT, new NamedFeatureHLSL( "Lightbuffer MRT" ) ); diff --git a/Engine/source/shaderGen/shaderGenVars.cpp b/Engine/source/shaderGen/shaderGenVars.cpp index 28df4b8dc..be80941a4 100644 --- a/Engine/source/shaderGen/shaderGenVars.cpp +++ b/Engine/source/shaderGen/shaderGenVars.cpp @@ -73,7 +73,7 @@ const String ShaderGenVars::vectorLightDirection("$vectorLightDirection"); const String ShaderGenVars::vectorLightColor("$vectorLightColor"); const String ShaderGenVars::vectorLightBrightness("$vectorLightBrightness"); -const String ShaderGenVars::specularColor("$specularColor"); +const String ShaderGenVars::pbrConfig("$pbrConfig"); const String ShaderGenVars::smoothness("$smoothness"); const String ShaderGenVars::metalness("$metalness"); diff --git a/Engine/source/shaderGen/shaderGenVars.h b/Engine/source/shaderGen/shaderGenVars.h index 1ebb7e1e0..679dacb59 100644 --- a/Engine/source/shaderGen/shaderGenVars.h +++ b/Engine/source/shaderGen/shaderGenVars.h @@ -85,7 +85,7 @@ struct ShaderGenVars const static String vectorLightColor; const static String vectorLightBrightness; - const static String specularColor; + const static String pbrConfig; const static String smoothness; const static String metalness; diff --git a/Engine/source/ts/collada/colladaAppMaterial.cpp b/Engine/source/ts/collada/colladaAppMaterial.cpp index bb5be2eec..17c1ae492 100644 --- a/Engine/source/ts/collada/colladaAppMaterial.cpp +++ b/Engine/source/ts/collada/colladaAppMaterial.cpp @@ -86,7 +86,6 @@ ColladaAppMaterial::ColladaAppMaterial(const domMaterial *pMat) // Get the , and elements const domProfile_COMMON* commonProfile = ColladaUtils::findEffectCommonProfile(effect); const domCommon_color_or_texture_type_complexType* domDiffuse = findEffectDiffuse(effect); - const domCommon_color_or_texture_type_complexType* domSpecular = findEffectSpecular(effect); // Wrap flags if (effectExt->wrapU) @@ -158,7 +157,6 @@ ColladaAppMaterial::ColladaAppMaterial(const domMaterial *pMat) // Get the paths for the various textures => Collada indirection at its finest! // ........ diffuseMap = getSamplerImagePath(effect, getTextureSampler(effect, domDiffuse)); - specularMap = getSamplerImagePath(effect, getTextureSampler(effect, domSpecular)); normalMap = getSamplerImagePath(effect, effectExt->bumpSampler); // Set the material name @@ -218,7 +216,6 @@ Material *ColladaAppMaterial::createMaterial(const Torque::Path& path) const newMat->mDiffuseMapFilename[0] = diffuseMap; newMat->mNormalMapFilename[0] = normalMap; - newMat->mSpecularMapFilename[0] = specularMap; newMat->mDiffuse[0] = diffuseColor; newMat->mSmoothness[0] = smoothness; diff --git a/Engine/source/ts/collada/colladaAppMaterial.h b/Engine/source/ts/collada/colladaAppMaterial.h index cd6f17897..624ecdee7 100644 --- a/Engine/source/ts/collada/colladaAppMaterial.h +++ b/Engine/source/ts/collada/colladaAppMaterial.h @@ -43,7 +43,6 @@ public: // Settings extracted from the Collada file, and optionally saved to materials.cs String diffuseMap; String normalMap; - String specularMap; LinearColorF diffuseColor; LinearColorF specularColor; diff --git a/Engine/source/ts/collada/colladaShapeLoader.cpp b/Engine/source/ts/collada/colladaShapeLoader.cpp index afb53fdaf..2942c4d12 100644 --- a/Engine/source/ts/collada/colladaShapeLoader.cpp +++ b/Engine/source/ts/collada/colladaShapeLoader.cpp @@ -499,7 +499,6 @@ void updateMaterialsScript(const Torque::Path &path, bool copyTextures = false) copySketchupTexture(path, mat->mDiffuseMapFilename[0]); copySketchupTexture(path, mat->mNormalMapFilename[0]); - copySketchupTexture(path, mat->mSpecularMapFilename[0]); } }