more conversionwork from specular entries to pbrconfig ones, adds backend glowmul and glowmap var tracking, as well as pbrconfigmap composite slip-in for the glowmap (sans shaderfeatures just yet). seems to have busted forward lit application though...

This commit is contained in:
AzaezelX 2019-10-22 15:11:39 -05:00
parent 7daf66cf9d
commit bfccfca0ce
21 changed files with 68 additions and 387 deletions

View file

@ -25,7 +25,6 @@
#include "shaderGen/GLSL/shaderFeatureGLSL.h"
#include "shaderGen/GLSL/bumpGLSL.h"
#include "shaderGen/GLSL/pixSpecularGLSL.h"
class ConditionerMethodDependency;

View file

@ -36,9 +36,7 @@
// Deferred Shading Features
//****************************************************************************
// Specular Map -> Blue of Material Buffer ( greyscaled )
// Gloss Map (Alpha Channel of Specular Map) -> Alpha ( Spec Power ) of Material Info Buffer.
void DeferredSpecMapGLSL::processPix( Vector<ShaderComponent*> &componentList, const MaterialFeatureData &fd )
void PBRConfigMapGLSL::processPix( Vector<ShaderComponent*> &componentList, const MaterialFeatureData &fd )
{
// Get the texture coord.
Var *texCoord = getInTexCoord( "texCoord", "vec2", componentList );
@ -58,7 +56,7 @@ void DeferredSpecMapGLSL::processPix( Vector<ShaderComponent*> &componentList, c
// create texture var
Var *pbrConfigMap = new Var;
pbrConfigMap->setType( "sampler2D" );
pbrConfigMap->setName( "PBRConfigMap" );
pbrConfigMap->setName( "pbrConfigMap" );
pbrConfigMap->uniform = true;
pbrConfigMap->sampler = true;
pbrConfigMap->constNum = Var::getTexUnitNum();
@ -83,7 +81,7 @@ void DeferredSpecMapGLSL::processPix( Vector<ShaderComponent*> &componentList, c
output = meta;
}
ShaderFeature::Resources DeferredSpecMapGLSL::getResources( const MaterialFeatureData &fd )
ShaderFeature::Resources PBRConfigMapGLSL::getResources( const MaterialFeatureData &fd )
{
Resources res;
res.numTex = 1;
@ -92,7 +90,7 @@ ShaderFeature::Resources DeferredSpecMapGLSL::getResources( const MaterialFeatur
return res;
}
void DeferredSpecMapGLSL::setTexData( Material::StageData &stageDat,
void PBRConfigMapGLSL::setTexData( Material::StageData &stageDat,
const MaterialFeatureData &fd,
RenderPassData &passData,
U32 &texIndex )
@ -101,12 +99,12 @@ void DeferredSpecMapGLSL::setTexData( Material::StageData &stageDat,
if ( tex )
{
passData.mTexType[ texIndex ] = Material::Standard;
passData.mSamplerNames[ texIndex ] = "PBRConfigMap";
passData.mSamplerNames[ texIndex ] = "pbrConfigMap";
passData.mTexSlot[ texIndex++ ].texObject = tex;
}
}
void DeferredSpecMapGLSL::processVert( Vector<ShaderComponent*> &componentList,
void PBRConfigMapGLSL::processVert( Vector<ShaderComponent*> &componentList,
const MaterialFeatureData &fd )
{
MultiLine *meta = new MultiLine;
@ -146,7 +144,7 @@ void DeferredMatInfoFlagsGLSL::processPix( Vector<ShaderComponent*> &componentLi
// Spec Strength -> Blue Channel of Material Info Buffer.
// Spec Power -> Alpha Channel ( of Material Info Buffer.
void DeferredSpecVarsGLSL::processPix( Vector<ShaderComponent*> &componentList, const MaterialFeatureData &fd )
void PBRConfigVarsGLSL::processPix( Vector<ShaderComponent*> &componentList, const MaterialFeatureData &fd )
{
// search for material var

View file

@ -25,13 +25,12 @@
#include "shaderGen/GLSL/shaderFeatureGLSL.h"
#include "shaderGen/GLSL/bumpGLSL.h"
#include "shaderGen/GLSL/pixSpecularGLSL.h"
// Specular Outputs
class DeferredSpecMapGLSL : public ShaderFeatureGLSL
class PBRConfigMapGLSL : public ShaderFeatureGLSL
{
public:
virtual String getName() { return "Deferred Shading: Specular Map"; }
virtual String getName() { return "Deferred Shading: PBR Config Map"; }
virtual void processPix( Vector<ShaderComponent*> &componentList,
const MaterialFeatureData &fd );
@ -59,10 +58,10 @@ public:
virtual U32 getOutputTargets( const MaterialFeatureData &fd ) const { return ShaderFeature::RenderTarget2; }
};
class DeferredSpecVarsGLSL : public ShaderFeatureGLSL
class PBRConfigVarsGLSL : public ShaderFeatureGLSL
{
public:
virtual String getName() { return "Deferred Shading: Specular Explicit Numbers"; }
virtual String getName() { return "Deferred Shading: PBR Config Explicit Numbers"; }
virtual void processPix( Vector<ShaderComponent*> &componentList,
const MaterialFeatureData &fd );
@ -70,4 +69,4 @@ public:
virtual U32 getOutputTargets( const MaterialFeatureData &fd ) const { return ShaderFeature::RenderTarget2; }
};
#endif
#endif

View file

@ -25,7 +25,6 @@
#include "shaderGen/HLSL/shaderFeatureHLSL.h"
#include "shaderGen/HLSL/bumpHLSL.h"
#include "shaderGen/HLSL/pixSpecularHLSL.h"
class ConditionerMethodDependency;

View file

@ -36,9 +36,7 @@
// Deferred Shading Features
//****************************************************************************
// Specular Map -> Blue of Material Buffer ( greyscaled )
// Gloss Map (Alpha Channel of Specular Map) -> Alpha ( Spec Power ) of Material Info Buffer.
void DeferredSpecMapHLSL::processPix( Vector<ShaderComponent*> &componentList, const MaterialFeatureData &fd )
void PBRConfigMapHLSL::processPix( Vector<ShaderComponent*> &componentList, const MaterialFeatureData &fd )
{
// Get the texture coord.
Var *texCoord = getInTexCoord( "texCoord", "float2", componentList );
@ -71,8 +69,8 @@ void DeferredSpecMapHLSL::processPix( Vector<ShaderComponent*> &componentList, c
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");
Var * pbrConfig = (Var*)LangElement::find("PBRConfig");
if (!pbrConfig) pbrConfig = new Var("PBRConfig", "float4");
Var *metalness = (Var*)LangElement::find("metalness");
if (!metalness) metalness = new Var("metalness", "float");
Var *smoothness = (Var*)LangElement::find("smoothness");
@ -89,7 +87,7 @@ void DeferredSpecMapHLSL::processPix( Vector<ShaderComponent*> &componentList, c
output = meta;
}
ShaderFeature::Resources DeferredSpecMapHLSL::getResources( const MaterialFeatureData &fd )
ShaderFeature::Resources PBRConfigMapHLSL::getResources( const MaterialFeatureData &fd )
{
Resources res;
res.numTex = 1;
@ -98,7 +96,7 @@ ShaderFeature::Resources DeferredSpecMapHLSL::getResources( const MaterialFeatur
return res;
}
void DeferredSpecMapHLSL::setTexData( Material::StageData &stageDat,
void PBRConfigMapHLSL::setTexData( Material::StageData &stageDat,
const MaterialFeatureData &fd,
RenderPassData &passData,
U32 &texIndex )
@ -112,7 +110,7 @@ void DeferredSpecMapHLSL::setTexData( Material::StageData &stageDat,
}
}
void DeferredSpecMapHLSL::processVert( Vector<ShaderComponent*> &componentList,
void PBRConfigMapHLSL::processVert( Vector<ShaderComponent*> &componentList,
const MaterialFeatureData &fd )
{
MultiLine *meta = new MultiLine;
@ -149,7 +147,7 @@ void DeferredMatInfoFlagsHLSL::processPix( Vector<ShaderComponent*> &componentLi
// Spec Strength -> Blue Channel of Material Info Buffer.
// Spec Power -> Alpha Channel ( of Material Info Buffer.
void DeferredSpecVarsHLSL::processPix( Vector<ShaderComponent*> &componentList, const MaterialFeatureData &fd )
void PBRConfigVarsHLSL::processPix( Vector<ShaderComponent*> &componentList, const MaterialFeatureData &fd )
{
// search for material var
Var *material = (Var*) LangElement::find( getOutputTargetVarName(ShaderFeature::RenderTarget2) );

View file

@ -25,13 +25,11 @@
#include "shaderGen/HLSL/shaderFeatureHLSL.h"
#include "shaderGen/HLSL/bumpHLSL.h"
#include "shaderGen/HLSL/pixSpecularHLSL.h"
// Specular Outputs
class DeferredSpecMapHLSL : public ShaderFeatureHLSL
class PBRConfigMapHLSL : public ShaderFeatureHLSL
{
public:
virtual String getName() { return "Deferred Shading: Specular Map"; }
virtual String getName() { return "Deferred Shading: PBR Config Map"; }
virtual void processPix( Vector<ShaderComponent*> &componentList,
const MaterialFeatureData &fd );
@ -59,10 +57,10 @@ public:
virtual U32 getOutputTargets( const MaterialFeatureData &fd ) const { return ShaderFeature::RenderTarget2; }
};
class DeferredSpecVarsHLSL : public ShaderFeatureHLSL
class PBRConfigVarsHLSL : public ShaderFeatureHLSL
{
public:
virtual String getName() { return "Deferred Shading: Specular Explicit Numbers"; }
virtual String getName() { return "Deferred Shading: PBR Config Explicit Numbers"; }
virtual void processPix( Vector<ShaderComponent*> &componentList,
const MaterialFeatureData &fd );
@ -81,4 +79,4 @@ public:
virtual U32 getOutputTargets(const MaterialFeatureData &fd) const { return ShaderFeature::RenderTarget3; }
};
#endif
#endif

View file

@ -43,14 +43,12 @@
#include "shaderGen/featureMgr.h"
#include "shaderGen/HLSL/shaderFeatureHLSL.h"
#include "shaderGen/HLSL/bumpHLSL.h"
#include "shaderGen/HLSL/pixSpecularHLSL.h"
#include "lighting/basic/blTerrainSystem.h"
#include "lighting/common/projectedShadow.h"
#if defined( TORQUE_OPENGL )
#include "shaderGen/GLSL/shaderFeatureGLSL.h"
#include "shaderGen/GLSL/bumpGLSL.h"
#include "shaderGen/GLSL/pixSpecularGLSL.h"
#endif