mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-20 03:45:26 +00:00
backend specularMap to PBRConfigMap alts.
left:
addField( "specularMap", TypeImageFilename, Offset(mPBRConfigMapFilename, Material), MAX_STAGES,
scripthook till last since that *will* break all current materials.
This commit is contained in:
parent
e621e362f4
commit
65cbf49c4a
24 changed files with 95 additions and 100 deletions
|
|
@ -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)");
|
||||
|
||||
|
|
|
|||
|
|
@ -237,9 +237,9 @@ public:
|
|||
|
||||
bool mIsSRGb[MAX_STAGES];
|
||||
bool mInvertSmoothness[MAX_STAGES];
|
||||
FileName mSpecularMapFilename[MAX_STAGES];
|
||||
StringTableEntry mSpecularMapAssetId[MAX_STAGES];
|
||||
AssetPtr<ImageAsset> mSpecularMapAsset[MAX_STAGES];
|
||||
FileName mPBRConfigMapFilename[MAX_STAGES];
|
||||
StringTableEntry mPBRConfigMapAssetId[MAX_STAGES];
|
||||
AssetPtr<ImageAsset> mPBRConfigMapAsset[MAX_STAGES];
|
||||
FileName mRoughMapFilename[MAX_STAGES];
|
||||
StringTableEntry mRoughMapAssetId[MAX_STAGES];
|
||||
AssetPtr<ImageAsset> mRoughMapAsset[MAX_STAGES];
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ void ShaderConstHandles::init( GFXShader *shader, Vector<CustomShaderFeatureData
|
|||
mDiffuseColorSC = shader->getShaderConstHandle("$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 );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ public:
|
|||
GFXShaderConstHandle* mDiffuseColorSC;
|
||||
GFXShaderConstHandle* mToneMapTexSC;
|
||||
GFXShaderConstHandle* mTexMatSC;
|
||||
GFXShaderConstHandle* mSpecularColorSC;
|
||||
GFXShaderConstHandle* mPBRConfigSC;
|
||||
GFXShaderConstHandle* mSmoothnessSC;
|
||||
GFXShaderConstHandle* mMetalnessSC;
|
||||
GFXShaderConstHandle* mParallaxInfoSC;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue