Goes and replaces the references/names that use Prepass to be Deferred, since we're actually using deferred.

This commit is contained in:
Areloch 2017-04-11 00:23:14 -05:00
parent b052a1f970
commit af8fbf0e3a
122 changed files with 641 additions and 641 deletions

View file

@ -1214,7 +1214,7 @@ void DecalManager::prepRenderImage( SceneRenderState* state )
// Make it the sort distance the max distance so that
// it renders after all the other opaque geometry in
// the prepass bin.
// the deferred bin.
baseRenderInst.sortDistSq = F32_MAX;
Vector<DecalBatch> batches;

View file

@ -47,7 +47,7 @@
#include "materials/sceneData.h"
#include "materials/materialFeatureTypes.h"
#include "materials/matInstance.h"
#include "renderInstance/renderPrePassMgr.h"
#include "renderInstance/renderDeferredMgr.h"
#include "console/engineAPI.h"
/// This is used for rendering ground cover billboards.

View file

@ -353,7 +353,7 @@ void LevelInfo::_onLMActivate(const char *lm, bool enable)
{
AssertFatal(dynamic_cast<AdvancedLightManager *>(LIGHTMGR), "Bad light manager type!");
AdvancedLightManager *lightMgr = static_cast<AdvancedLightManager *>(LIGHTMGR);
lightMgr->getLightBinManager()->MRTLightmapsDuringPrePass(mAdvancedLightmapSupport);
lightMgr->getLightBinManager()->MRTLightmapsDuringDeferred(mAdvancedLightmapSupport);
}
#endif
}

View file

@ -100,7 +100,7 @@ VolumetricFog::VolumetricFog()
mTypeMask |= EnvironmentObjectType | StaticObjectType;
mPrepassTarget = NULL;
mDeferredTarget = NULL;
mDepthBufferTarget = NULL;
mFrontBufferTarget = NULL;
@ -771,17 +771,17 @@ void VolumetricFog::_leaveFog(ShapeBase *control)
bool VolumetricFog::setupRenderer()
{
// Search for the prepass rendertarget and shadermacros.
mPrepassTarget = NamedTexTarget::find("prepass");
if (!mPrepassTarget.isValid())
// Search for the deferred rendertarget and shadermacros.
mDeferredTarget = NamedTexTarget::find("deferred");
if (!mDeferredTarget.isValid())
{
Con::errorf("VolumetricFog::setupRenderer - could not find PrepassTarget");
Con::errorf("VolumetricFog::setupRenderer - could not find DeferredTarget");
return false;
}
Vector<GFXShaderMacro> macros;
if (mPrepassTarget)
mPrepassTarget->getShaderMacros(&macros);
if (mDeferredTarget)
mDeferredTarget->getShaderMacros(&macros);
// Search the depth and frontbuffers which are created by the VolumetricFogRTManager
@ -799,27 +799,27 @@ bool VolumetricFog::setupRenderer()
return false;
}
// Find and setup the prepass Shader
// Find and setup the deferred Shader
ShaderData *shaderData;
mPrePassShader = Sim::findObject("VolumetricFogPrePassShader", shaderData) ?
mDeferredShader = Sim::findObject("VolumetricFogDeferredShader", shaderData) ?
shaderData->getShader() : NULL;
if (!mPrePassShader)
if (!mDeferredShader)
{
Con::errorf("VolumetricFog::setupRenderer - could not find VolumetricFogPrePassShader");
Con::errorf("VolumetricFog::setupRenderer - could not find VolumetricFogDeferredShader");
return false;
}
// Create ShaderConstBuffer and Handles
mPPShaderConsts = mPrePassShader->allocConstBuffer();
mPPShaderConsts = mDeferredShader->allocConstBuffer();
if (mPPShaderConsts.isNull())
{
Con::errorf("VolumetricFog::setupRenderer - could not allocate ShaderConstants 1.");
return false;
}
mPPModelViewProjSC = mPrePassShader->getShaderConstHandle("$modelView");
mPPModelViewProjSC = mDeferredShader->getShaderConstHandle("$modelView");
// Find and setup the VolumetricFog Shader
@ -878,7 +878,7 @@ bool VolumetricFog::setupRenderer()
mReflFogDensitySC = mReflectionShader->getShaderConstHandle("$fogDensity");
mReflFogStrengthSC = mReflectionShader->getShaderConstHandle("$reflStrength");
// Create the prepass StateBlock
// Create the deferred StateBlock
desc_preD.setCullMode(GFXCullCW);
desc_preD.setBlend(true);
@ -895,7 +895,7 @@ bool VolumetricFog::setupRenderer()
descD.setBlend(true);
descD.setZReadWrite(false, false);// desc.setZReadWrite(true, false);
// prepassBuffer sampler
// deferredBuffer sampler
descD.samplersDefined = true;
descD.samplers[0].addressModeU = GFXAddressClamp;
descD.samplers[0].addressModeV = GFXAddressClamp;
@ -1063,7 +1063,7 @@ void VolumetricFog::render(ObjectRenderInst *ri, SceneRenderState *state, BaseMa
mat.scale(mObjScale);
GFX->multWorld(mat);
GFX->setShader(mPrePassShader);
GFX->setShader(mDeferredShader);
GFX->setShaderConstBuffer(mPPShaderConsts);
GFX->setStateBlock(mStateblock_preD);
@ -1127,9 +1127,9 @@ void VolumetricFog::render(ObjectRenderInst *ri, SceneRenderState *state, BaseMa
mShaderConsts->setSafe(mTexScaleSC, mTexScale * mFOV);
mShaderConsts->setSafe(mTexTilesSC, mTexTiles);
GFXTextureObject *prepasstex = mPrepassTarget ? mPrepassTarget->getTexture(0) : NULL;
GFXTextureObject *deferredtex = mDeferredTarget ? mDeferredTarget->getTexture(0) : NULL;
GFX->setTexture(0, prepasstex);
GFX->setTexture(0, deferredtex);
GFX->setTexture(1, mDepthBuffer);
GFX->setTexture(2, mFrontBuffer);

View file

@ -80,7 +80,7 @@ class VolumetricFog : public SceneObject
protected:
// Rendertargets;
GFXTextureTargetRef z_buf;
NamedTexTargetRef mPrepassTarget;
NamedTexTargetRef mDeferredTarget;
NamedTexTargetRef mDepthBufferTarget;
NamedTexTargetRef mFrontBufferTarget;
@ -89,7 +89,7 @@ class VolumetricFog : public SceneObject
// Shaders
GFXShaderRef mShader;
GFXShaderRef mPrePassShader;
GFXShaderRef mDeferredShader;
GFXShaderRef mReflectionShader;
// Stateblocks

View file

@ -739,7 +739,7 @@ void DecalRoad::prepRenderImage( SceneRenderState* state )
// Make it the sort distance the max distance so that
// it renders after all the other opaque geometry in
// the prepass bin.
// the deferred bin.
coreRI.sortDistSq = F32_MAX;
// If we need lights then set them up.

View file

@ -161,7 +161,7 @@ ConsoleDocClass( WaterObject,
"\t- Paramable water fog and color shift.\n\n"
"It will, however, look significantly different depending on the LightingManager "
"that is active. With Basic Lighting, we do not have a prepass texture to "
"that is active. With Basic Lighting, we do not have a deferred texture to "
"lookup per-pixel depth and therefore cannot use our rendering techniques that depend on it.\n\n"
"In particular, the following field groups are not used under Basic Lighting:\n"

View file

@ -29,7 +29,7 @@
#include "lighting/shadowMap/shadowMapPass.h"
#include "lighting/shadowMap/lightShadowMap.h"
#include "lighting/common/lightMapParams.h"
#include "renderInstance/renderPrePassMgr.h"
#include "renderInstance/renderDeferredMgr.h"
#include "gfx/gfxTransformSaver.h"
#include "scene/sceneManager.h"
#include "scene/sceneRenderState.h"
@ -130,7 +130,7 @@ AdvancedLightBinManager::AdvancedLightBinManager( AdvancedLightManager *lm /* =
// We want a full-resolution buffer
mTargetSizeType = RenderTexTargetBinManager::WindowSize;
mMRTLightmapsDuringPrePass = false;
mMRTLightmapsDuringDeferred = false;
Con::NotifyDelegate callback( this, &AdvancedLightBinManager::_deleteLightMaterials );
Con::addVariableNotify( "$pref::Shadows::filterMode", callback );
@ -253,7 +253,7 @@ void AdvancedLightBinManager::render( SceneRenderState *state )
return;
// Clear as long as there isn't MRT population of light buffer with lightmap data
if ( !MRTLightmapsDuringPrePass() )
if ( !MRTLightmapsDuringDeferred() )
GFX->clear(GFXClearTarget, ColorI(0, 0, 0, 0), 1.0f, 0);
// Restore transforms
@ -550,23 +550,23 @@ void AdvancedLightBinManager::setupSGData( SceneData &data, const SceneRenderSta
}
}
void AdvancedLightBinManager::MRTLightmapsDuringPrePass( bool val )
void AdvancedLightBinManager::MRTLightmapsDuringDeferred( bool val )
{
// Do not enable if the GFX device can't do MRT's
if ( GFX->getNumRenderTargets() < 2 )
val = false;
if ( mMRTLightmapsDuringPrePass != val )
if ( mMRTLightmapsDuringDeferred != val )
{
mMRTLightmapsDuringPrePass = val;
mMRTLightmapsDuringDeferred = val;
// Reload materials to cause a feature recalculation on prepass materials
// Reload materials to cause a feature recalculation on deferred materials
if(mLightManager->isActive())
MATMGR->flushAndReInitInstances();
RenderPrePassMgr *prepass;
if ( Sim::findObject( "AL_PrePassBin", prepass ) && prepass->getTargetTexture( 0 ) )
prepass->updateTargets();
RenderDeferredMgr *deferred;
if ( Sim::findObject( "AL_DeferredBin", deferred ) && deferred->getTargetTexture( 0 ) )
deferred->updateTargets();
}
}
@ -834,21 +834,21 @@ bool LightMatInstance::init( const FeatureSet &features, const GFXVertexFormat *
// in the same way.
litState.separateAlphaBlendDefined = true;
litState.separateAlphaBlendEnable = false;
litState.stencilMask = RenderPrePassMgr::OpaqueDynamicLitMask | RenderPrePassMgr::OpaqueStaticLitMask;
litState.stencilMask = RenderDeferredMgr::OpaqueDynamicLitMask | RenderDeferredMgr::OpaqueStaticLitMask;
mLitState[DynamicLight] = GFX->createStateBlock(litState);
// StaticLightNonLMGeometry State: This will treat non-lightmapped geometry
// in the usual way, but will not effect lightmapped geometry.
litState.separateAlphaBlendDefined = true;
litState.separateAlphaBlendEnable = false;
litState.stencilMask = RenderPrePassMgr::OpaqueDynamicLitMask;
litState.stencilMask = RenderDeferredMgr::OpaqueDynamicLitMask;
mLitState[StaticLightNonLMGeometry] = GFX->createStateBlock(litState);
// StaticLightLMGeometry State: This will add specular information (alpha) but
// multiply-darken color information.
litState.blendDest = GFXBlendSrcColor;
litState.blendSrc = GFXBlendZero;
litState.stencilMask = RenderPrePassMgr::OpaqueStaticLitMask;
litState.stencilMask = RenderDeferredMgr::OpaqueStaticLitMask;
litState.separateAlphaBlendDefined = true;
litState.separateAlphaBlendEnable = true;
litState.separateAlphaBlendSrc = GFXBlendOne;

View file

@ -121,8 +121,8 @@ public:
// ConsoleObject interface
DECLARE_CONOBJECT(AdvancedLightBinManager);
bool MRTLightmapsDuringPrePass() const { return mMRTLightmapsDuringPrePass; }
void MRTLightmapsDuringPrePass(bool val);
bool MRTLightmapsDuringDeferred() const { return mMRTLightmapsDuringDeferred; }
void MRTLightmapsDuringDeferred(bool val);
typedef Signal<void(SceneRenderState *, AdvancedLightBinManager *)> RenderSignal;
@ -195,7 +195,7 @@ protected:
Vector<LightBinEntry> mLightBin;
typedef Vector<LightBinEntry>::iterator LightBinIterator;
bool mMRTLightmapsDuringPrePass;
bool mMRTLightmapsDuringDeferred;
/// Used in setupSGData to set the object transform.
MatrixF mLightMat;

View file

@ -30,7 +30,7 @@
#include "lighting/common/sceneLighting.h"
#include "lighting/common/lightMapParams.h"
#include "core/util/safeDelete.h"
#include "renderInstance/renderPrePassMgr.h"
#include "renderInstance/renderDeferredMgr.h"
#include "materials/materialManager.h"
#include "math/util/sphereMesh.h"
#include "console/consoleTypes.h"
@ -115,27 +115,27 @@ void AdvancedLightManager::activate( SceneManager *sceneManager )
mLightBinManager = new AdvancedLightBinManager( this, SHADOWMGR, blendTargetFormat );
mLightBinManager->assignName( "AL_LightBinMgr" );
// First look for the prepass bin...
RenderPrePassMgr *prePassBin = _findPrePassRenderBin();
// First look for the deferred bin...
RenderDeferredMgr *prePassBin = _findDeferredRenderBin();
// If we didn't find the prepass bin then add one.
// If we didn't find the deferred bin then add one.
if ( !prePassBin )
{
prePassBin = new RenderPrePassMgr( true, blendTargetFormat );
prePassBin->assignName( "AL_PrePassBin" );
prePassBin = new RenderDeferredMgr( true, blendTargetFormat );
prePassBin->assignName( "AL_DeferredBin" );
prePassBin->registerObject();
getSceneManager()->getDefaultRenderPass()->addManager( prePassBin );
mPrePassRenderBin = prePassBin;
mDeferredRenderBin = prePassBin;
}
// Tell the material manager that prepass is enabled.
MATMGR->setPrePassEnabled( true );
// Tell the material manager that deferred is enabled.
MATMGR->setDeferredEnabled( true );
// Insert our light bin manager.
mLightBinManager->setRenderOrder( prePassBin->getRenderOrder() + 0.01f );
getSceneManager()->getDefaultRenderPass()->addManager( mLightBinManager );
AdvancedLightingFeatures::registerFeatures(mPrePassRenderBin->getTargetFormat(), mLightBinManager->getTargetFormat());
AdvancedLightingFeatures::registerFeatures(mDeferredRenderBin->getTargetFormat(), mLightBinManager->getTargetFormat());
// Last thing... let everyone know we're active.
smActivateSignal.trigger( getId(), true );
@ -151,14 +151,14 @@ void AdvancedLightManager::deactivate()
// removing itself from the render passes.
if( mLightBinManager )
{
mLightBinManager->MRTLightmapsDuringPrePass(false);
mLightBinManager->MRTLightmapsDuringDeferred(false);
mLightBinManager->deleteObject();
}
mLightBinManager = NULL;
if ( mPrePassRenderBin )
mPrePassRenderBin->deleteObject();
mPrePassRenderBin = NULL;
if ( mDeferredRenderBin )
mDeferredRenderBin->deleteObject();
mDeferredRenderBin = NULL;
SHADOWMGR->deactivate();
@ -348,8 +348,8 @@ void AdvancedLightManager::setLightInfo( ProcessedMaterial *pmat,
U32 pass,
GFXShaderConstBuffer *shaderConsts)
{
// Skip this if we're rendering from the prepass bin.
if ( sgData.binType == SceneData::PrePassBin )
// Skip this if we're rendering from the deferred bin.
if ( sgData.binType == SceneData::DeferredBin )
return;
PROFILE_SCOPE(AdvancedLightManager_setLightInfo);

View file

@ -54,7 +54,7 @@
class AvailableSLInterfaces;
class AdvancedLightBinManager;
class RenderPrePassMgr;
class RenderDeferredMgr;
class BaseMatInstance;
class MaterialParameters;
class MaterialParameterHandle;
@ -115,7 +115,7 @@ protected:
SimObjectPtr<AdvancedLightBinManager> mLightBinManager;
SimObjectPtr<RenderPrePassMgr> mPrePassRenderBin;
SimObjectPtr<RenderDeferredMgr> mDeferredRenderBin;
LightConstantMap mConstantLookup;

View file

@ -44,7 +44,7 @@
bool AdvancedLightingFeatures::smFeaturesRegistered = false;
void AdvancedLightingFeatures::registerFeatures( const GFXFormat &prepassTargetFormat, const GFXFormat &lightInfoTargetFormat )
void AdvancedLightingFeatures::registerFeatures( const GFXFormat &deferredTargetFormat, const GFXFormat &lightInfoTargetFormat )
{
AssertFatal( !smFeaturesRegistered, "AdvancedLightingFeatures::registerFeatures() - Features already registered. Bad!" );
@ -56,8 +56,8 @@ void AdvancedLightingFeatures::registerFeatures( const GFXFormat &prepassTargetF
if(GFX->getAdapterType() == OpenGL)
{
#if defined( TORQUE_OPENGL )
cond = new GBufferConditionerGLSL( prepassTargetFormat, GBufferConditionerGLSL::ViewSpace );
FEATUREMGR->registerFeature(MFT_PrePassConditioner, cond);
cond = new GBufferConditionerGLSL( deferredTargetFormat, GBufferConditionerGLSL::ViewSpace );
FEATUREMGR->registerFeature(MFT_DeferredConditioner, cond);
FEATUREMGR->registerFeature(MFT_RTLighting, new DeferredRTLightingFeatGLSL());
FEATUREMGR->registerFeature(MFT_NormalMap, new DeferredBumpFeatGLSL());
FEATUREMGR->registerFeature(MFT_PixSpecular, new DeferredPixelSpecularGLSL());
@ -68,8 +68,8 @@ void AdvancedLightingFeatures::registerFeatures( const GFXFormat &prepassTargetF
else
{
#if defined( TORQUE_OS_WIN )
cond = new GBufferConditionerHLSL( prepassTargetFormat, GBufferConditionerHLSL::ViewSpace );
FEATUREMGR->registerFeature(MFT_PrePassConditioner, cond);
cond = new GBufferConditionerHLSL( deferredTargetFormat, GBufferConditionerHLSL::ViewSpace );
FEATUREMGR->registerFeature(MFT_DeferredConditioner, cond);
FEATUREMGR->registerFeature(MFT_RTLighting, new DeferredRTLightingFeatHLSL());
FEATUREMGR->registerFeature(MFT_NormalMap, new DeferredBumpFeatHLSL());
FEATUREMGR->registerFeature(MFT_PixSpecular, new DeferredPixelSpecularHLSL());
@ -78,7 +78,7 @@ void AdvancedLightingFeatures::registerFeatures( const GFXFormat &prepassTargetF
#endif
}
NamedTexTarget *target = NamedTexTarget::find( "prepass" );
NamedTexTarget *target = NamedTexTarget::find( "deferred" );
if ( target )
target->setConditioner( cond );
@ -87,11 +87,11 @@ void AdvancedLightingFeatures::registerFeatures( const GFXFormat &prepassTargetF
void AdvancedLightingFeatures::unregisterFeatures()
{
NamedTexTarget *target = NamedTexTarget::find( "prepass" );
NamedTexTarget *target = NamedTexTarget::find( "deferred" );
if ( target )
target->setConditioner( NULL );
FEATUREMGR->unregisterFeature(MFT_PrePassConditioner);
FEATUREMGR->unregisterFeature(MFT_DeferredConditioner);
FEATUREMGR->unregisterFeature(MFT_RTLighting);
FEATUREMGR->unregisterFeature(MFT_NormalMap);
FEATUREMGR->unregisterFeature(MFT_PixSpecular);

View file

@ -31,7 +31,7 @@ class AdvancedLightingFeatures
{
public:
static void registerFeatures( const GFXFormat &prepassTargetFormat, const GFXFormat &lightInfoTargetFormat );
static void registerFeatures( const GFXFormat &deferredTargetFormat, const GFXFormat &lightInfoTargetFormat );
static void unregisterFeatures();
private:

View file

@ -27,7 +27,7 @@
#include "shaderGen/langElement.h"
#include "shaderGen/shaderOp.h"
#include "shaderGen/conditionerFeature.h"
#include "renderInstance/renderPrePassMgr.h"
#include "renderInstance/renderDeferredMgr.h"
#include "materials/processedMaterial.h"
#include "materials/materialFeatureTypes.h"
@ -144,7 +144,7 @@ void DeferredRTLightingFeatGLSL::processPix( Vector<ShaderComponent*> &component
unconditionLightInfo.c_str() ), lightInfoBuffer, uvScene, d_lightcolor, d_NL_Att, d_specular ) );
// If this has an interlaced pre-pass, do averaging here
if( fd.features[MFT_InterlacedPrePass] )
if( fd.features[MFT_InterlacedDeferred] )
{
Var *oneOverTargetSize = (Var*) LangElement::find( "oneOverTargetSize" );
if( !oneOverTargetSize )
@ -216,7 +216,7 @@ void DeferredRTLightingFeatGLSL::setTexData( Material::StageData &stageDat,
void DeferredBumpFeatGLSL::processVert( Vector<ShaderComponent*> &componentList,
const MaterialFeatureData &fd )
{
if( fd.features[MFT_PrePassConditioner] )
if( fd.features[MFT_DeferredConditioner] )
{
// There is an output conditioner active, so we need to supply a transform
// to the pixel shader.
@ -264,7 +264,7 @@ void DeferredBumpFeatGLSL::processPix( Vector<ShaderComponent*> &componentList,
// NULL output in case nothing gets handled
output = NULL;
if( fd.features[MFT_PrePassConditioner] )
if( fd.features[MFT_DeferredConditioner] )
{
MultiLine *meta = new MultiLine;
@ -312,7 +312,7 @@ void DeferredBumpFeatGLSL::processPix( Vector<ShaderComponent*> &componentList,
}
// This var is read from GBufferConditionerGLSL and
// used in the prepass output.
// used in the deferred output.
//
// By using the 'half' type here we get a bunch of partial
// precision optimized code on further operations on the normal
@ -425,7 +425,7 @@ ShaderFeature::Resources DeferredBumpFeatGLSL::getResources( const MaterialFeatu
res.numTex = 1;
res.numTexReg = 1;
if ( fd.features[MFT_PrePassConditioner] &&
if ( fd.features[MFT_DeferredConditioner] &&
fd.features.hasFeature( MFT_DetailNormalMap ) )
{
res.numTex += 1;
@ -450,7 +450,7 @@ void DeferredBumpFeatGLSL::setTexData( Material::StageData &stageDat,
return;
}
if (!fd.features[MFT_PrePassConditioner] && fd.features[MFT_AccuMap])
if (!fd.features[MFT_DeferredConditioner] && fd.features[MFT_AccuMap])
{
passData.mTexType[texIndex] = Material::Bump;
passData.mSamplerNames[texIndex] = "bumpMap";
@ -464,14 +464,14 @@ void DeferredBumpFeatGLSL::setTexData( Material::StageData &stageDat,
}
}
else if (!fd.features[MFT_Parallax] && !fd.features[MFT_SpecularMap] &&
( fd.features[MFT_PrePassConditioner] ||
( fd.features[MFT_DeferredConditioner] ||
fd.features[MFT_PixSpecular] ) )
{
passData.mTexType[ texIndex ] = Material::Bump;
passData.mSamplerNames[ texIndex ] = "bumpMap";
passData.mTexSlot[ texIndex++ ].texObject = stageDat.getTex( MFT_NormalMap );
if ( fd.features[MFT_PrePassConditioner] &&
if ( fd.features[MFT_DeferredConditioner] &&
fd.features.hasFeature( MFT_DetailNormalMap ) )
{
passData.mTexType[ texIndex ] = Material::DetailBump;
@ -604,11 +604,11 @@ void DeferredMinnaertGLSL::setTexData( Material::StageData &stageDat,
{
if( !fd.features[MFT_ForwardShading] && fd.features[MFT_RTLighting] )
{
NamedTexTarget *texTarget = NamedTexTarget::find(RenderPrePassMgr::BufferName);
NamedTexTarget *texTarget = NamedTexTarget::find(RenderDeferredMgr::BufferName);
if ( texTarget )
{
passData.mTexType[texIndex] = Material::TexTarget;
passData.mSamplerNames[texIndex] = "prepassBuffer";
passData.mSamplerNames[texIndex] = "deferredBuffer";
passData.mTexSlot[ texIndex++ ].texTarget = texTarget;
}
}
@ -620,11 +620,11 @@ void DeferredMinnaertGLSL::processPixMacros( Vector<GFXShaderMacro> &macros,
if( !fd.features[MFT_ForwardShading] && fd.features[MFT_RTLighting] )
{
// Pull in the uncondition method for the g buffer
NamedTexTarget *texTarget = NamedTexTarget::find( RenderPrePassMgr::BufferName );
NamedTexTarget *texTarget = NamedTexTarget::find( RenderDeferredMgr::BufferName );
if ( texTarget && texTarget->getConditioner() )
{
ConditionerMethodDependency *unconditionMethod = texTarget->getConditioner()->getConditionerMethodDependency(ConditionerFeature::UnconditionMethod);
unconditionMethod->createMethodMacro( String::ToLower(RenderPrePassMgr::BufferName) + "Uncondition", macros );
unconditionMethod->createMethodMacro( String::ToLower(RenderDeferredMgr::BufferName) + "Uncondition", macros );
addDependency(unconditionMethod);
}
}
@ -664,12 +664,12 @@ void DeferredMinnaertGLSL::processPix( Vector<ShaderComponent*> &componentList,
minnaertConstant->constSortPos = cspPotentialPrimitive;
// create texture var
Var *prepassBuffer = new Var;
prepassBuffer->setType( "sampler2D" );
prepassBuffer->setName( "prepassBuffer" );
prepassBuffer->uniform = true;
prepassBuffer->sampler = true;
prepassBuffer->constNum = Var::getTexUnitNum(); // used as texture unit num here
Var *deferredBuffer = new Var;
deferredBuffer->setType( "sampler2D" );
deferredBuffer->setName( "deferredBuffer" );
deferredBuffer->uniform = true;
deferredBuffer->sampler = true;
deferredBuffer->constNum = Var::getTexUnitNum(); // used as texture unit num here
// Texture coord
Var *uvScene = (Var*) LangElement::find( "uvScene" );
@ -680,11 +680,11 @@ void DeferredMinnaertGLSL::processPix( Vector<ShaderComponent*> &componentList,
// Get the world space view vector.
Var *wsViewVec = getWsView( getInWsPosition( componentList ), meta );
String unconditionPrePassMethod = String::ToLower(RenderPrePassMgr::BufferName) + "Uncondition";
String unconditionDeferredMethod = String::ToLower(RenderDeferredMgr::BufferName) + "Uncondition";
Var *d_NL_Att = (Var*)LangElement::find( "d_NL_Att" );
meta->addStatement( new GenOp( avar( " vec4 normalDepth = %s(@, @);\r\n", unconditionPrePassMethod.c_str() ), prepassBuffer, uvScene ) );
meta->addStatement( new GenOp( avar( " vec4 normalDepth = %s(@, @);\r\n", unconditionDeferredMethod.c_str() ), deferredBuffer, uvScene ) );
meta->addStatement( new GenOp( " float vDotN = dot(normalDepth.xyz, @);\r\n", wsViewVec ) );
meta->addStatement( new GenOp( " float Minnaert = pow( @, @) * pow(vDotN, 1.0 - @);\r\n", d_NL_Att, minnaertConstant, minnaertConstant ) );
meta->addStatement( new GenOp( " @;\r\n", assignColor( new GenOp( "vec4(Minnaert, Minnaert, Minnaert, 1.0)" ), Material::Mul ) ) );

View file

@ -30,13 +30,13 @@
class ConditionerMethodDependency;
/// Lights the pixel by sampling from the light prepass
/// Lights the pixel by sampling from the light deferred
/// buffer. It will fall back to forward lighting
/// functionality for non-deferred rendered surfaces.
///
/// Also note that this feature is only used in the
/// forward rendering pass. It is not used during the
/// prepass step.
/// deferred step.
///
class DeferredRTLightingFeatGLSL : public RTLightingFeatGLSL
{
@ -103,7 +103,7 @@ public:
/// Generates specular highlights in the forward pass
/// from the light prepass buffer.
/// from the light deferred buffer.
class DeferredPixelSpecularGLSL : public PixelSpecularGLSL
{
typedef PixelSpecularGLSL Parent;

View file

@ -27,7 +27,7 @@
#include "shaderGen/langElement.h"
#include "shaderGen/shaderOp.h"
#include "shaderGen/conditionerFeature.h"
#include "renderInstance/renderPrePassMgr.h"
#include "renderInstance/renderDeferredMgr.h"
#include "materials/processedMaterial.h"
#include "materials/materialFeatureTypes.h"

View file

@ -163,7 +163,7 @@ void GBufferConditionerGLSL::processPix( Vector<ShaderComponent*> &componentLis
LangElement *outputDecl = new DecOp( unconditionedOut );
// If we're doing prepass blending then we need
// If we're doing deferred blending then we need
// to steal away the alpha channel before the
// conditioner stomps on it.
Var *alphaVal = NULL;
@ -174,7 +174,7 @@ void GBufferConditionerGLSL::processPix( Vector<ShaderComponent*> &componentLis
}
// If using interlaced normals, invert the normal
if(fd.features[MFT_InterlacedPrePass])
if(fd.features[MFT_InterlacedDeferred])
{
// NOTE: Its safe to not call ShaderFeatureGLSL::addOutVpos() in the vertex
// shader as for SM 3.0 nothing is needed there.
@ -190,7 +190,7 @@ void GBufferConditionerGLSL::processPix( Vector<ShaderComponent*> &componentLis
meta->addStatement( new GenOp(" @ = @;", outputDecl, new GenOp( "float4(normalize(@), @)", gbNormal, depth ) ) );
meta->addStatement( assignOutput( unconditionedOut ) );
// If we have an alpha var then we're doing prepass lerp blending.
// If we have an alpha var then we're doing deferred lerp blending.
if ( alphaVal )
{
Var *outColor = (Var*)LangElement::find( getOutputTargetVarName( DefaultTarget ) );
@ -227,10 +227,10 @@ Var* GBufferConditionerGLSL::printMethodHeader( MethodType methodType, const Str
methodVar->setType("float4");
DecOp *methodDecl = new DecOp(methodVar);
Var *prepassSampler = new Var;
prepassSampler->setName("prepassSamplerVar");
prepassSampler->setType("sampler2D");
DecOp *prepassSamplerDecl = new DecOp(prepassSampler);
Var *deferredSampler = new Var;
deferredSampler->setName("deferredSamplerVar");
deferredSampler->setType("sampler2D");
DecOp *deferredSamplerDecl = new DecOp(deferredSampler);
Var *screenUV = new Var;
screenUV->setName("screenUVVar");
@ -242,7 +242,7 @@ Var* GBufferConditionerGLSL::printMethodHeader( MethodType methodType, const Str
bufferSample->setType("float4");
DecOp *bufferSampleDecl = new DecOp(bufferSample);
meta->addStatement( new GenOp( "@(@, @)\r\n", methodDecl, prepassSamplerDecl, screenUVDecl ) );
meta->addStatement( new GenOp( "@(@, @)\r\n", methodDecl, deferredSamplerDecl, screenUVDecl ) );
meta->addStatement( new GenOp( "{\r\n" ) );
@ -250,14 +250,14 @@ Var* GBufferConditionerGLSL::printMethodHeader( MethodType methodType, const Str
#ifdef TORQUE_OS_XENON
meta->addStatement( new GenOp( " @;\r\n", bufferSampleDecl ) );
meta->addStatement( new GenOp( " asm { tfetch2D @, @, @, MagFilter = point, MinFilter = point, MipFilter = point };\r\n", bufferSample, screenUV, prepassSampler ) );
meta->addStatement( new GenOp( " asm { tfetch2D @, @, @, MagFilter = point, MinFilter = point, MipFilter = point };\r\n", bufferSample, screenUV, deferredSampler ) );
#else
// The gbuffer has no mipmaps, so use tex2dlod when
// possible so that the shader compiler can optimize.
meta->addStatement( new GenOp( " #if TORQUE_SM >= 30\r\n" ) );
meta->addStatement( new GenOp( " @ = tex2Dlod(@, float4(@,0,0));\r\n", bufferSampleDecl, prepassSampler, screenUV ) );
meta->addStatement( new GenOp( " @ = tex2Dlod(@, float4(@,0,0));\r\n", bufferSampleDecl, deferredSampler, screenUV ) );
meta->addStatement( new GenOp( " #else\r\n" ) );
meta->addStatement( new GenOp( " @ = tex2D(@, @);\r\n", bufferSampleDecl, prepassSampler, screenUV ) );
meta->addStatement( new GenOp( " @ = tex2D(@, @);\r\n", bufferSampleDecl, deferredSampler, screenUV ) );
meta->addStatement( new GenOp( " #endif\r\n\r\n" ) );
#endif

View file

@ -27,7 +27,7 @@
#include "shaderGen/langElement.h"
#include "shaderGen/shaderOp.h"
#include "shaderGen/conditionerFeature.h"
#include "renderInstance/renderPrePassMgr.h"
#include "renderInstance/renderDeferredMgr.h"
#include "materials/processedMaterial.h"
#include "materials/materialFeatureTypes.h"
@ -160,7 +160,7 @@ void DeferredRTLightingFeatHLSL::processPix( Vector<ShaderComponent*> &component
unconditionLightInfo.c_str()), lightInfoBuffer, uvScene, d_lightcolor, d_NL_Att, d_specular));
// If this has an interlaced pre-pass, do averaging here
if( fd.features[MFT_InterlacedPrePass] )
if( fd.features[MFT_InterlacedDeferred] )
{
Var *oneOverTargetSize = (Var*) LangElement::find( "oneOverTargetSize" );
if( !oneOverTargetSize )
@ -236,7 +236,7 @@ void DeferredRTLightingFeatHLSL::setTexData( Material::StageData &stageDat,
void DeferredBumpFeatHLSL::processVert( Vector<ShaderComponent*> &componentList,
const MaterialFeatureData &fd )
{
if( fd.features[MFT_PrePassConditioner] )
if( fd.features[MFT_DeferredConditioner] )
{
// There is an output conditioner active, so we need to supply a transform
// to the pixel shader.
@ -284,7 +284,7 @@ void DeferredBumpFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
// NULL output in case nothing gets handled
output = NULL;
if( fd.features[MFT_PrePassConditioner] )
if( fd.features[MFT_DeferredConditioner] )
{
MultiLine *meta = new MultiLine;
@ -358,7 +358,7 @@ void DeferredBumpFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
}
// This var is read from GBufferConditionerHLSL and
// used in the prepass output.
// used in the deferred output.
//
// By using the 'half' type here we get a bunch of partial
// precision optimized code on further operations on the normal
@ -500,7 +500,7 @@ ShaderFeature::Resources DeferredBumpFeatHLSL::getResources( const MaterialFeatu
res.numTex = 1;
res.numTexReg = 1;
if ( fd.features[MFT_PrePassConditioner] &&
if ( fd.features[MFT_DeferredConditioner] &&
fd.features.hasFeature( MFT_DetailNormalMap ) )
{
res.numTex += 1;
@ -525,7 +525,7 @@ void DeferredBumpFeatHLSL::setTexData( Material::StageData &stageDat,
return;
}
if ( !fd.features[MFT_PrePassConditioner] && fd.features[MFT_AccuMap] )
if ( !fd.features[MFT_DeferredConditioner] && fd.features[MFT_AccuMap] )
{
passData.mTexType[ texIndex ] = Material::Bump;
passData.mSamplerNames[ texIndex ] = "bumpMap";
@ -539,14 +539,14 @@ void DeferredBumpFeatHLSL::setTexData( Material::StageData &stageDat,
}
}
else if ( !fd.features[MFT_Parallax] && !fd.features[MFT_SpecularMap] &&
( fd.features[MFT_PrePassConditioner] ||
( fd.features[MFT_DeferredConditioner] ||
fd.features[MFT_PixSpecular] ) )
{
passData.mTexType[ texIndex ] = Material::Bump;
passData.mSamplerNames[ texIndex ] = "bumpMap";
passData.mTexSlot[ texIndex++ ].texObject = stageDat.getTex( MFT_NormalMap );
if ( fd.features[MFT_PrePassConditioner] &&
if ( fd.features[MFT_DeferredConditioner] &&
fd.features.hasFeature( MFT_DetailNormalMap ) )
{
passData.mTexType[ texIndex ] = Material::DetailBump;
@ -681,11 +681,11 @@ void DeferredMinnaertHLSL::setTexData( Material::StageData &stageDat,
{
if( !fd.features[MFT_ForwardShading] && fd.features[MFT_RTLighting] )
{
NamedTexTarget *texTarget = NamedTexTarget::find(RenderPrePassMgr::BufferName);
NamedTexTarget *texTarget = NamedTexTarget::find(RenderDeferredMgr::BufferName);
if ( texTarget )
{
passData.mTexType[texIndex] = Material::TexTarget;
passData.mSamplerNames[texIndex] = "prepassBuffer";
passData.mSamplerNames[texIndex] = "deferredBuffer";
passData.mTexSlot[ texIndex++ ].texTarget = texTarget;
}
}
@ -697,11 +697,11 @@ void DeferredMinnaertHLSL::processPixMacros( Vector<GFXShaderMacro> &macros,
if( !fd.features[MFT_ForwardShading] && fd.features[MFT_RTLighting] )
{
// Pull in the uncondition method for the g buffer
NamedTexTarget *texTarget = NamedTexTarget::find( RenderPrePassMgr::BufferName );
NamedTexTarget *texTarget = NamedTexTarget::find( RenderDeferredMgr::BufferName );
if ( texTarget && texTarget->getConditioner() )
{
ConditionerMethodDependency *unconditionMethod = texTarget->getConditioner()->getConditionerMethodDependency(ConditionerFeature::UnconditionMethod);
unconditionMethod->createMethodMacro( String::ToLower(RenderPrePassMgr::BufferName) + "Uncondition", macros );
unconditionMethod->createMethodMacro( String::ToLower(RenderDeferredMgr::BufferName) + "Uncondition", macros );
addDependency(unconditionMethod);
}
}
@ -741,23 +741,23 @@ void DeferredMinnaertHLSL::processPix( Vector<ShaderComponent*> &componentList,
minnaertConstant->constSortPos = cspPotentialPrimitive;
// create texture var
Var *prepassBuffer = new Var;
prepassBuffer->setType( "sampler2D" );
prepassBuffer->setName( "prepassBuffer" );
prepassBuffer->uniform = true;
prepassBuffer->sampler = true;
prepassBuffer->constNum = Var::getTexUnitNum(); // used as texture unit num here
Var *deferredBuffer = new Var;
deferredBuffer->setType( "sampler2D" );
deferredBuffer->setName( "deferredBuffer" );
deferredBuffer->uniform = true;
deferredBuffer->sampler = true;
deferredBuffer->constNum = Var::getTexUnitNum(); // used as texture unit num here
Var* prePassTex = NULL;
if (mIsDirect3D11)
{
prepassBuffer->setType("SamplerState");
deferredBuffer->setType("SamplerState");
prePassTex = new Var;
prePassTex->setName("prePassTex");
prePassTex->setType("Texture2D");
prePassTex->uniform = true;
prePassTex->texture = true;
prePassTex->constNum = prepassBuffer->constNum;
prePassTex->constNum = deferredBuffer->constNum;
}
// Texture coord
@ -769,14 +769,14 @@ void DeferredMinnaertHLSL::processPix( Vector<ShaderComponent*> &componentList,
// Get the world space view vector.
Var *wsViewVec = getWsView( getInWsPosition( componentList ), meta );
String unconditionPrePassMethod = String::ToLower(RenderPrePassMgr::BufferName) + "Uncondition";
String unconditionDeferredMethod = String::ToLower(RenderDeferredMgr::BufferName) + "Uncondition";
Var *d_NL_Att = (Var*)LangElement::find( "d_NL_Att" );
if (mIsDirect3D11)
meta->addStatement(new GenOp(avar(" float4 normalDepth = %s(@, ,@, @);\r\n", unconditionPrePassMethod.c_str()), prepassBuffer, prePassTex, uvScene));
meta->addStatement(new GenOp(avar(" float4 normalDepth = %s(@, ,@, @);\r\n", unconditionDeferredMethod.c_str()), deferredBuffer, prePassTex, uvScene));
else
meta->addStatement(new GenOp(avar(" float4 normalDepth = %s(@, @);\r\n", unconditionPrePassMethod.c_str()), prepassBuffer, uvScene));
meta->addStatement(new GenOp(avar(" float4 normalDepth = %s(@, @);\r\n", unconditionDeferredMethod.c_str()), deferredBuffer, uvScene));
meta->addStatement( new GenOp( " float vDotN = dot(normalDepth.xyz, @);\r\n", wsViewVec ) );
meta->addStatement( new GenOp( " float Minnaert = pow( @, @) * pow(vDotN, 1.0 - @);\r\n", d_NL_Att, minnaertConstant, minnaertConstant ) );

View file

@ -30,13 +30,13 @@
class ConditionerMethodDependency;
/// Lights the pixel by sampling from the light prepass
/// Lights the pixel by sampling from the light deferred
/// buffer. It will fall back to forward lighting
/// functionality for non-deferred rendered surfaces.
///
/// Also note that this feature is only used in the
/// forward rendering pass. It is not used during the
/// prepass step.
/// deferred step.
///
class DeferredRTLightingFeatHLSL : public RTLightingFeatHLSL
{
@ -103,7 +103,7 @@ public:
/// Generates specular highlights in the forward pass
/// from the light prepass buffer.
/// from the light deferred buffer.
class DeferredPixelSpecularHLSL : public PixelSpecularHLSL
{
typedef PixelSpecularHLSL Parent;

View file

@ -27,7 +27,7 @@
#include "shaderGen/langElement.h"
#include "shaderGen/shaderOp.h"
#include "shaderGen/conditionerFeature.h"
#include "renderInstance/renderPrePassMgr.h"
#include "renderInstance/renderDeferredMgr.h"
#include "materials/processedMaterial.h"
#include "materials/materialFeatureTypes.h"

View file

@ -163,7 +163,7 @@ void GBufferConditionerHLSL::processPix( Vector<ShaderComponent*> &componentLis
LangElement *outputDecl = new DecOp( unconditionedOut );
// If we're doing prepass blending then we need
// If we're doing deferred blending then we need
// to steal away the alpha channel before the
// conditioner stomps on it.
Var *alphaVal = NULL;
@ -174,7 +174,7 @@ void GBufferConditionerHLSL::processPix( Vector<ShaderComponent*> &componentLis
}
// If using interlaced normals, invert the normal
if(fd.features[MFT_InterlacedPrePass])
if(fd.features[MFT_InterlacedDeferred])
{
// NOTE: Its safe to not call ShaderFeatureHLSL::addOutVpos() in the vertex
// shader as for SM 3.0 nothing is needed there.
@ -190,7 +190,7 @@ void GBufferConditionerHLSL::processPix( Vector<ShaderComponent*> &componentLis
meta->addStatement( new GenOp(" @ = @;", outputDecl, new GenOp( "float4(normalize(@), @)", gbNormal, depth ) ) );
meta->addStatement( assignOutput( unconditionedOut ) );
// If we have an alpha var then we're doing prepass lerp blending.
// If we have an alpha var then we're doing deferred lerp blending.
if ( alphaVal )
{
Var *outColor = (Var*)LangElement::find( getOutputTargetVarName( DefaultTarget ) );
@ -228,27 +228,27 @@ Var* GBufferConditionerHLSL::printMethodHeader( MethodType methodType, const Str
methodVar->setType("inline float4");
DecOp *methodDecl = new DecOp(methodVar);
Var *prepassSampler = new Var;
prepassSampler->setName("prepassSamplerVar");
prepassSampler->setType("sampler2D");
DecOp *prepassSamplerDecl = new DecOp(prepassSampler);
Var *deferredSampler = new Var;
deferredSampler->setName("deferredSamplerVar");
deferredSampler->setType("sampler2D");
DecOp *deferredSamplerDecl = new DecOp(deferredSampler);
Var *screenUV = new Var;
screenUV->setName("screenUVVar");
screenUV->setType("float2");
DecOp *screenUVDecl = new DecOp(screenUV);
Var *prepassTex = NULL;
DecOp *prepassTexDecl = NULL;
Var *deferredTex = NULL;
DecOp *deferredTexDecl = NULL;
if (isDirect3D11)
{
prepassSampler->setType("SamplerState");
prepassTex = new Var;
prepassTex->setName("prepassTexVar");
prepassTex->setType("Texture2D");
prepassTex->texture = true;
prepassTex->constNum = prepassSampler->constNum;
prepassTexDecl = new DecOp(prepassTex);
deferredSampler->setType("SamplerState");
deferredTex = new Var;
deferredTex->setName("deferredTexVar");
deferredTex->setType("Texture2D");
deferredTex->texture = true;
deferredTex->constNum = deferredSampler->constNum;
deferredTexDecl = new DecOp(deferredTex);
}
Var *bufferSample = new Var;
@ -257,9 +257,9 @@ Var* GBufferConditionerHLSL::printMethodHeader( MethodType methodType, const Str
DecOp *bufferSampleDecl = new DecOp(bufferSample);
if (isDirect3D11)
meta->addStatement(new GenOp("@(@, @, @)\r\n", methodDecl, prepassSamplerDecl, prepassTexDecl, screenUVDecl));
meta->addStatement(new GenOp("@(@, @, @)\r\n", methodDecl, deferredSamplerDecl, deferredTexDecl, screenUVDecl));
else
meta->addStatement( new GenOp( "@(@, @)\r\n", methodDecl, prepassSamplerDecl, screenUVDecl ) );
meta->addStatement( new GenOp( "@(@, @)\r\n", methodDecl, deferredSamplerDecl, screenUVDecl ) );
meta->addStatement( new GenOp( "{\r\n" ) );
@ -267,18 +267,18 @@ Var* GBufferConditionerHLSL::printMethodHeader( MethodType methodType, const Str
#ifdef TORQUE_OS_XENON
meta->addStatement( new GenOp( " @;\r\n", bufferSampleDecl ) );
meta->addStatement( new GenOp( " asm { tfetch2D @, @, @, MagFilter = point, MinFilter = point, MipFilter = point };\r\n", bufferSample, screenUV, prepassSampler ) );
meta->addStatement( new GenOp( " asm { tfetch2D @, @, @, MagFilter = point, MinFilter = point, MipFilter = point };\r\n", bufferSample, screenUV, deferredSampler ) );
#else
// The gbuffer has no mipmaps, so use tex2dlod when
// possible so that the shader compiler can optimize.
meta->addStatement( new GenOp( " #if TORQUE_SM >= 30\r\n" ) );
if (isDirect3D11)
meta->addStatement(new GenOp(" @ = @.SampleLevel(@, @,0);\r\n", bufferSampleDecl, prepassTex, prepassSampler, screenUV));
meta->addStatement(new GenOp(" @ = @.SampleLevel(@, @,0);\r\n", bufferSampleDecl, deferredTex, deferredSampler, screenUV));
else
meta->addStatement(new GenOp(" @ = tex2Dlod(@, float4(@,0,0));\r\n", bufferSampleDecl, prepassSampler, screenUV));
meta->addStatement(new GenOp(" @ = tex2Dlod(@, float4(@,0,0));\r\n", bufferSampleDecl, deferredSampler, screenUV));
meta->addStatement(new GenOp(" #else\r\n"));
meta->addStatement(new GenOp(" @ = tex2D(@, @);\r\n", bufferSampleDecl, prepassSampler, screenUV));
meta->addStatement(new GenOp(" @ = tex2D(@, @);\r\n", bufferSampleDecl, deferredSampler, screenUV));
meta->addStatement(new GenOp(" #endif\r\n\r\n"));
#endif

View file

@ -39,7 +39,7 @@
#include "materials/materialFeatureTypes.h"
#include "math/util/frustum.h"
#include "scene/sceneObject.h"
#include "renderInstance/renderPrePassMgr.h"
#include "renderInstance/renderDeferredMgr.h"
#include "shaderGen/featureMgr.h"
#include "shaderGen/HLSL/shaderFeatureHLSL.h"
#include "shaderGen/HLSL/bumpHLSL.h"
@ -184,8 +184,8 @@ void BasicLightManager::activate( SceneManager *sceneManager )
FEATUREMGR->unregisterFeature( MFT_MinnaertShading );
FEATUREMGR->unregisterFeature( MFT_SubSurface );
// First look for the prepass bin...
RenderPrePassMgr *prePassBin = _findPrePassRenderBin();
// First look for the deferred bin...
RenderDeferredMgr *prePassBin = _findDeferredRenderBin();
/*
// If you would like to use forward shading, and have a linear depth pre-pass
@ -204,19 +204,19 @@ void BasicLightManager::activate( SceneManager *sceneManager )
// Uncomment this for a no-color-write z-fill pass.
//linearDepthFormat = GFXFormat_COUNT;
prePassBin = new RenderPrePassMgr( linearDepthFormat != GFXFormat_COUNT, linearDepthFormat );
prePassBin = new RenderDeferredMgr( linearDepthFormat != GFXFormat_COUNT, linearDepthFormat );
prePassBin->registerObject();
rpm->addManager( prePassBin );
}
*/
mPrePassRenderBin = prePassBin;
mDeferredRenderBin = prePassBin;
// If there is a prepass bin
MATMGR->setPrePassEnabled( mPrePassRenderBin.isValid() );
sceneManager->setPostEffectFog( mPrePassRenderBin.isValid() && mPrePassRenderBin->getTargetChainLength() > 0 );
// If there is a deferred bin
MATMGR->setDeferredEnabled( mDeferredRenderBin.isValid() );
sceneManager->setPostEffectFog( mDeferredRenderBin.isValid() && mDeferredRenderBin->getTargetChainLength() > 0 );
// Tell the material manager that we don't use prepass.
MATMGR->setPrePassEnabled( false );
// Tell the material manager that we don't use deferred.
MATMGR->setDeferredEnabled( false );
GFXShader::addGlobalMacro( "TORQUE_BASIC_LIGHTING" );
@ -241,9 +241,9 @@ void BasicLightManager::deactivate()
}
mConstantLookup.clear();
if ( mPrePassRenderBin )
mPrePassRenderBin->deleteObject();
mPrePassRenderBin = NULL;
if ( mDeferredRenderBin )
mDeferredRenderBin->deleteObject();
mDeferredRenderBin = NULL;
GFXShader::removeGlobalMacro( "TORQUE_BASIC_LIGHTING" );

View file

@ -41,7 +41,7 @@
class AvailableSLInterfaces;
class GFXShaderConstHandle;
class RenderPrePassMgr;
class RenderDeferredMgr;
class PlatformTimer;
class blTerrainSystem;
@ -77,7 +77,7 @@ protected:
BasicLightManager();
virtual ~BasicLightManager();
SimObjectPtr<RenderPrePassMgr> mPrePassRenderBin;
SimObjectPtr<RenderDeferredMgr> mDeferredRenderBin;
struct LightingShaderConstants
{

View file

@ -36,7 +36,7 @@
#include "T3D/gameBase/gameConnection.h"
#include "gfx/gfxStringEnumTranslate.h"
#include "console/engineAPI.h"
#include "renderInstance/renderPrePassMgr.h"
#include "renderInstance/renderDeferredMgr.h"
Signal<void(const char*,bool)> LightManager::smActivateSignal;
@ -419,15 +419,15 @@ bool LightManager::lightScene( const char* callback, const char* param )
return sl->lightScene( callback, flags );
}
RenderPrePassMgr* LightManager::_findPrePassRenderBin()
RenderDeferredMgr* LightManager::_findDeferredRenderBin()
{
RenderPassManager* rpm = getSceneManager()->getDefaultRenderPass();
for( U32 i = 0; i < rpm->getManagerCount(); i++ )
{
RenderBinManager *bin = rpm->getManager( i );
if( bin->getRenderInstType() == RenderPrePassMgr::RIT_PrePass )
if( bin->getRenderInstType() == RenderDeferredMgr::RIT_Deferred )
{
return ( RenderPrePassMgr* ) bin;
return ( RenderDeferredMgr* ) bin;
}
}

View file

@ -49,7 +49,7 @@ class GFXShaderConstBuffer;
class GFXShaderConstHandle;
class ShaderConstHandles;
class SceneRenderState;
class RenderPrePassMgr;
class RenderDeferredMgr;
class Frustum;
///
@ -167,7 +167,7 @@ protected:
static LightManager *smActiveLM;
/// Find the pre-pass render bin on the scene's default render pass.
RenderPrePassMgr* _findPrePassRenderBin();
RenderDeferredMgr* _findDeferredRenderBin();
/// This helper function sets the shader constansts
/// for the stock 4 light forward lighting code.

View file

@ -519,7 +519,7 @@ void LightingShaderConstants::init(GFXShader* shader)
mLightSpotParamsSC = shader->getShaderConstHandle("$lightSpotParams");
// NOTE: These are the shader constants used for doing lighting
// during the forward pass. Do not confuse these for the prepass
// during the forward pass. Do not confuse these for the deferred
// lighting constants which are used from AdvancedLightBinManager.
mLightPositionSC = shader->getShaderConstHandle( ShaderGenVars::lightPosition );
mLightDiffuseSC = shader->getShaderConstHandle( ShaderGenVars::lightDiffuse );

View file

@ -82,7 +82,7 @@ struct LightingShaderConstants
// NOTE: These are the shader constants used for doing
// lighting during the forward pass. Do not confuse
// these for the prepass lighting constants which are
// these for the deferred lighting constants which are
// used from AdvancedLightBinManager.
GFXShaderConstHandle *mLightPositionSC;
GFXShaderConstHandle *mLightDiffuseSC;

View file

@ -90,7 +90,7 @@ void ShadowMaterialHook::init( BaseMatInstance *inMat )
forced.setBlend( false );
forced.setAlphaTest( false );
// We should force on zwrite as the prepass
// We should force on zwrite as the deferred
// will disable it by default.
forced.setZReadWrite( true, true );

View file

@ -77,7 +77,7 @@ protected:
/// It is up to the derived class to set this variable appropriately.
bool mIsValid;
/// This is set by initialization and used by the prepass.
/// This is set by initialization and used by the deferred.
bool mHasNormalMaps;
/// This material makes use of bone transforms

View file

@ -73,13 +73,13 @@ ImplementFeatureType( MFT_IsEmissive, U32(-1), -1, true );
ImplementFeatureType( MFT_GlossMap, U32(-1), -1, true );
ImplementFeatureType( MFT_DiffuseMapAtlas, U32(-1), -1, true );
ImplementFeatureType( MFT_NormalMapAtlas, U32(-1), -1, true );
ImplementFeatureType( MFT_InterlacedPrePass, U32(-1), -1, true );
ImplementFeatureType( MFT_InterlacedDeferred, U32(-1), -1, true );
ImplementFeatureType( MFT_ParaboloidVertTransform, MFG_Transform, -1, false );
ImplementFeatureType( MFT_IsSinglePassParaboloid, U32(-1), -1, false );
ImplementFeatureType( MFT_EyeSpaceDepthOut, MFG_PostLighting, 2.0f, false );
ImplementFeatureType( MFT_DepthOut, MFG_PostLighting, 3.0f, false );
ImplementFeatureType( MFT_PrePassConditioner, MFG_PostProcess, 1.0f, false );
ImplementFeatureType( MFT_DeferredConditioner, MFG_PostProcess, 1.0f, false );
ImplementFeatureType( MFT_NormalsOut, MFG_PreLighting, 1.0f, false );
ImplementFeatureType( MFT_LightbufferMRT, MFG_PreLighting, 1.0f, false );

View file

@ -150,8 +150,8 @@ DeclareFeatureType( MFT_Fog );
DeclareFeatureType( MFT_HDROut );
///
DeclareFeatureType( MFT_PrePassConditioner );
DeclareFeatureType( MFT_InterlacedPrePass );
DeclareFeatureType( MFT_DeferredConditioner );
DeclareFeatureType( MFT_InterlacedDeferred );
/// This feature causes MFT_ToneMap and MFT_LightMap to output their light color
/// to the second render-target

View file

@ -68,7 +68,7 @@ MaterialManager::MaterialManager()
mMaterialSet = NULL;
mUsingPrePass = false;
mUsingDeferred = false;
mFlushAndReInit = false;

View file

@ -79,11 +79,11 @@ public:
/// Gets the global warning material instance, callers should not free this copy
BaseMatInstance * getWarningMatInstance();
/// Set the prepass enabled state.
void setPrePassEnabled( bool enabled ) { mUsingPrePass = enabled; }
/// Set the deferred enabled state.
void setDeferredEnabled( bool enabled ) { mUsingDeferred = enabled; }
/// Get the prepass enabled state.
bool getPrePassEnabled() const { return mUsingPrePass; }
/// Get the deferred enabled state.
bool getDeferredEnabled() const { return mUsingDeferred; }
#ifndef TORQUE_SHIPPING
@ -153,7 +153,7 @@ protected:
typedef Map<String, String> MaterialMap;
MaterialMap mMaterialMap;
bool mUsingPrePass;
bool mUsingDeferred;
// time tracking
F32 mDt;

View file

@ -288,9 +288,9 @@ void ProcessedMaterial::_initPassStateBlock( RenderPassData *rpd, GFXStateBlockD
}
}
// The prepass will take care of writing to the
// The deferred will take care of writing to the
// zbuffer, so we don't have to by default.
if ( MATMGR->getPrePassEnabled() &&
if ( MATMGR->getDeferredEnabled() &&
!mFeatures.hasFeature(MFT_ForwardShading))
result.setZReadWrite( result.zEnable, false );
@ -350,7 +350,7 @@ U32 ProcessedMaterial::_getRenderStateIndex( const SceneRenderState *sceneState,
if ( sceneState && sceneState->isReflectPass() )
currState |= RenderPassData::STATE_REFLECT;
if ( sgData.binType != SceneData::PrePassBin &&
if ( sgData.binType != SceneData::DeferredBin &&
mMaterial->isTranslucent() )
currState |= RenderPassData::STATE_TRANSLUCENT;

View file

@ -301,7 +301,7 @@ void ProcessedShaderMaterial::_determineFeatures( U32 stageNum,
if ( mMaterial->isTranslucent() )
{
// Note: This is for decal blending into the prepass
// Note: This is for decal blending into the deferred
// for AL... it probably needs to be made clearer.
if ( mMaterial->mTranslucentBlendOp == Material::LerpAlpha &&
mMaterial->mTranslucentZWrite )
@ -318,11 +318,11 @@ void ProcessedShaderMaterial::_determineFeatures( U32 stageNum,
if ( dStrcmp( LIGHTMGR->getId(), "BLM" ) == 0 )
fd.features.addFeature( MFT_ForwardShading );
// Disabling the InterlacedPrePass feature for now. It is not ready for prime-time
// Disabling the InterlacedDeferred feature for now. It is not ready for prime-time
// and it should not be triggered off of the DoubleSided parameter. [2/5/2010 Pat]
/*if ( mMaterial->isDoubleSided() )
{
fd.features.addFeature( MFT_InterlacedPrePass );
fd.features.addFeature( MFT_InterlacedDeferred );
}*/
// Allow instancing if it was requested and the card supports

View file

@ -49,9 +49,9 @@ struct SceneData
/// @see RenderGlowMgr
GlowBin,
/// The prepass render bin.
/// @RenderPrePassMgr
PrePassBin,
/// The deferred render bin.
/// @RenderDeferredMgr
DeferredBin,
};
/// This defines when we're rendering a special bin

View file

@ -21,7 +21,7 @@
//-----------------------------------------------------------------------------
#include "platform/platform.h"
#include "renderInstance/renderPrePassMgr.h"
#include "renderInstance/renderDeferredMgr.h"
#include "gfx/gfxTransformSaver.h"
#include "materials/sceneData.h"
@ -51,40 +51,40 @@
#include "materials/shaderData.h"
#include "gfx/sim/cubemapData.h"
const MatInstanceHookType PrePassMatInstanceHook::Type( "PrePass" );
const String RenderPrePassMgr::BufferName("prepass");
const RenderInstType RenderPrePassMgr::RIT_PrePass("PrePass");
const String RenderPrePassMgr::ColorBufferName("color");
const String RenderPrePassMgr::MatInfoBufferName("matinfo");
const MatInstanceHookType DeferredMatInstanceHook::Type( "Deferred" );
const String RenderDeferredMgr::BufferName("deferred");
const RenderInstType RenderDeferredMgr::RIT_Deferred("Deferred");
const String RenderDeferredMgr::ColorBufferName("color");
const String RenderDeferredMgr::MatInfoBufferName("matinfo");
IMPLEMENT_CONOBJECT(RenderPrePassMgr);
IMPLEMENT_CONOBJECT(RenderDeferredMgr);
ConsoleDocClass( RenderPrePassMgr,
"@brief The render bin which performs a z+normals prepass used in Advanced Lighting.\n\n"
ConsoleDocClass( RenderDeferredMgr,
"@brief The render bin which performs a z+normals deferred used in Advanced Lighting.\n\n"
"This render bin is used in Advanced Lighting to gather all opaque mesh render instances "
"and render them to the g-buffer for use in lighting the scene and doing effects.\n\n"
"PostEffect and other shaders can access the output of this bin by using the #prepass "
"PostEffect and other shaders can access the output of this bin by using the #deferred "
"texture target name. See the edge anti-aliasing post effect for an example.\n\n"
"@see game/core/scripts/client/postFx/edgeAA.cs\n"
"@ingroup RenderBin\n" );
RenderPrePassMgr::RenderSignal& RenderPrePassMgr::getRenderSignal()
RenderDeferredMgr::RenderSignal& RenderDeferredMgr::getRenderSignal()
{
static RenderSignal theSignal;
return theSignal;
}
RenderPrePassMgr::RenderPrePassMgr( bool gatherDepth,
RenderDeferredMgr::RenderDeferredMgr( bool gatherDepth,
GFXFormat format )
: Parent( RIT_PrePass,
: Parent( RIT_Deferred,
0.01f,
0.01f,
format,
Point2I( Parent::DefaultTargetSize, Parent::DefaultTargetSize),
gatherDepth ? Parent::DefaultTargetChainLength : 0 ),
mPrePassMatInstance( NULL )
mDeferredMatInstance( NULL )
{
notifyType( RenderPassManager::RIT_Decal );
notifyType( RenderPassManager::RIT_DecalRoad );
@ -107,30 +107,30 @@ RenderPrePassMgr::RenderPrePassMgr( bool gatherDepth,
_registerFeatures();
}
RenderPrePassMgr::~RenderPrePassMgr()
RenderDeferredMgr::~RenderDeferredMgr()
{
GFXShader::removeGlobalMacro( "TORQUE_LINEAR_DEPTH" );
mColorTarget.release();
mMatInfoTarget.release();
_unregisterFeatures();
SAFE_DELETE( mPrePassMatInstance );
SAFE_DELETE( mDeferredMatInstance );
}
void RenderPrePassMgr::_registerFeatures()
void RenderDeferredMgr::_registerFeatures()
{
ConditionerFeature *cond = new LinearEyeDepthConditioner( getTargetFormat() );
FEATUREMGR->registerFeature( MFT_PrePassConditioner, cond );
FEATUREMGR->registerFeature( MFT_DeferredConditioner, cond );
mNamedTarget.setConditioner( cond );
}
void RenderPrePassMgr::_unregisterFeatures()
void RenderDeferredMgr::_unregisterFeatures()
{
mNamedTarget.setConditioner( NULL );
FEATUREMGR->unregisterFeature(MFT_PrePassConditioner);
FEATUREMGR->unregisterFeature(MFT_DeferredConditioner);
}
bool RenderPrePassMgr::setTargetSize(const Point2I &newTargetSize)
bool RenderDeferredMgr::setTargetSize(const Point2I &newTargetSize)
{
bool ret = Parent::setTargetSize( newTargetSize );
mNamedTarget.setViewport( GFX->getViewport() );
@ -139,14 +139,14 @@ bool RenderPrePassMgr::setTargetSize(const Point2I &newTargetSize)
return ret;
}
bool RenderPrePassMgr::_updateTargets()
bool RenderDeferredMgr::_updateTargets()
{
PROFILE_SCOPE(RenderPrePassMgr_updateTargets);
PROFILE_SCOPE(RenderDeferredMgr_updateTargets);
bool ret = Parent::_updateTargets();
// check for an output conditioner, and update it's format
ConditionerFeature *outputConditioner = dynamic_cast<ConditionerFeature *>(FEATUREMGR->getByType(MFT_PrePassConditioner));
ConditionerFeature *outputConditioner = dynamic_cast<ConditionerFeature *>(FEATUREMGR->getByType(MFT_DeferredConditioner));
if( outputConditioner && outputConditioner->setBufferFormat(mTargetFormat) )
{
// reload materials, the conditioner needs to alter the generated shaders
@ -193,7 +193,7 @@ bool RenderPrePassMgr::_updateTargets()
// lightmapped geometry in the scene.
AdvancedLightBinManager *lightBin;
if ( Sim::findObject( "AL_LightBinMgr", lightBin ) &&
lightBin->MRTLightmapsDuringPrePass() &&
lightBin->MRTLightmapsDuringDeferred() &&
lightBin->isProperlyAdded() )
{
// Update the size of the light bin target here. This will call _updateTargets
@ -218,28 +218,28 @@ bool RenderPrePassMgr::_updateTargets()
return ret;
}
void RenderPrePassMgr::_createPrePassMaterial()
void RenderDeferredMgr::_createDeferredMaterial()
{
SAFE_DELETE(mPrePassMatInstance);
SAFE_DELETE(mDeferredMatInstance);
const GFXVertexFormat *vertexFormat = getGFXVertexFormat<GFXVertexPNTTB>();
MatInstance* prepassMat = static_cast<MatInstance*>(MATMGR->createMatInstance("AL_DefaultPrePassMaterial", vertexFormat));
AssertFatal( prepassMat, "TODO: Handle this better." );
mPrePassMatInstance = new PrePassMatInstance(prepassMat, this);
mPrePassMatInstance->init( MATMGR->getDefaultFeatures(), vertexFormat);
delete prepassMat;
MatInstance* deferredMat = static_cast<MatInstance*>(MATMGR->createMatInstance("AL_DefaultDeferredMaterial", vertexFormat));
AssertFatal( deferredMat, "TODO: Handle this better." );
mDeferredMatInstance = new DeferredMatInstance(deferredMat, this);
mDeferredMatInstance->init( MATMGR->getDefaultFeatures(), vertexFormat);
delete deferredMat;
}
void RenderPrePassMgr::setPrePassMaterial( PrePassMatInstance *mat )
void RenderDeferredMgr::setDeferredMaterial( DeferredMatInstance *mat )
{
SAFE_DELETE(mPrePassMatInstance);
mPrePassMatInstance = mat;
SAFE_DELETE(mDeferredMatInstance);
mDeferredMatInstance = mat;
}
void RenderPrePassMgr::addElement( RenderInst *inst )
void RenderDeferredMgr::addElement( RenderInst *inst )
{
PROFILE_SCOPE( RenderPrePassMgr_addElement )
PROFILE_SCOPE( RenderDeferredMgr_addElement )
// Skip out if this bin is disabled.
if ( gClientSceneGraph->getCurrentRenderState() &&
@ -269,8 +269,8 @@ void RenderPrePassMgr::addElement( RenderInst *inst )
static_cast<CustomMaterial*>(matInst->getMaterial())->mRefract)
return;
// Make sure we got a prepass material.
matInst = getPrePassMaterial(matInst);
// Make sure we got a deferred material.
matInst = getDeferredMaterial(matInst);
if (!matInst || !matInst->isValid())
return;
}
@ -302,36 +302,36 @@ void RenderPrePassMgr::addElement( RenderInst *inst )
elem.key2 = originalKey;
}
void RenderPrePassMgr::sort()
void RenderDeferredMgr::sort()
{
PROFILE_SCOPE( RenderPrePassMgr_sort );
PROFILE_SCOPE( RenderDeferredMgr_sort );
Parent::sort();
dQsort( mTerrainElementList.address(), mTerrainElementList.size(), sizeof(MainSortElem), cmpKeyFunc);
dQsort( mObjectElementList.address(), mObjectElementList.size(), sizeof(MainSortElem), cmpKeyFunc);
}
void RenderPrePassMgr::clear()
void RenderDeferredMgr::clear()
{
Parent::clear();
mTerrainElementList.clear();
mObjectElementList.clear();
}
void RenderPrePassMgr::render( SceneRenderState *state )
void RenderDeferredMgr::render( SceneRenderState *state )
{
PROFILE_SCOPE(RenderPrePassMgr_render);
PROFILE_SCOPE(RenderDeferredMgr_render);
// Take a look at the SceneRenderState and see if we should skip drawing the pre-pass
if ( state->disableAdvancedLightingBins() )
return;
// NOTE: We don't early out here when the element list is
// zero because we need the prepass to be cleared.
// zero because we need the deferred to be cleared.
// Automagically save & restore our viewport and transforms.
GFXTransformSaver saver;
GFXDEBUGEVENT_SCOPE( RenderPrePassMgr_Render, ColorI::RED );
GFXDEBUGEVENT_SCOPE( RenderDeferredMgr_Render, ColorI::RED );
// Tell the superclass we're about to render
const bool isRenderingToTarget = _onPreRender(state);
@ -344,13 +344,13 @@ void RenderPrePassMgr::render( SceneRenderState *state )
matrixSet.restoreSceneViewProjection();
const MatrixF worldViewXfm = GFX->getWorldMatrix();
// Setup the default prepass material for object instances.
if ( !mPrePassMatInstance )
_createPrePassMaterial();
if ( mPrePassMatInstance )
// Setup the default deferred material for object instances.
if ( !mDeferredMatInstance )
_createDeferredMaterial();
if ( mDeferredMatInstance )
{
matrixSet.setWorld(MatrixF::Identity);
mPrePassMatInstance->setTransforms(matrixSet, state);
mDeferredMatInstance->setTransforms(matrixSet, state);
}
// Signal start of pre-pass
@ -361,16 +361,16 @@ void RenderPrePassMgr::render( SceneRenderState *state )
// on the smaller meshes and objects.
// The terrain doesn't need any scene graph data
// in the the prepass... so just clear it.
// in the the deferred... so just clear it.
SceneData sgData;
sgData.init( state, SceneData::PrePassBin );
sgData.init( state, SceneData::DeferredBin );
Vector< MainSortElem >::const_iterator itr = mTerrainElementList.begin();
for ( ; itr != mTerrainElementList.end(); itr++ )
{
TerrainRenderInst *ri = static_cast<TerrainRenderInst*>( itr->inst );
TerrainCellMaterial *mat = ri->cellMat->getPrePassMat();
TerrainCellMaterial *mat = ri->cellMat->getDeferredMat();
GFX->setPrimitiveBuffer( ri->primBuff );
GFX->setVertexBuffer( ri->vertBuff );
@ -396,8 +396,8 @@ void RenderPrePassMgr::render( SceneRenderState *state )
{
MeshRenderInst *ri = static_cast<MeshRenderInst*>( itr->inst );
// Get the prepass material.
BaseMatInstance *mat = getPrePassMaterial( ri->matInst );
// Get the deferred material.
BaseMatInstance *mat = getDeferredMaterial( ri->matInst );
// Set up SG data proper like and flag it
// as a pre-pass render
@ -414,9 +414,9 @@ void RenderPrePassMgr::render( SceneRenderState *state )
// Check to see if we need to break this batch.
//
// NOTE: We're comparing the non-prepass materials
// NOTE: We're comparing the non-deferred materials
// here so we don't incur the cost of looking up the
// prepass hook on each inst.
// deferred hook on each inst.
//
if ( newPassNeeded( ri, passRI ) )
break;
@ -523,7 +523,7 @@ void RenderPrePassMgr::render( SceneRenderState *state )
{
ObjectRenderInst *ri = static_cast<ObjectRenderInst*>( itr->inst );
if ( ri->renderDelegate )
ri->renderDelegate( ri, state, mPrePassMatInstance );
ri->renderDelegate( ri, state, mDeferredMatInstance );
}
// Signal end of pre-pass
@ -533,7 +533,7 @@ void RenderPrePassMgr::render( SceneRenderState *state )
_onPostRender();
}
const GFXStateBlockDesc & RenderPrePassMgr::getOpaqueStenciWriteDesc( bool lightmappedGeometry /*= true*/ )
const GFXStateBlockDesc & RenderDeferredMgr::getOpaqueStenciWriteDesc( bool lightmappedGeometry /*= true*/ )
{
static bool sbInit = false;
static GFXStateBlockDesc sOpaqueStaticLitStencilWriteDesc;
@ -548,7 +548,7 @@ const GFXStateBlockDesc & RenderPrePassMgr::getOpaqueStenciWriteDesc( bool light
sOpaqueStaticLitStencilWriteDesc.stencilEnable = true;
sOpaqueStaticLitStencilWriteDesc.stencilWriteMask = 0x03;
sOpaqueStaticLitStencilWriteDesc.stencilMask = 0x03;
sOpaqueStaticLitStencilWriteDesc.stencilRef = RenderPrePassMgr::OpaqueStaticLitMask;
sOpaqueStaticLitStencilWriteDesc.stencilRef = RenderDeferredMgr::OpaqueStaticLitMask;
sOpaqueStaticLitStencilWriteDesc.stencilPassOp = GFXStencilOpReplace;
sOpaqueStaticLitStencilWriteDesc.stencilFailOp = GFXStencilOpKeep;
sOpaqueStaticLitStencilWriteDesc.stencilZFailOp = GFXStencilOpKeep;
@ -556,13 +556,13 @@ const GFXStateBlockDesc & RenderPrePassMgr::getOpaqueStenciWriteDesc( bool light
// Same only dynamic
sOpaqueDynamicLitStencilWriteDesc = sOpaqueStaticLitStencilWriteDesc;
sOpaqueDynamicLitStencilWriteDesc.stencilRef = RenderPrePassMgr::OpaqueDynamicLitMask;
sOpaqueDynamicLitStencilWriteDesc.stencilRef = RenderDeferredMgr::OpaqueDynamicLitMask;
}
return (lightmappedGeometry ? sOpaqueStaticLitStencilWriteDesc : sOpaqueDynamicLitStencilWriteDesc);
}
const GFXStateBlockDesc & RenderPrePassMgr::getOpaqueStencilTestDesc()
const GFXStateBlockDesc & RenderDeferredMgr::getOpaqueStencilTestDesc()
{
static bool sbInit = false;
static GFXStateBlockDesc sOpaqueStencilTestDesc;
@ -589,13 +589,13 @@ const GFXStateBlockDesc & RenderPrePassMgr::getOpaqueStencilTestDesc()
//------------------------------------------------------------------------------
ProcessedPrePassMaterial::ProcessedPrePassMaterial( Material& mat, const RenderPrePassMgr *prePassMgr )
: Parent(mat), mPrePassMgr(prePassMgr)
ProcessedDeferredMaterial::ProcessedDeferredMaterial( Material& mat, const RenderDeferredMgr *prePassMgr )
: Parent(mat), mDeferredMgr(prePassMgr)
{
}
void ProcessedPrePassMaterial::_determineFeatures( U32 stageNum,
void ProcessedDeferredMaterial::_determineFeatures( U32 stageNum,
MaterialFeatureData &fd,
const FeatureSet &features )
{
@ -605,7 +605,7 @@ void ProcessedPrePassMaterial::_determineFeatures( U32 stageNum,
bool bEnableMRTLightmap = false;
AdvancedLightBinManager *lightBin;
if ( Sim::findObject( "AL_LightBinMgr", lightBin ) )
bEnableMRTLightmap = lightBin->MRTLightmapsDuringPrePass();
bEnableMRTLightmap = lightBin->MRTLightmapsDuringDeferred();
// If this material has a lightmap or tonemap (texture or baked vertex color),
// it must be static. Otherwise it is dynamic.
@ -617,17 +617,17 @@ void ProcessedPrePassMaterial::_determineFeatures( U32 stageNum,
fd.features.hasFeature( MFT_IsTranslucentZWrite) ) ) );
// Integrate proper opaque stencil write state
mUserDefined.addDesc( mPrePassMgr->getOpaqueStenciWriteDesc( mIsLightmappedGeometry ) );
mUserDefined.addDesc( mDeferredMgr->getOpaqueStenciWriteDesc( mIsLightmappedGeometry ) );
FeatureSet newFeatures;
// These are always on for prepass.
// These are always on for deferred.
newFeatures.addFeature( MFT_EyeSpaceDepthOut );
newFeatures.addFeature( MFT_PrePassConditioner );
newFeatures.addFeature( MFT_DeferredConditioner );
#ifndef TORQUE_DEDICATED
//tag all materials running through prepass as deferred
//tag all materials running through deferred as deferred
newFeatures.addFeature(MFT_isDeferred);
// Deferred Shading : Diffuse
@ -677,7 +677,7 @@ void ProcessedPrePassMaterial::_determineFeatures( U32 stageNum,
type == MFT_DetailNormalMap ||
type == MFT_AlphaTest ||
type == MFT_Parallax ||
type == MFT_InterlacedPrePass ||
type == MFT_InterlacedDeferred ||
type == MFT_Visibility ||
type == MFT_UseInstancing ||
type == MFT_DiffuseVertColor ||
@ -764,7 +764,7 @@ void ProcessedPrePassMaterial::_determineFeatures( U32 stageNum,
fd.features = newFeatures;
}
U32 ProcessedPrePassMaterial::getNumStages()
U32 ProcessedDeferredMaterial::getNumStages()
{
// Loops through all stages to determine how many
// stages we actually use.
@ -816,12 +816,12 @@ U32 ProcessedPrePassMaterial::getNumStages()
return numStages;
}
void ProcessedPrePassMaterial::addStateBlockDesc(const GFXStateBlockDesc& desc)
void ProcessedDeferredMaterial::addStateBlockDesc(const GFXStateBlockDesc& desc)
{
GFXStateBlockDesc prePassStateBlock = desc;
// Adjust color writes if this is a pure z-fill pass
const bool pixelOutEnabled = mPrePassMgr->getTargetChainLength() > 0;
const bool pixelOutEnabled = mDeferredMgr->getTargetChainLength() > 0;
if ( !pixelOutEnabled )
{
prePassStateBlock.colorWriteDefined = true;
@ -832,12 +832,12 @@ void ProcessedPrePassMaterial::addStateBlockDesc(const GFXStateBlockDesc& desc)
}
// Never allow the alpha test state when rendering
// the prepass as we use the alpha channel for the
// the deferred as we use the alpha channel for the
// depth information... MFT_AlphaTest will handle it.
prePassStateBlock.alphaDefined = true;
prePassStateBlock.alphaTestEnable = false;
// If we're translucent then we're doing prepass blending
// If we're translucent then we're doing deferred blending
// which never writes to the depth channels.
const bool isTranslucent = getMaterial()->isTranslucent();
if ( isTranslucent )
@ -853,24 +853,24 @@ void ProcessedPrePassMaterial::addStateBlockDesc(const GFXStateBlockDesc& desc)
Parent::addStateBlockDesc(prePassStateBlock);
}
PrePassMatInstance::PrePassMatInstance(MatInstance* root, const RenderPrePassMgr *prePassMgr)
: Parent(*root->getMaterial()), mPrePassMgr(prePassMgr)
DeferredMatInstance::DeferredMatInstance(MatInstance* root, const RenderDeferredMgr *prePassMgr)
: Parent(*root->getMaterial()), mDeferredMgr(prePassMgr)
{
mFeatureList = root->getRequestedFeatures();
mVertexFormat = root->getVertexFormat();
mUserObject = root->getUserObject();
}
PrePassMatInstance::~PrePassMatInstance()
DeferredMatInstance::~DeferredMatInstance()
{
}
ProcessedMaterial* PrePassMatInstance::getShaderMaterial()
ProcessedMaterial* DeferredMatInstance::getShaderMaterial()
{
return new ProcessedPrePassMaterial(*mMaterial, mPrePassMgr);
return new ProcessedDeferredMaterial(*mMaterial, mDeferredMgr);
}
bool PrePassMatInstance::init( const FeatureSet &features,
bool DeferredMatInstance::init( const FeatureSet &features,
const GFXVertexFormat *vertexFormat )
{
bool vaild = Parent::init(features, vertexFormat);
@ -891,27 +891,27 @@ bool PrePassMatInstance::init( const FeatureSet &features,
return vaild;
}
PrePassMatInstanceHook::PrePassMatInstanceHook( MatInstance *baseMatInst,
const RenderPrePassMgr *prePassMgr )
: mHookedPrePassMatInst(NULL), mPrePassManager(prePassMgr)
DeferredMatInstanceHook::DeferredMatInstanceHook( MatInstance *baseMatInst,
const RenderDeferredMgr *prePassMgr )
: mHookedDeferredMatInst(NULL), mDeferredManager(prePassMgr)
{
// If the material is a custom material then
// hope that using DefaultPrePassMaterial gives
// them a good prepass.
// hope that using DefaultDeferredMaterial gives
// them a good deferred.
if ( baseMatInst->isCustomMaterial() )
{
MatInstance* dummyInst = static_cast<MatInstance*>( MATMGR->createMatInstance( "AL_DefaultPrePassMaterial", baseMatInst->getVertexFormat() ) );
MatInstance* dummyInst = static_cast<MatInstance*>( MATMGR->createMatInstance( "AL_DefaultDeferredMaterial", baseMatInst->getVertexFormat() ) );
mHookedPrePassMatInst = new PrePassMatInstance( dummyInst, prePassMgr );
mHookedPrePassMatInst->init( dummyInst->getRequestedFeatures(), baseMatInst->getVertexFormat());
mHookedDeferredMatInst = new DeferredMatInstance( dummyInst, prePassMgr );
mHookedDeferredMatInst->init( dummyInst->getRequestedFeatures(), baseMatInst->getVertexFormat());
delete dummyInst;
return;
}
// Create the prepass material instance.
mHookedPrePassMatInst = new PrePassMatInstance(baseMatInst, prePassMgr);
mHookedPrePassMatInst->getFeaturesDelegate() = baseMatInst->getFeaturesDelegate();
// Create the deferred material instance.
mHookedDeferredMatInst = new DeferredMatInstance(baseMatInst, prePassMgr);
mHookedDeferredMatInst->getFeaturesDelegate() = baseMatInst->getFeaturesDelegate();
// Get the features, but remove the instancing feature if the
// original material didn't end up using it.
@ -920,12 +920,12 @@ PrePassMatInstanceHook::PrePassMatInstanceHook( MatInstance *baseMatInst,
features.removeFeature( MFT_UseInstancing );
// Initialize the material.
mHookedPrePassMatInst->init(features, baseMatInst->getVertexFormat());
mHookedDeferredMatInst->init(features, baseMatInst->getVertexFormat());
}
PrePassMatInstanceHook::~PrePassMatInstanceHook()
DeferredMatInstanceHook::~DeferredMatInstanceHook()
{
SAFE_DELETE(mHookedPrePassMatInst);
SAFE_DELETE(mHookedDeferredMatInst);
}
//------------------------------------------------------------------------------
@ -1027,10 +1027,10 @@ Var* LinearEyeDepthConditioner::printMethodHeader( MethodType methodType, const
methodVar->setType("inline float4");
DecOp *methodDecl = new DecOp(methodVar);
Var *prepassSampler = new Var;
prepassSampler->setName("prepassSamplerVar");
prepassSampler->setType("sampler2D");
DecOp *prepassSamplerDecl = new DecOp(prepassSampler);
Var *deferredSampler = new Var;
deferredSampler->setName("deferredSamplerVar");
deferredSampler->setType("sampler2D");
DecOp *deferredSamplerDecl = new DecOp(deferredSampler);
Var *screenUV = new Var;
screenUV->setName("screenUVVar");
@ -1048,7 +1048,7 @@ Var* LinearEyeDepthConditioner::printMethodHeader( MethodType methodType, const
bufferSample->setType("float4");
DecOp *bufferSampleDecl = new DecOp(bufferSample);
meta->addStatement( new GenOp( "@(@, @)\r\n", methodDecl, prepassSamplerDecl, screenUVDecl ) );
meta->addStatement( new GenOp( "@(@, @)\r\n", methodDecl, deferredSamplerDecl, screenUVDecl ) );
meta->addStatement( new GenOp( "{\r\n" ) );
@ -1058,14 +1058,14 @@ Var* LinearEyeDepthConditioner::printMethodHeader( MethodType methodType, const
// possible so that the shader compiler can optimize.
meta->addStatement( new GenOp( " #if TORQUE_SM >= 30\r\n" ) );
if (GFX->getAdapterType() == OpenGL)
meta->addStatement( new GenOp( " @ = textureLod(@, @, 0); \r\n", bufferSampleDecl, prepassSampler, screenUV) );
meta->addStatement( new GenOp( " @ = textureLod(@, @, 0); \r\n", bufferSampleDecl, deferredSampler, screenUV) );
else
meta->addStatement( new GenOp( " @ = tex2Dlod(@, float4(@,0,0));\r\n", bufferSampleDecl, prepassSampler, screenUV ) );
meta->addStatement( new GenOp( " @ = tex2Dlod(@, float4(@,0,0));\r\n", bufferSampleDecl, deferredSampler, screenUV ) );
meta->addStatement( new GenOp( " #else\r\n" ) );
if (GFX->getAdapterType() == OpenGL)
meta->addStatement( new GenOp( " @ = texture(@, @);\r\n", bufferSampleDecl, prepassSampler, screenUV) );
meta->addStatement( new GenOp( " @ = texture(@, @);\r\n", bufferSampleDecl, deferredSampler, screenUV) );
else
meta->addStatement( new GenOp( " @ = tex2D(@, @);\r\n", bufferSampleDecl, prepassSampler, screenUV ) );
meta->addStatement( new GenOp( " @ = tex2D(@, @);\r\n", bufferSampleDecl, deferredSampler, screenUV ) );
meta->addStatement( new GenOp( " #endif\r\n\r\n" ) );
// We don't use this way of passing var's around, so this should cause a crash
@ -1076,7 +1076,7 @@ Var* LinearEyeDepthConditioner::printMethodHeader( MethodType methodType, const
return retVal;
}
void RenderPrePassMgr::_initShaders()
void RenderDeferredMgr::_initShaders()
{
if ( mClearGBufferShader ) return;
@ -1084,7 +1084,7 @@ void RenderPrePassMgr::_initShaders()
ShaderData *shaderData;
mClearGBufferShader = Sim::findObject( "ClearGBufferShader", shaderData ) ? shaderData->getShader() : NULL;
if ( !mClearGBufferShader )
Con::errorf( "RenderPrePassMgr::_initShaders - could not find ClearGBufferShader" );
Con::errorf( "RenderDeferredMgr::_initShaders - could not find ClearGBufferShader" );
// Create StateBlocks
GFXStateBlockDesc desc;
@ -1108,7 +1108,7 @@ void RenderPrePassMgr::_initShaders()
mSpecularPowerSC = mClearGBufferShader->getShaderConstHandle( "$specularPower" );
}
void RenderPrePassMgr::clearBuffers()
void RenderDeferredMgr::clearBuffers()
{
// Clear z-buffer.
GFX->clear( GFXClearTarget | GFXClearZBuffer | GFXClearStencil, ColorI::ZERO, 1.0f, 0);

View file

@ -29,12 +29,12 @@
#include "core/util/autoPtr.h"
// Forward declare
class PrePassMatInstance;
class DeferredMatInstance;
// This render manager renders opaque objects to the z-buffer as a z-fill pass.
// It can optionally accumulate data from this opaque render pass into a render
// target for later use.
class RenderPrePassMgr : public RenderTexTargetBinManager
class RenderDeferredMgr : public RenderTexTargetBinManager
{
typedef RenderTexTargetBinManager Parent;
@ -47,15 +47,15 @@ public:
static const String ColorBufferName;
static const String MatInfoBufferName;
// Generic PrePass Render Instance Type
static const RenderInstType RIT_PrePass;
// Generic Deferred Render Instance Type
static const RenderInstType RIT_Deferred;
RenderPrePassMgr( bool gatherDepth = true,
RenderDeferredMgr( bool gatherDepth = true,
GFXFormat format = GFXFormatR16G16B16A16 );
virtual ~RenderPrePassMgr();
virtual ~RenderDeferredMgr();
virtual void setPrePassMaterial( PrePassMatInstance *mat );
virtual void setDeferredMaterial( DeferredMatInstance *mat );
// RenderBinManager interface
virtual void render(SceneRenderState * state);
@ -64,10 +64,10 @@ public:
virtual void addElement( RenderInst *inst );
// ConsoleObject
DECLARE_CONOBJECT(RenderPrePassMgr);
DECLARE_CONOBJECT(RenderDeferredMgr);
typedef Signal<void(const SceneRenderState*, RenderPrePassMgr*, bool)> RenderSignal;
typedef Signal<void(const SceneRenderState*, RenderDeferredMgr*, bool)> RenderSignal;
static RenderSignal& getRenderSignal();
@ -79,7 +79,7 @@ public:
virtual bool setTargetSize(const Point2I &newTargetSize);
inline BaseMatInstance* getPrePassMaterial( BaseMatInstance *mat );
inline BaseMatInstance* getDeferredMaterial( BaseMatInstance *mat );
protected:
@ -89,12 +89,12 @@ protected:
/// The object render instance elements.
Vector< MainSortElem > mObjectElementList;
PrePassMatInstance *mPrePassMatInstance;
DeferredMatInstance *mDeferredMatInstance;
virtual void _registerFeatures();
virtual void _unregisterFeatures();
virtual bool _updateTargets();
virtual void _createPrePassMaterial();
virtual void _createDeferredMaterial();
bool _lightManagerActivate(bool active);
@ -117,12 +117,12 @@ public:
//------------------------------------------------------------------------------
class ProcessedPrePassMaterial : public ProcessedShaderMaterial
class ProcessedDeferredMaterial : public ProcessedShaderMaterial
{
typedef ProcessedShaderMaterial Parent;
public:
ProcessedPrePassMaterial(Material& mat, const RenderPrePassMgr *prePassMgr);
ProcessedDeferredMaterial(Material& mat, const RenderDeferredMgr *prePassMgr);
virtual U32 getNumStages();
@ -131,19 +131,19 @@ public:
protected:
virtual void _determineFeatures( U32 stageNum, MaterialFeatureData &fd, const FeatureSet &features );
const RenderPrePassMgr *mPrePassMgr;
const RenderDeferredMgr *mDeferredMgr;
bool mIsLightmappedGeometry;
};
//------------------------------------------------------------------------------
class PrePassMatInstance : public MatInstance
class DeferredMatInstance : public MatInstance
{
typedef MatInstance Parent;
public:
PrePassMatInstance(MatInstance* root, const RenderPrePassMgr *prePassMgr);
virtual ~PrePassMatInstance();
DeferredMatInstance(MatInstance* root, const RenderDeferredMgr *prePassMgr);
virtual ~DeferredMatInstance();
bool init()
{
@ -157,27 +157,27 @@ public:
protected:
virtual ProcessedMaterial* getShaderMaterial();
const RenderPrePassMgr *mPrePassMgr;
const RenderDeferredMgr *mDeferredMgr;
};
//------------------------------------------------------------------------------
class PrePassMatInstanceHook : public MatInstanceHook
class DeferredMatInstanceHook : public MatInstanceHook
{
public:
PrePassMatInstanceHook(MatInstance *baseMatInst, const RenderPrePassMgr *prePassMgr);
virtual ~PrePassMatInstanceHook();
DeferredMatInstanceHook(MatInstance *baseMatInst, const RenderDeferredMgr *prePassMgr);
virtual ~DeferredMatInstanceHook();
virtual PrePassMatInstance *getPrePassMatInstance() { return mHookedPrePassMatInst; }
virtual DeferredMatInstance *getDeferredMatInstance() { return mHookedDeferredMatInst; }
virtual const MatInstanceHookType& getType() const { return Type; }
/// The type for prepass material hooks.
/// The type for deferred material hooks.
static const MatInstanceHookType Type;
protected:
PrePassMatInstance *mHookedPrePassMatInst;
const RenderPrePassMgr *mPrePassManager;
DeferredMatInstance *mHookedDeferredMatInst;
const RenderDeferredMgr *mDeferredManager;
};
//------------------------------------------------------------------------------
@ -208,16 +208,16 @@ protected:
};
inline BaseMatInstance* RenderPrePassMgr::getPrePassMaterial( BaseMatInstance *mat )
inline BaseMatInstance* RenderDeferredMgr::getDeferredMaterial( BaseMatInstance *mat )
{
PrePassMatInstanceHook *hook = static_cast<PrePassMatInstanceHook*>( mat->getHook( PrePassMatInstanceHook::Type ) );
DeferredMatInstanceHook *hook = static_cast<DeferredMatInstanceHook*>( mat->getHook( DeferredMatInstanceHook::Type ) );
if ( !hook )
{
hook = new PrePassMatInstanceHook( static_cast<MatInstance*>( mat ), this );
hook = new DeferredMatInstanceHook( static_cast<MatInstance*>( mat ), this );
mat->addHook( hook );
}
return hook->getPrePassMatInstance();
return hook->getDeferredMatInstance();
}
#endif // _PREPASS_MGR_H_

View file

@ -30,7 +30,7 @@
#include "lighting/lightInfo.h"
#include "scene/sceneRenderState.h"
#include "gfx/gfxDebugEvent.h"
#include "renderInstance/renderPrePassMgr.h"
#include "renderInstance/renderDeferredMgr.h"
#include "gfx/gfxTransformSaver.h"
#include "console/consoleTypes.h"
#include "gfx/util/screenspace.h"
@ -70,7 +70,7 @@ RenderImposterMgr::RenderImposterMgr( F32 renderOrder, F32 processAddOrder )
: RenderBinManager( RIT_Imposter, renderOrder, processAddOrder )
{
notifyType( RIT_ImposterBatch );
RenderPrePassMgr::getRenderSignal().notify( this, &RenderImposterMgr::_renderPrePass );
RenderDeferredMgr::getRenderSignal().notify( this, &RenderImposterMgr::_renderDeferred );
}
void RenderImposterMgr::initPersistFields()
@ -88,7 +88,7 @@ void RenderImposterMgr::initPersistFields()
RenderImposterMgr::~RenderImposterMgr()
{
RenderPrePassMgr::getRenderSignal().remove( this, &RenderImposterMgr::_renderPrePass );
RenderDeferredMgr::getRenderSignal().remove( this, &RenderImposterMgr::_renderDeferred );
mIB = NULL;
}
@ -119,19 +119,19 @@ bool RenderImposterMgr::_clearStats( GFXDevice::GFXDeviceEventType type )
return true;
}
void RenderImposterMgr::_renderPrePass( const SceneRenderState *state, RenderPrePassMgr *prePassBin, bool startPrePass )
void RenderImposterMgr::_renderDeferred( const SceneRenderState *state, RenderDeferredMgr *prePassBin, bool startDeferred )
{
PROFILE_SCOPE( RenderImposterMgr_RenderPrePass );
PROFILE_SCOPE( RenderImposterMgr_RenderDeferred );
if ( !mElementList.size() || !startPrePass )
if ( !mElementList.size() || !startDeferred )
return;
GFXDEBUGEVENT_SCOPE( RenderImposterMgr_RenderPrePass, ColorI::RED );
GFXDEBUGEVENT_SCOPE( RenderImposterMgr_RenderDeferred, ColorI::RED );
_innerRender( state, prePassBin );
}
void RenderImposterMgr::_innerRender( const SceneRenderState *state, RenderPrePassMgr *prePassBin )
void RenderImposterMgr::_innerRender( const SceneRenderState *state, RenderDeferredMgr *prePassBin )
{
PROFILE_SCOPE( RenderImposterMgr_InnerRender );
@ -219,7 +219,7 @@ void RenderImposterMgr::_innerRender( const SceneRenderState *state, RenderPrePa
// list changes.
SceneData sgData;
sgData.init( state, prePassBin ? SceneData::PrePassBin : SceneData::RegularBin );
sgData.init( state, prePassBin ? SceneData::DeferredBin : SceneData::RegularBin );
sgData.lights[0] = LIGHTMGR->getDefaultLight();
// TODO: I should rework this loop to generate the VB first then
@ -232,7 +232,7 @@ void RenderImposterMgr::_innerRender( const SceneRenderState *state, RenderPrePa
for ( U32 i=0; i < binSize; )
{
currMat = static_cast<ImposterBaseRenderInst*>( mElementList[i].inst )->mat;
setupMat = prePassBin ? prePassBin->getPrePassMaterial( currMat ) : currMat;
setupMat = prePassBin ? prePassBin->getDeferredMaterial( currMat ) : currMat;
// TODO: Fix MatInstance to take a const SceneRenderState!
while ( setupMat->setupPass( (SceneRenderState*)state, sgData ) )

View file

@ -38,7 +38,7 @@
class TSLastDetail;
class GFXTextureObject;
class RenderPrePassMgr;
class RenderDeferredMgr;
struct ImposterRenderInst;
@ -74,9 +74,9 @@ protected:
GFXPrimitiveBufferHandle mIB;
//GFXVertexBufferHandle<ImposterCorner> mCornerVB;
void _innerRender( const SceneRenderState *state, RenderPrePassMgr *prePassBin );
void _innerRender( const SceneRenderState *state, RenderDeferredMgr *prePassBin );
void _renderPrePass( const SceneRenderState *state, RenderPrePassMgr *prePassBin, bool startPrePass );
void _renderDeferred( const SceneRenderState *state, RenderDeferredMgr *prePassBin, bool startDeferred );
static bool _clearStats( GFXDevice::GFXDeviceEventType type );

View file

@ -147,7 +147,7 @@ void RenderMeshMgr::render(SceneRenderState * state)
// Check if bin is disabled in advanced lighting.
// Allow forward rendering pass on custom materials.
if ( ( MATMGR->getPrePassEnabled() && mBasicOnly && !mat->isCustomMaterial() ) )
if ( ( MATMGR->getDeferredEnabled() && mBasicOnly && !mat->isCustomMaterial() ) )
{
j++;
continue;

View file

@ -69,7 +69,7 @@ void RenderObjectMgr::render( SceneRenderState *state )
return;
// Check if bin is disabled in advanced lighting.
if ( MATMGR->getPrePassEnabled() && mBasicOnly )
if ( MATMGR->getDeferredEnabled() && mBasicOnly )
return;
for( U32 i=0; i<mElementList.size(); i++ )

View file

@ -22,7 +22,7 @@
#include "platform/platform.h"
#include "renderInstance/renderParticleMgr.h"
#include "renderInstance/renderPrePassMgr.h"
#include "renderInstance/renderDeferredMgr.h"
#include "scene/sceneManager.h"
#include "scene/sceneObject.h"
#include "scene/sceneRenderState.h"
@ -512,17 +512,17 @@ void RenderParticleMgr::renderParticle(ParticleRenderInst* ri, SceneRenderState*
GFX->setTexture( mParticleShaderConsts.mSamplerDiffuse->getSamplerRegister(), ri->diffuseTex );
// Set up the prepass texture.
if ( mParticleShaderConsts.mPrePassTargetParamsSC->isValid() )
// Set up the deferred texture.
if ( mParticleShaderConsts.mDeferredTargetParamsSC->isValid() )
{
GFXTextureObject *texObject = mPrepassTarget ? mPrepassTarget->getTexture(0) : NULL;
GFX->setTexture( mParticleShaderConsts.mSamplerPrePassTex->getSamplerRegister(), texObject );
GFXTextureObject *texObject = mDeferredTarget ? mDeferredTarget->getTexture(0) : NULL;
GFX->setTexture( mParticleShaderConsts.mSamplerDeferredTex->getSamplerRegister(), texObject );
Point4F rtParams( 0.0f, 0.0f, 1.0f, 1.0f );
if ( texObject )
ScreenSpace::RenderTargetParameters(texObject->getSize(), mPrepassTarget->getViewport(), rtParams);
ScreenSpace::RenderTargetParameters(texObject->getSize(), mDeferredTarget->getViewport(), rtParams);
mParticleShaderConsts.mShaderConsts->set( mParticleShaderConsts.mPrePassTargetParamsSC, rtParams );
mParticleShaderConsts.mShaderConsts->set( mParticleShaderConsts.mDeferredTargetParamsSC, rtParams );
}
GFX->setPrimitiveBuffer( *ri->primBuff );
@ -538,8 +538,8 @@ bool RenderParticleMgr::_initShader()
// Need depth from pre-pass, so get the macros
Vector<GFXShaderMacro> macros;
if ( mPrepassTarget )
mPrepassTarget->getShaderMacros( &macros );
if ( mDeferredTarget )
mDeferredTarget->getShaderMacros( &macros );
// Create particle shader
if ( !Sim::findObject( "ParticlesShaderData", shaderData ) || !shaderData )
@ -557,11 +557,11 @@ bool RenderParticleMgr::_initShader()
mParticleShaderConsts.mAlphaFactorSC = mParticleShader->getShaderConstHandle( "$alphaFactor" );
mParticleShaderConsts.mAlphaScaleSC = mParticleShader->getShaderConstHandle( "$alphaScale" );
mParticleShaderConsts.mFSModelViewProjSC = mParticleShader->getShaderConstHandle( "$fsModelViewProj" );
mParticleShaderConsts.mPrePassTargetParamsSC = mParticleShader->getShaderConstHandle( "$prePassTargetParams" );
mParticleShaderConsts.mDeferredTargetParamsSC = mParticleShader->getShaderConstHandle( "$prePassTargetParams" );
//samplers
mParticleShaderConsts.mSamplerDiffuse = mParticleShader->getShaderConstHandle("$diffuseMap");
mParticleShaderConsts.mSamplerPrePassTex = mParticleShader->getShaderConstHandle("$prepassTex");
mParticleShaderConsts.mSamplerDeferredTex = mParticleShader->getShaderConstHandle("$deferredTex");
mParticleShaderConsts.mSamplerParaboloidLightMap = mParticleShader->getShaderConstHandle("$paraboloidLightMap");
}
@ -596,18 +596,18 @@ void RenderParticleMgr::_onLMActivate( const char*, bool activate )
return;
// Hunt for the pre-pass manager/target
RenderPrePassMgr *prePassBin = NULL;
RenderDeferredMgr *prePassBin = NULL;
for( U32 i = 0; i < rpm->getManagerCount(); i++ )
{
RenderBinManager *bin = rpm->getManager(i);
if( bin->getRenderInstType() == RenderPrePassMgr::RIT_PrePass )
if( bin->getRenderInstType() == RenderDeferredMgr::RIT_Deferred )
{
prePassBin = (RenderPrePassMgr*)bin;
prePassBin = (RenderDeferredMgr*)bin;
break;
}
}
// If we found the prepass bin, set this bin to render very shortly afterwards
// If we found the deferred bin, set this bin to render very shortly afterwards
// and re-add this render-manager. If there is no pre-pass bin, or it doesn't
// have a depth-texture, we can't render offscreen.
mOffscreenRenderEnabled = prePassBin && (prePassBin->getTargetChainLength() > 0);
@ -619,7 +619,7 @@ void RenderParticleMgr::_onLMActivate( const char*, bool activate )
}
// Find the targets we use
mPrepassTarget = NamedTexTarget::find( "prepass" );
mDeferredTarget = NamedTexTarget::find( "deferred" );
mEdgeTarget = NamedTexTarget::find( "edge" );
// Setup the shader
@ -668,7 +668,7 @@ GFXStateBlockRef RenderParticleMgr::_getOffscreenStateBlock(ParticleRenderInst *
d.samplers[0].alphaArg1 = GFXTATexture;
d.samplers[0].alphaArg2 = GFXTADiffuse;
// Prepass sampler
// Deferred sampler
d.samplers[1] = GFXSamplerStateDesc::getClampPoint();
mOffscreenBlocks[blendStyle] = GFX->createStateBlock(d);
@ -701,7 +701,7 @@ GFXStateBlockRef RenderParticleMgr::_getHighResStateBlock(ParticleRenderInst *ri
d.samplers[0].alphaArg1 = GFXTATexture;
d.samplers[0].alphaArg2 = GFXTADiffuse;
// Prepass sampler
// Deferred sampler
d.samplers[1] = GFXSamplerStateDesc::getClampPoint();
mHighResBlocks[blendStyle] = GFX->createStateBlock(d);
@ -773,7 +773,7 @@ GFXStateBlockRef RenderParticleMgr::_getMixedResStateBlock(ParticleRenderInst *r
d.samplers[0].alphaArg1 = GFXTATexture;
d.samplers[0].alphaArg2 = GFXTADiffuse;
// Prepass sampler
// Deferred sampler
d.samplers[1] = GFXSamplerStateDesc::getClampPoint();
mMixedResBlocks[blendStyle] = GFX->createStateBlock(d);

View file

@ -42,7 +42,7 @@ class RenderParticleMgr : public RenderTexTargetBinManager
friend class RenderTranslucentMgr;
public:
// Generic PrePass Render Instance Type
// Generic Deferred Render Instance Type
static const RenderInstType RIT_Particles;
RenderParticleMgr();
@ -82,9 +82,9 @@ public:
protected:
bool mOffscreenRenderEnabled;
/// The prepass render target used for the
/// The deferred render target used for the
/// soft particle shader effect.
NamedTexTargetRef mPrepassTarget;
NamedTexTargetRef mDeferredTarget;
/// The shader used for particle rendering.
GFXShaderRef mParticleShader;
@ -109,11 +109,11 @@ protected:
GFXShaderConstHandle *mFSModelViewProjSC;
GFXShaderConstHandle *mOneOverFarSC;
GFXShaderConstHandle *mOneOverSoftnessSC;
GFXShaderConstHandle *mPrePassTargetParamsSC;
GFXShaderConstHandle *mDeferredTargetParamsSC;
GFXShaderConstHandle *mAlphaFactorSC;
GFXShaderConstHandle *mAlphaScaleSC;
GFXShaderConstHandle *mSamplerDiffuse;
GFXShaderConstHandle *mSamplerPrePassTex;
GFXShaderConstHandle *mSamplerDeferredTex;
GFXShaderConstHandle *mSamplerParaboloidLightMap;
} mParticleShaderConsts;

View file

@ -119,7 +119,7 @@ void RenderTerrainMgr::render( SceneRenderState *state )
return;
// Check if bin is disabled in advanced lighting.
if ( MATMGR->getPrePassEnabled() && mBasicOnly )
if ( MATMGR->getDeferredEnabled() && mBasicOnly )
return;
PROFILE_SCOPE( RenderTerrainMgr_Render );

View file

@ -37,7 +37,7 @@ ConsoleDocClass( RenderTexTargetBinManager,
"@brief An abstract base class for render bin managers that render to a named textue target.\n\n"
"This bin itself doesn't do any rendering work. It offers functionality to manage "
"a texture render target which derived render bin classes can render into.\n\n"
"@see RenderPrePassMgr\n"
"@see RenderDeferredMgr\n"
"@ingroup RenderBin\n" );

View file

@ -365,9 +365,9 @@ ShaderFeature::Resources ParallaxFeatGLSL::getResources( const MaterialFeatureDa
// We add the outViewTS to the outputstructure.
res.numTexReg = 1;
// If this isn't a prepass then we will be
// If this isn't a deferred then we will be
// creating the normal map here.
if ( !fd.features.hasFeature( MFT_PrePassConditioner ) )
if ( !fd.features.hasFeature( MFT_DeferredConditioner ) )
res.numTex = 1;
return res;

View file

@ -108,7 +108,7 @@ void EyeSpaceDepthOutGLSL::processPix( Vector<ShaderComponent*> &componentList,
// If there isn't an output conditioner for the pre-pass, than just write
// out the depth to rgba and return.
if( !fd.features[MFT_PrePassConditioner] )
if( !fd.features[MFT_DeferredConditioner] )
meta->addStatement( new GenOp( " @;\r\n", assignColor( new GenOp( "float4(float3(@),1)", depthOut ), Material::None ) ) );
output = meta;

View file

@ -953,7 +953,7 @@ void DiffuseMapFeatGLSL::processPix( Vector<ShaderComponent*> &componentList,
// To dump out UV coords...
//#define DEBUG_ATLASED_UV_COORDS
#ifdef DEBUG_ATLASED_UV_COORDS
if(!fd.features[MFT_PrePassConditioner])
if(!fd.features[MFT_DeferredConditioner])
{
meta->addStatement(new GenOp(" @ = vec4(@.xy, mipLod / @.w, 1.0);\r\n", new DecOp(diffColor), inTex, atParams));
meta->addStatement(new GenOp(" @; return OUT;\r\n", assignColor(diffColor, Material::Mul, NULL, targ) ) );
@ -1269,7 +1269,7 @@ void LightmapFeatGLSL::processPix( Vector<ShaderComponent*> &componentList,
bool bPreProcessedLighting = false;
AdvancedLightBinManager *lightBin;
if ( Sim::findObject( "AL_LightBinMgr", lightBin ) )
bPreProcessedLighting = lightBin->MRTLightmapsDuringPrePass();
bPreProcessedLighting = lightBin->MRTLightmapsDuringDeferred();
// Lightmap has already been included in the advanced light bin, so
// no need to do any sampling or anything
@ -1394,7 +1394,7 @@ void TonemapFeatGLSL::processPix( Vector<ShaderComponent*> &componentList,
bool bPreProcessedLighting = false;
AdvancedLightBinManager *lightBin;
if ( Sim::findObject( "AL_LightBinMgr", lightBin ) )
bPreProcessedLighting = lightBin->MRTLightmapsDuringPrePass();
bPreProcessedLighting = lightBin->MRTLightmapsDuringDeferred();
// Add in the realtime lighting contribution
if ( fd.features[MFT_RTLighting] )
@ -1549,7 +1549,7 @@ void VertLitGLSL::processPix( Vector<ShaderComponent*> &componentList,
bool bPreProcessedLighting = false;
AdvancedLightBinManager *lightBin;
if ( Sim::findObject( "AL_LightBinMgr", lightBin ) )
bPreProcessedLighting = lightBin->MRTLightmapsDuringPrePass();
bPreProcessedLighting = lightBin->MRTLightmapsDuringDeferred();
// Assign value in d_lightcolor to toneMapColor if it exists. This is
// the dynamic light buffer, and it already has the baked-vertex-color

View file

@ -406,9 +406,9 @@ ShaderFeature::Resources ParallaxFeatHLSL::getResources( const MaterialFeatureDa
// We add the outViewTS to the outputstructure.
res.numTexReg = 1;
// If this isn't a prepass then we will be
// If this isn't a deferred then we will be
// creating the normal map here.
if ( !fd.features.hasFeature( MFT_PrePassConditioner ) )
if ( !fd.features.hasFeature( MFT_DeferredConditioner ) )
res.numTex = 1;
return res;

View file

@ -108,7 +108,7 @@ void EyeSpaceDepthOutHLSL::processPix( Vector<ShaderComponent*> &componentList,
// If there isn't an output conditioner for the pre-pass, than just write
// out the depth to rgba and return.
if( !fd.features[MFT_PrePassConditioner] )
if( !fd.features[MFT_DeferredConditioner] )
meta->addStatement( new GenOp( " @;\r\n", assignColor( new GenOp( "float4(@.rrr,1)", depthOut ), Material::None ) ) );
output = meta;

View file

@ -991,7 +991,7 @@ void DiffuseMapFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
// To dump out UV coords...
//#define DEBUG_ATLASED_UV_COORDS
#ifdef DEBUG_ATLASED_UV_COORDS
if(!fd.features[MFT_PrePassConditioner])
if(!fd.features[MFT_DeferredConditioner])
{
meta->addStatement(new GenOp(" @ = float4(@.xy, mipLod / @.w, 1.0);\r\n", new DecOp(diffColor), inTex, atParams));
meta->addStatement(new GenOp(" @; return OUT;\r\n", assignColor(diffColor, Material::Mul, NULL, targ) ) );
@ -1347,7 +1347,7 @@ void LightmapFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
bool bPreProcessedLighting = false;
AdvancedLightBinManager *lightBin;
if ( Sim::findObject( "AL_LightBinMgr", lightBin ) )
bPreProcessedLighting = lightBin->MRTLightmapsDuringPrePass();
bPreProcessedLighting = lightBin->MRTLightmapsDuringDeferred();
// Lightmap has already been included in the advanced light bin, so
// no need to do any sampling or anything
@ -1497,7 +1497,7 @@ void TonemapFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
bool bPreProcessedLighting = false;
AdvancedLightBinManager *lightBin;
if ( Sim::findObject( "AL_LightBinMgr", lightBin ) )
bPreProcessedLighting = lightBin->MRTLightmapsDuringPrePass();
bPreProcessedLighting = lightBin->MRTLightmapsDuringDeferred();
// Add in the realtime lighting contribution
if ( fd.features[MFT_RTLighting] )
@ -1652,7 +1652,7 @@ void VertLitHLSL::processPix( Vector<ShaderComponent*> &componentList,
bool bPreProcessedLighting = false;
AdvancedLightBinManager *lightBin;
if ( Sim::findObject( "AL_LightBinMgr", lightBin ) )
bPreProcessedLighting = lightBin->MRTLightmapsDuringPrePass();
bPreProcessedLighting = lightBin->MRTLightmapsDuringDeferred();
// Assign value in d_lightcolor to toneMapColor if it exists. This is
// the dynamic light buffer, and it already has the baked-vertex-color

View file

@ -94,7 +94,7 @@ void _initShaderGenHLSL( ShaderGen *shaderGen )
FEATUREMGR->registerFeature( MFT_ParticleNormal, new ParticleNormalFeatureHLSL );
FEATUREMGR->registerFeature( MFT_InterlacedPrePass, new NamedFeatureHLSL( "Interlaced Pre Pass" ) );
FEATUREMGR->registerFeature( MFT_InterlacedDeferred, new NamedFeatureHLSL( "Interlaced Pre Pass" ) );
FEATUREMGR->registerFeature( MFT_ForwardShading, new NamedFeatureHLSL( "Forward Shaded Material" ) );

View file

@ -911,8 +911,8 @@ U32 TerrainMacroMapFeatGLSL::getOutputTargets( const MaterialFeatureData &fd ) c
void TerrainNormalMapFeatGLSL::processVert( Vector<ShaderComponent*> &componentList,
const MaterialFeatureData &fd )
{
// We only need to process normals during the prepass.
if ( !fd.features.hasFeature( MFT_PrePassConditioner ) )
// We only need to process normals during the deferred.
if ( !fd.features.hasFeature( MFT_DeferredConditioner ) )
return;
MultiLine *meta = new MultiLine;
@ -933,7 +933,7 @@ void TerrainNormalMapFeatGLSL::processPix( Vector<ShaderComponent*> &component
Var *viewToTangent = getInViewToTangent( componentList );
// This var is read from GBufferConditionerGLSL and
// used in the prepass output.
// used in the deferred output.
Var *gbNormal = (Var*)LangElement::find( "gbNormal" );
if ( !gbNormal )
{
@ -1004,8 +1004,8 @@ ShaderFeature::Resources TerrainNormalMapFeatGLSL::getResources( const MaterialF
{
Resources res;
// We only need to process normals during the prepass.
if ( fd.features.hasFeature( MFT_PrePassConditioner ) )
// We only need to process normals during the deferred.
if ( fd.features.hasFeature( MFT_DeferredConditioner ) )
{
// If this is the first normal map and there
// are no parallax features then we will

View file

@ -971,8 +971,8 @@ U32 TerrainMacroMapFeatHLSL::getOutputTargets( const MaterialFeatureData &fd ) c
void TerrainNormalMapFeatHLSL::processVert( Vector<ShaderComponent*> &componentList,
const MaterialFeatureData &fd )
{
// We only need to process normals during the prepass.
if ( !fd.features.hasFeature( MFT_PrePassConditioner ) )
// We only need to process normals during the deferred.
if ( !fd.features.hasFeature( MFT_DeferredConditioner ) )
return;
MultiLine *meta = new MultiLine;
@ -993,7 +993,7 @@ void TerrainNormalMapFeatHLSL::processPix( Vector<ShaderComponent*> &component
Var *viewToTangent = getInViewToTangent( componentList );
// This var is read from GBufferConditionerHLSL and
// used in the prepass output.
// used in the deferred output.
Var *gbNormal = (Var*)LangElement::find( "gbNormal" );
if ( !gbNormal )
{
@ -1090,8 +1090,8 @@ ShaderFeature::Resources TerrainNormalMapFeatHLSL::getResources( const MaterialF
{
Resources res;
// We only need to process normals during the prepass.
if ( fd.features.hasFeature( MFT_PrePassConditioner ) )
// We only need to process normals during the deferred.
if ( fd.features.hasFeature( MFT_DeferredConditioner ) )
{
// If this is the first normal map and there
// are no parallax features then we will

View file

@ -1062,7 +1062,7 @@ void TerrCell::preloadMaterials()
if ( GFX->getPixelShaderVersion() > 2.0f &&
dStrcmp( LIGHTMGR->getId(), "BLM" ) != 0)
material->getPrePassMat();
material->getDeferredMat();
}
for ( U32 i = 0; i < 4; i++ )

View file

@ -29,7 +29,7 @@
#include "materials/materialManager.h"
#include "terrain/terrFeatureTypes.h"
#include "terrain/terrMaterial.h"
#include "renderInstance/renderPrePassMgr.h"
#include "renderInstance/renderDeferredMgr.h"
#include "shaderGen/shaderGen.h"
#include "shaderGen/featureMgr.h"
#include "scene/sceneRenderState.h"
@ -71,7 +71,7 @@ const Vector<String> TerrainCellMaterial::mSamplerNames = _initSamplerNames();
TerrainCellMaterial::TerrainCellMaterial()
: mTerrain( NULL ),
mCurrPass( 0 ),
mPrePassMat( NULL ),
mDeferredMat( NULL ),
mReflectMat( NULL )
{
smAllMaterials.push_back( this );
@ -79,7 +79,7 @@ TerrainCellMaterial::TerrainCellMaterial()
TerrainCellMaterial::~TerrainCellMaterial()
{
SAFE_DELETE( mPrePassMat );
SAFE_DELETE( mDeferredMat );
SAFE_DELETE( mReflectMat );
smAllMaterials.remove( this );
}
@ -219,15 +219,15 @@ void TerrainCellMaterial::setTransformAndEye( const MatrixF &modelXfm,
}
}
TerrainCellMaterial* TerrainCellMaterial::getPrePassMat()
TerrainCellMaterial* TerrainCellMaterial::getDeferredMat()
{
if ( !mPrePassMat )
if ( !mDeferredMat )
{
mPrePassMat = new TerrainCellMaterial();
mPrePassMat->init( mTerrain, mMaterials, true, false, mMaterials == 0 );
mDeferredMat = new TerrainCellMaterial();
mDeferredMat->init( mTerrain, mMaterials, true, false, mMaterials == 0 );
}
return mPrePassMat;
return mDeferredMat;
}
TerrainCellMaterial* TerrainCellMaterial::getReflectMat()
@ -248,7 +248,7 @@ void TerrainCellMaterial::init( TerrainBlock *block,
bool baseOnly )
{
// This isn't allowed for now.
AssertFatal( !( prePassMat && reflectMat ), "TerrainCellMaterial::init - We shouldn't get prepass and reflection in the same material!" );
AssertFatal( !( prePassMat && reflectMat ), "TerrainCellMaterial::init - We shouldn't get deferred and reflection in the same material!" );
mTerrain = block;
mMaterials = activeMaterials;
@ -301,8 +301,8 @@ void TerrainCellMaterial::init( TerrainBlock *block,
for_each( materials.begin(), materials.end(), delete_pointer() );
// If we have attached mats then update them too.
if ( mPrePassMat )
mPrePassMat->init( mTerrain, mMaterials, true, false, baseOnly );
if ( mDeferredMat )
mDeferredMat->init( mTerrain, mMaterials, true, false, baseOnly );
if ( mReflectMat )
mReflectMat->init( mTerrain, mMaterials, false, true, baseOnly );
}
@ -341,14 +341,14 @@ bool TerrainCellMaterial::_createPass( Vector<MaterialInfo*> *materials,
const bool disableParallaxMaps = GFX->getPixelShaderVersion() < 3.0f ||
MATMGR->getExclusionFeatures().hasFeature( MFT_Parallax );
// Has advanced lightmap support been enabled for prepass.
// Has advanced lightmap support been enabled for deferred.
bool advancedLightmapSupport = false;
if ( prePassMat )
{
// This sucks... but it works.
AdvancedLightBinManager *lightBin;
if ( Sim::findObject( "AL_LightBinMgr", lightBin ) )
advancedLightmapSupport = lightBin->MRTLightmapsDuringPrePass();
advancedLightmapSupport = lightBin->MRTLightmapsDuringDeferred();
}
// Loop till we create a valid shader!
@ -360,7 +360,7 @@ bool TerrainCellMaterial::_createPass( Vector<MaterialInfo*> *materials,
if ( prePassMat )
{
features.addFeature( MFT_EyeSpaceDepthOut );
features.addFeature( MFT_PrePassConditioner );
features.addFeature( MFT_DeferredConditioner );
features.addFeature( MFT_DeferredTerrainBaseMap );
features.addFeature(MFT_isDeferred);
@ -546,7 +546,7 @@ bool TerrainCellMaterial::_createPass( Vector<MaterialInfo*> *materials,
{
desc.setBlend( true, GFXBlendSrcAlpha, GFXBlendInvSrcAlpha );
// If this is the prepass then we don't want to
// If this is the deferred then we don't want to
// write to the last two color channels (where
// depth is usually encoded).
//
@ -558,9 +558,9 @@ bool TerrainCellMaterial::_createPass( Vector<MaterialInfo*> *materials,
desc.setColorWrites( true, true, true, false );
}
// We write to the zbuffer if this is a prepass
// material or if the prepass is disabled.
desc.setZReadWrite( true, !MATMGR->getPrePassEnabled() ||
// We write to the zbuffer if this is a deferred
// material or if the deferred is disabled.
desc.setZReadWrite( true, !MATMGR->getDeferredEnabled() ||
prePassMat ||
reflectMat );
@ -669,10 +669,10 @@ bool TerrainCellMaterial::_createPass( Vector<MaterialInfo*> *materials,
materials->pop_front();
}
// If we're doing prepass it requires some
// If we're doing deferred it requires some
// special stencil settings for it to work.
if ( prePassMat )
desc.addDesc( RenderPrePassMgr::getOpaqueStenciWriteDesc( false ) );
desc.addDesc( RenderDeferredMgr::getOpaqueStenciWriteDesc( false ) );
desc.setCullMode( GFXCullCCW );
pass->stateBlock = GFX->createStateBlock(desc);

View file

@ -153,8 +153,8 @@ protected:
NamedTexTargetRef mLightInfoTarget;
/// The prepass material for this material.
TerrainCellMaterial *mPrePassMat;
/// The deferred material for this material.
TerrainCellMaterial *mDeferredMat;
/// The reflection material for this material.
TerrainCellMaterial *mReflectMat;
@ -182,8 +182,8 @@ public:
bool reflectMat = false,
bool baseOnly = false );
/// Returns a prepass material from this material.
TerrainCellMaterial* getPrePassMat();
/// Returns a deferred material from this material.
TerrainCellMaterial* getDeferredMat();
/// Returns the reflection material from this material.
TerrainCellMaterial* getReflectMat();

View file

@ -34,7 +34,7 @@ singleton ShaderData( ParticlesShaderData )
OGLPixelShaderFile = $Core::CommonShaderPath @ "/gl/particlesP.glsl";
samplerNames[0] = "$diffuseMap";
samplerNames[1] = "$prepassTex";
samplerNames[1] = "$deferredTex";
samplerNames[2] = "$paraboloidLightMap";
pixVersion = 2.0;
@ -103,7 +103,7 @@ new ShaderData( fxFoliageReplicatorShader )
pixVersion = 1.4;
};
singleton ShaderData( VolumetricFogPrePassShader )
singleton ShaderData( VolumetricFogDeferredShader )
{
DXVertexShaderFile = $Core::CommonShaderPath @ "/VolumetricFog/VFogPreV.hlsl";
DXPixelShaderFile = $Core::CommonShaderPath @ "/VolumetricFog/VFogPreP.hlsl";
@ -121,7 +121,7 @@ singleton ShaderData( VolumetricFogShader )
OGLVertexShaderFile = $Core::CommonShaderPath @ "/VolumetricFog/gl/VFogV.glsl";
OGLPixelShaderFile = $Core::CommonShaderPath @ "/VolumetricFog/gl/VFogP.glsl";
samplerNames[0] = "$prepassTex";
samplerNames[0] = "$deferredTex";
samplerNames[1] = "$depthBuffer";
samplerNames[2] = "$frontBuffer";
samplerNames[3] = "$density";

View file

@ -35,7 +35,7 @@ singleton ShaderData( WaterShader )
OGLPixelShaderFile = $Core::CommonShaderPath @ "/water/gl/waterP.glsl";
samplerNames[0] = "$bumpMap"; // noise
samplerNames[1] = "$prepassTex"; // #prepass
samplerNames[1] = "$deferredTex"; // #deferred
samplerNames[2] = "$reflectMap"; // $reflectbuff
samplerNames[3] = "$refractBuff"; // $backbuff
samplerNames[4] = "$skyMap"; // $cubemap
@ -61,7 +61,7 @@ singleton GFXStateBlockData( WaterStateBlock )
{
samplersDefined = true;
samplerStates[0] = WaterSampler; // noise
samplerStates[1] = SamplerClampPoint; // #prepass
samplerStates[1] = SamplerClampPoint; // #deferred
samplerStates[2] = SamplerClampLinear; // $reflectbuff
samplerStates[3] = SamplerClampPoint; // $backbuff
samplerStates[4] = SamplerWrapLinear; // $cubemap
@ -78,7 +78,7 @@ singleton GFXStateBlockData( UnderWaterStateBlock : WaterStateBlock )
singleton CustomMaterial( WaterMat )
{
sampler["prepassTex"] = "#prepass";
sampler["deferredTex"] = "#deferred";
sampler["reflectMap"] = "$reflectbuff";
sampler["refractBuff"] = "$backbuff";
// These samplers are set in code not here.
@ -115,7 +115,7 @@ singleton CustomMaterial( UnderwaterMat )
//sampler["bumpMap"] = "core/art/water/noise02";
//sampler["foamMap"] = "core/art/water/foam";
sampler["prepassTex"] = "#prepass";
sampler["deferredTex"] = "#deferred";
sampler["refractBuff"] = "$backbuff";
shader = UnderWaterShader;
@ -171,7 +171,7 @@ singleton CustomMaterial( WaterBasicMat )
//sampler["bumpMap"] = "core/art/water/noise02";
//sampler["skyMap"] = "$cubemap";
//sampler["prepassTex"] = "#prepass";
//sampler["deferredTex"] = "#deferred";
sampler["reflectMap"] = "$reflectbuff";
sampler["refractBuff"] = "$backbuff";
@ -199,7 +199,7 @@ singleton CustomMaterial( UnderwaterBasicMat )
//sampler["bumpMap"] = "core/art/water/noise02";
//samplers["skyMap"] = "$cubemap";
//sampler["prepassTex"] = "#prepass";
//sampler["deferredTex"] = "#deferred";
sampler["refractBuff"] = "$backbuff";
shader = UnderWaterBasicShader;

View file

@ -46,9 +46,9 @@ new ShaderData( AL_DeferredShader )
OGLPixelShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/gl/deferredShadingP.glsl";
samplerNames[0] = "colorBufferTex";
samplerNames[1] = "lightPrePassTex";
samplerNames[1] = "lightDeferredTex";
samplerNames[2] = "matInfoTex";
samplerNames[3] = "prepassTex";
samplerNames[3] = "deferredTex";
pixVersion = 2.0;
};
@ -62,7 +62,7 @@ singleton PostEffect( AL_DeferredShading )
texture[0] = "#color";
texture[1] = "#lightinfo";
texture[2] = "#matinfo";
texture[3] = "#prepass";
texture[3] = "#deferred";
target = "$backBuffer";
renderPriority = 10000;

View file

@ -83,7 +83,7 @@ new CustomMaterial( AL_VectorLightMaterial )
shader = AL_VectorLightShader;
stateBlock = AL_VectorLightState;
sampler["prePassBuffer"] = "#prepass";
sampler["prePassBuffer"] = "#deferred";
sampler["shadowMap"] = "$dynamiclight";
sampler["dynamicShadowMap"] = "$dynamicShadowMap";
sampler["ssaoMask"] = "#ssaoMask";
@ -160,7 +160,7 @@ new CustomMaterial( AL_PointLightMaterial )
shader = AL_PointLightShader;
stateBlock = AL_ConvexLightState;
sampler["prePassBuffer"] = "#prepass";
sampler["prePassBuffer"] = "#deferred";
sampler["shadowMap"] = "$dynamiclight";
sampler["dynamicShadowMap"] = "$dynamicShadowMap";
sampler["cookieMap"] = "$dynamiclightmask";
@ -199,7 +199,7 @@ new CustomMaterial( AL_SpotLightMaterial )
shader = AL_SpotLightShader;
stateBlock = AL_ConvexLightState;
sampler["prePassBuffer"] = "#prepass";
sampler["prePassBuffer"] = "#deferred";
sampler["shadowMap"] = "$dynamiclight";
sampler["dynamicShadowMap"] = "$dynamicShadowMap";
sampler["cookieMap"] = "$dynamiclightmask";
@ -212,9 +212,9 @@ new CustomMaterial( AL_SpotLightMaterial )
pixVersion = 3.0;
};
/// This material is used for generating prepass
/// This material is used for generating deferred
/// materials for objects that do not have materials.
new Material( AL_DefaultPrePassMaterial )
new Material( AL_DefaultDeferredMaterial )
{
// We need something in the first pass else it
// won't create a proper material instance.
@ -269,7 +269,7 @@ new CustomMaterial( AL_ParticlePointLightMaterial )
shader = AL_ParticlePointLightShader;
stateBlock = AL_ConvexLightState;
sampler["prePassBuffer"] = "#prepass";
sampler["prePassBuffer"] = "#deferred";
target = "lightinfo";
pixVersion = 3.0;

View file

@ -51,7 +51,7 @@ singleton ShaderData( MLAA_EdgeDetectionShader )
OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/mlaa/gl/edgeDetectionP.glsl";
samplerNames[0] = "$colorMapG";
samplerNames[1] = "$prepassMap";
samplerNames[1] = "$deferredMap";
pixVersion = 3.0;
};
@ -125,7 +125,7 @@ singleton PostEffect( MLAAFx )
renderTime = "PFXAfterDiffuse";
texture[0] = "$backBuffer"; //colorMapG
texture[1] = "#prepass"; // Used for depth detection
texture[1] = "#deferred"; // Used for depth detection
target = "$outTex";
targetClear = PFXTargetClear_OnDraw;

View file

@ -29,7 +29,7 @@ singleton ShaderData( PFX_MotionBlurShader )
OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/gl/motionBlurP.glsl";
samplerNames[0] = "$backBuffer";
samplerNames[1] = "$prepassTex";
samplerNames[1] = "$deferredTex";
pixVersion = 3.0;
};
@ -43,7 +43,7 @@ singleton PostEffect(MotionBlurFX)
shader = PFX_MotionBlurShader;
stateBlock = PFX_DefaultStateBlock;
texture[0] = "$backbuffer";
texture[1] = "#prepass";
texture[1] = "#deferred";
target = "$backBuffer";
};

View file

@ -41,7 +41,7 @@ singleton ShaderData( PFX_CausticsShader )
OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/caustics/gl/causticsP.glsl";
samplerNames[0] = "$prepassTex";
samplerNames[0] = "$deferredTex";
samplerNames[1] = "$causticsTex0";
samplerNames[2] = "$causticsTex1";
@ -57,7 +57,7 @@ singleton PostEffect( CausticsPFX )
shader = PFX_CausticsShader;
stateBlock = PFX_CausticsStateBlock;
texture[0] = "#prepass";
texture[0] = "#deferred";
texture[1] = "core/images/caustics_1";
texture[2] = "core/images/caustics_2";
target = "$backBuffer";

View file

@ -430,7 +430,7 @@ singleton PostEffect( DOFPostEffect )
shader = PFX_DOFDownSampleShader;
stateBlock = PFX_DOFDownSampleStateBlock;
texture[0] = "$backBuffer";
texture[1] = "#prepass";
texture[1] = "#deferred";
target = "#shrunk";
targetScale = "0.25 0.25";
@ -485,7 +485,7 @@ singleton PostEffect( DOFFinalPFX )
texture[0] = "$backBuffer";
texture[1] = "$inTex";
texture[2] = "#largeBlur";
texture[3] = "#prepass";
texture[3] = "#deferred";
target = "$backBuffer";
};

View file

@ -40,7 +40,7 @@ singleton ShaderData( PFX_EdgeAADetectShader )
OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/edgeaa/gl/edgeDetectP.glsl";
samplerNames[0] = "$prepassBuffer";
samplerNames[0] = "$deferredBuffer";
pixVersion = 3.0;
};
@ -81,7 +81,7 @@ singleton PostEffect( EdgeDetectPostEffect )
shader = PFX_EdgeAADetectShader;
stateBlock = PFX_DefaultEdgeAAStateBlock;
texture[0] = "#prepass";
texture[0] = "#deferred";
target = "#edge";
isEnabled = true;

View file

@ -32,7 +32,7 @@ singleton ShaderData( FogPassShader )
OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/gl/fogP.glsl";
samplerNames[0] = "$prepassTex";
samplerNames[0] = "$deferredTex";
pixVersion = 2.0;
};
@ -58,7 +58,7 @@ singleton PostEffect( FogPostFx )
shader = FogPassShader;
stateBlock = FogPassStateBlock;
texture[0] = "#prepass";
texture[0] = "#deferred";
renderPriority = 5;
@ -79,7 +79,7 @@ singleton ShaderData( UnderwaterFogPassShader )
OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/gl/underwaterFogP.glsl";
samplerNames[0] = "$prepassTex";
samplerNames[0] = "$deferredTex";
samplerNames[1] = "$backbuffer";
samplerNames[2] = "$waterDepthGradMap";
@ -110,7 +110,7 @@ singleton PostEffect( UnderwaterFogPostFx )
shader = UnderwaterFogPassShader;
stateBlock = UnderwaterFogPassStateBlock;
texture[0] = "#prepass";
texture[0] = "#deferred";
texture[1] = "$backBuffer";
texture[2] = "#waterDepthGradMap";

View file

@ -170,7 +170,7 @@ singleton ShaderData( HDR_CombineShader )
samplerNames[1] = "$luminanceTex";
samplerNames[2] = "$bloomTex";
samplerNames[3] = "$colorCorrectionTex";
samplerNames[4] = "prepassTex";
samplerNames[4] = "deferredTex";
pixVersion = 3.0;
};

View file

@ -39,7 +39,7 @@ singleton ShaderData( LightRayOccludeShader )
OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/lightRay/gl/lightRayOccludeP.glsl";
samplerNames[0] = "$backBuffer";
samplerNames[1] = "$prepassTex";
samplerNames[1] = "$deferredTex";
pixVersion = 3.0;
};
@ -77,7 +77,7 @@ singleton PostEffect( LightRayPostFX )
shader = LightRayOccludeShader;
stateBlock = LightRayStateBlock;
texture[0] = "$backBuffer";
texture[1] = "#prepass";
texture[1] = "#deferred";
target = "$outTex";
targetFormat = "GFXFormatR16G16B16A16F";

View file

@ -156,7 +156,7 @@ singleton ShaderData( SSAOShader )
OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/ssao/gl/SSAO_P.glsl";
samplerNames[0] = "$prepassMap";
samplerNames[0] = "$deferredMap";
samplerNames[1] = "$randNormalTex";
samplerNames[2] = "$powTable";
@ -172,7 +172,7 @@ singleton ShaderData( SSAOBlurYShader )
OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/ssao/gl/SSAO_Blur_P.glsl";
samplerNames[0] = "$occludeMap";
samplerNames[1] = "$prepassMap";
samplerNames[1] = "$deferredMap";
pixVersion = 3.0;
@ -199,7 +199,7 @@ singleton PostEffect( SSAOPostFx )
shader = SSAOShader;
stateBlock = SSAOStateBlock;
texture[0] = "#prepass";
texture[0] = "#deferred";
texture[1] = "core/images/noise.png";
texture[2] = "#ssao_pow_table";
@ -215,7 +215,7 @@ singleton PostEffect( SSAOPostFx )
stateBlock = SSAOBlurStateBlock;
texture[0] = "$inTex";
texture[1] = "#prepass";
texture[1] = "#deferred";
target = "$outTex";
};
@ -228,7 +228,7 @@ singleton PostEffect( SSAOPostFx )
stateBlock = SSAOBlurStateBlock;
texture[0] = "$inTex";
texture[1] = "#prepass";
texture[1] = "#deferred";
target = "$outTex";
};
@ -241,7 +241,7 @@ singleton PostEffect( SSAOPostFx )
stateBlock = SSAOBlurStateBlock;
texture[0] = "$inTex";
texture[1] = "#prepass";
texture[1] = "#deferred";
target = "$outTex";
};
@ -254,7 +254,7 @@ singleton PostEffect( SSAOPostFx )
stateBlock = SSAOBlurStateBlock;
texture[0] = "$inTex";
texture[1] = "#prepass";
texture[1] = "#deferred";
// We write to a mask texture which is then
// read by the lighting shaders to mask ambient.

View file

@ -25,7 +25,7 @@
#include "../shaderModelAutoGen.hlsl"
#include "../torque.hlsl"
TORQUE_UNIFORM_SAMPLER2D(prepassTex, 0);
TORQUE_UNIFORM_SAMPLER2D(deferredTex, 0);
TORQUE_UNIFORM_SAMPLER2D(depthBuffer, 1);
TORQUE_UNIFORM_SAMPLER2D(frontBuffer, 2);
TORQUE_UNIFORM_SAMPLER2D(density, 3);
@ -56,7 +56,7 @@ float4 main( ConnectData IN ) : TORQUE_TARGET0
float2 uvscreen=((IN.htpos.xy/IN.htpos.w) + 1.0 ) / 2.0;
uvscreen.y = 1.0 - uvscreen.y;
float obj_test = TORQUE_PREPASS_UNCONDITION(prepassTex, uvscreen).w * preBias;
float obj_test = TORQUE_PREPASS_UNCONDITION(deferredTex, uvscreen).w * preBias;
float depth = TORQUE_TEX2D(depthBuffer, uvscreen).r;
float front = TORQUE_TEX2D(frontBuffer, uvscreen).r;

View file

@ -20,7 +20,7 @@
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
// Volumetric Fog prepass pixel shader V1.00
// Volumetric Fog deferred pixel shader V1.00
#include "../shaderModel.hlsl"
struct ConnectData

View file

@ -20,7 +20,7 @@
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
// Volumetric Fog prepass vertex shader V1.00
// Volumetric Fog deferred vertex shader V1.00
#include "../shaderModel.hlsl"
#include "../hlslStructs.hlsl"

View file

@ -24,7 +24,7 @@
#include "shadergen:/autogenConditioners.h"
#include "../../gl/torque.glsl"
uniform sampler2D prepassTex;
uniform sampler2D deferredTex;
uniform sampler2D depthBuffer;
uniform sampler2D frontBuffer;
uniform sampler2D density;
@ -52,7 +52,7 @@ void main()
vec2 uvscreen=((IN_hpos.xy/IN_hpos.w) + 1.0 ) / 2.0;
uvscreen.y = 1.0 - uvscreen.y;
float obj_test = prepassUncondition( prepassTex, uvscreen).w * preBias;
float obj_test = deferredUncondition( deferredTex, uvscreen).w * preBias;
float depth = tex2D(depthBuffer,uvscreen).r;
float front = tex2D(frontBuffer,uvscreen).r;

View file

@ -34,7 +34,7 @@
uniform float oneOverSoftness;
uniform float oneOverFar;
uniform sampler2D prepassTex;
uniform sampler2D deferredTex;
//uniform vec3 vEye;
uniform vec4 prePassTargetParams;
#endif
@ -88,7 +88,7 @@ void main()
vec2 tc = IN_pos.xy * vec2(1.0, -1.0) / IN_pos.w;
tc = viewportCoordToRenderTarget(saturate( ( tc + 1.0 ) * 0.5 ), prePassTargetParams);
float sceneDepth = prepassUncondition( prepassTex, tc ).w;
float sceneDepth = deferredUncondition( deferredTex, tc ).w;
float depth = IN_pos.w * oneOverFar;
float diff = sceneDepth - depth;
#ifdef CLIP_Z

View file

@ -41,7 +41,7 @@ Fragout main( Conn IN )
{
Fragout OUT;
// Clear Prepass Buffer ( Normals/Depth );
// Clear Deferred Buffer ( Normals/Depth );
OUT.col = float4(1.0, 1.0, 1.0, 1.0);
// Clear Color Buffer.

View file

@ -25,17 +25,17 @@
#include "../../torque.hlsl"
TORQUE_UNIFORM_SAMPLER2D(colorBufferTex,0);
TORQUE_UNIFORM_SAMPLER2D(lightPrePassTex,1);
TORQUE_UNIFORM_SAMPLER2D(lightDeferredTex,1);
TORQUE_UNIFORM_SAMPLER2D(matInfoTex,2);
TORQUE_UNIFORM_SAMPLER2D(prepassTex,3);
TORQUE_UNIFORM_SAMPLER2D(deferredTex,3);
float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
{
float4 lightBuffer = TORQUE_TEX2D( lightPrePassTex, IN.uv0 );
float4 lightBuffer = TORQUE_TEX2D( lightDeferredTex, IN.uv0 );
float4 colorBuffer = TORQUE_TEX2D( colorBufferTex, IN.uv0 );
float4 matInfo = TORQUE_TEX2D( matInfoTex, IN.uv0 );
float specular = saturate(lightBuffer.a);
float depth = TORQUE_PREPASS_UNCONDITION( prepassTex, IN.uv0 ).w;
float depth = TORQUE_PREPASS_UNCONDITION( deferredTex, IN.uv0 ).w;
if (depth>0.9999)
return float4(0,0,0,0);

View file

@ -29,7 +29,7 @@ out vec4 OUT_col2;
//-----------------------------------------------------------------------------
void main()
{
// Clear Prepass Buffer ( Normals/Depth );
// Clear Deferred Buffer ( Normals/Depth );
OUT_col = vec4(1.0, 1.0, 1.0, 1.0);
// Clear Color Buffer.

View file

@ -26,21 +26,21 @@
#include "../../../gl/torque.glsl"
uniform sampler2D colorBufferTex;
uniform sampler2D lightPrePassTex;
uniform sampler2D lightDeferredTex;
uniform sampler2D matInfoTex;
uniform sampler2D prepassTex;
uniform sampler2D deferredTex;
out vec4 OUT_col;
void main()
{
float depth = prepassUncondition( prepassTex, uv0 ).w;
float depth = deferredUncondition( deferredTex, uv0 ).w;
if (depth>0.9999)
{
OUT_col = vec4(0.0);
return;
}
vec4 lightBuffer = texture( lightPrePassTex, uv0 );
vec4 lightBuffer = texture( lightDeferredTex, uv0 );
vec4 colorBuffer = texture( colorBufferTex, uv0 );
vec4 matInfo = texture( matInfoTex, uv0 );
float specular = clamp(lightBuffer.a,0.0,1.0);

View file

@ -159,9 +159,9 @@ void main()
}
// Sample/unpack the normal/z data
vec4 prepassSample = prepassUncondition( prePassBuffer, uvScene );
vec3 normal = prepassSample.rgb;
float depth = prepassSample.a;
vec4 deferredSample = deferredUncondition( prePassBuffer, uvScene );
vec3 normal = deferredSample.rgb;
float depth = deferredSample.a;
// Eye ray - Eye -> Pixel
vec3 eyeRay = getDistanceVectorToPlane( -vsFarPlane.w, vsEyeDir.xyz, vsFarPlane );

View file

@ -101,9 +101,9 @@ void main()
}
// Sample/unpack the normal/z data
vec4 prepassSample = prepassUncondition( prePassBuffer, uvScene );
vec3 normal = prepassSample.rgb;
float depth = prepassSample.a;
vec4 deferredSample = deferredUncondition( prePassBuffer, uvScene );
vec3 normal = deferredSample.rgb;
float depth = deferredSample.a;
// Eye ray - Eye -> Pixel
vec3 eyeRay = getDistanceVectorToPlane( -vsFarPlane.w, IN_vsEyeDir.xyz, vsFarPlane );

View file

@ -214,9 +214,9 @@ void main()
}
// Sample/unpack the normal/z data
vec4 prepassSample = prepassUncondition( prePassBuffer, uv0 );
vec3 normal = prepassSample.rgb;
float depth = prepassSample.a;
vec4 deferredSample = deferredUncondition( prePassBuffer, uv0 );
vec3 normal = deferredSample.rgb;
float depth = deferredSample.a;
// Use eye ray to get ws pos
vec4 worldPos = vec4(eyePosWorld + wsEyeRay * depth, 1.0f);

View file

@ -49,9 +49,9 @@ float4 main( ConvexConnectP IN ) : TORQUE_TARGET0
float2 uvScene = getUVFromSSPos(ssPos, rtParams0);
// Sample/unpack the normal/z data
float4 prepassSample = TORQUE_PREPASS_UNCONDITION(prePassBuffer, uvScene);
float3 normal = prepassSample.rgb;
float depth = prepassSample.a;
float4 deferredSample = TORQUE_PREPASS_UNCONDITION(prePassBuffer, uvScene);
float3 normal = deferredSample.rgb;
float depth = deferredSample.a;
// Eye ray - Eye -> Pixel
float3 eyeRay = getDistanceVectorToPlane(-vsFarPlane.w, IN.vsEyeDir, vsFarPlane);

View file

@ -161,9 +161,9 @@ float4 main( ConvexConnectP IN ) : TORQUE_TARGET0
}
// Sample/unpack the normal/z data
float4 prepassSample = TORQUE_PREPASS_UNCONDITION( prePassBuffer, uvScene );
float3 normal = prepassSample.rgb;
float depth = prepassSample.a;
float4 deferredSample = TORQUE_PREPASS_UNCONDITION( prePassBuffer, uvScene );
float3 normal = deferredSample.rgb;
float depth = deferredSample.a;
// Eye ray - Eye -> Pixel
float3 eyeRay = getDistanceVectorToPlane( -vsFarPlane.w, IN.vsEyeDir.xyz, vsFarPlane );

View file

@ -99,9 +99,9 @@ float4 main( ConvexConnectP IN ) : TORQUE_TARGET0
}
// Sample/unpack the normal/z data
float4 prepassSample = TORQUE_PREPASS_UNCONDITION( prePassBuffer, uvScene );
float3 normal = prepassSample.rgb;
float depth = prepassSample.a;
float4 deferredSample = TORQUE_PREPASS_UNCONDITION( prePassBuffer, uvScene );
float3 normal = deferredSample.rgb;
float depth = deferredSample.a;
// Eye ray - Eye -> Pixel
float3 eyeRay = getDistanceVectorToPlane( -vsFarPlane.w, IN.vsEyeDir.xyz, vsFarPlane );

View file

@ -213,9 +213,9 @@ float4 main( FarFrustumQuadConnectP IN ) : TORQUE_TARGET0
subsurface = float3(0.337255, 0.772549, 0.262745);
}
// Sample/unpack the normal/z data
float4 prepassSample = TORQUE_PREPASS_UNCONDITION( prePassBuffer, IN.uv0 );
float3 normal = prepassSample.rgb;
float depth = prepassSample.a;
float4 deferredSample = TORQUE_PREPASS_UNCONDITION( prePassBuffer, IN.uv0 );
float3 normal = deferredSample.rgb;
float depth = deferredSample.a;
// Use eye ray to get ws pos
float4 worldPos = float4(eyePosWorld + IN.wsEyeRay * depth, 1.0f);

View file

@ -33,7 +33,7 @@
uniform float oneOverSoftness;
uniform float oneOverFar;
TORQUE_UNIFORM_SAMPLER2D(prepassTex, 1);
TORQUE_UNIFORM_SAMPLER2D(deferredTex, 1);
//uniform float3 vEye;
uniform float4 prePassTargetParams;
#endif
@ -84,7 +84,7 @@ float4 main( Conn IN ) : TORQUE_TARGET0
float2 tc = IN.pos.xy * float2(1.0, -1.0) / IN.pos.w;
tc = viewportCoordToRenderTarget(saturate( ( tc + 1.0 ) * 0.5 ), prePassTargetParams);
float sceneDepth = TORQUE_PREPASS_UNCONDITION(prepassTex, tc).w;
float sceneDepth = TORQUE_PREPASS_UNCONDITION(deferredTex, tc).w;
float depth = IN.pos.w * oneOverFar;
float diff = sceneDepth - depth;
#ifdef CLIP_Z

View file

@ -28,7 +28,7 @@ uniform float3 eyePosWorld;
uniform float4 rtParams0;
uniform float4 waterFogPlane;
TORQUE_UNIFORM_SAMPLER2D(prepassTex, 0);
TORQUE_UNIFORM_SAMPLER2D(deferredTex, 0);
TORQUE_UNIFORM_SAMPLER2D(causticsTex0, 1);
TORQUE_UNIFORM_SAMPLER2D(causticsTex1, 2);
@ -40,7 +40,7 @@ float distanceToPlane(float4 plane, float3 pos)
float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
{
//Sample the pre-pass
float4 prePass = TORQUE_PREPASS_UNCONDITION( prepassTex, IN.uv0 );
float4 prePass = TORQUE_PREPASS_UNCONDITION( deferredTex, IN.uv0 );
//Get depth
float depth = prePass.w;

View file

@ -29,7 +29,7 @@ uniform vec4 rtParams0;
uniform vec4 waterFogPlane;
uniform float accumTime;
uniform sampler2D prepassTex;
uniform sampler2D deferredTex;
uniform sampler2D causticsTex0;
uniform sampler2D causticsTex1;
uniform vec2 targetSize;
@ -44,7 +44,7 @@ float distanceToPlane(vec4 plane, vec3 pos)
void main()
{
//Sample the pre-pass
vec4 prePass = prepassUncondition( prepassTex, IN_uv0 );
vec4 prePass = deferredUncondition( deferredTex, IN_uv0 );
//Get depth
float depth = prePass.w;

View file

@ -87,10 +87,10 @@ void main()
coc = half4(0);
for ( int i = 0; i < 4; i++ )
{
depth[0] = prepassUncondition( depthSampler, ( IN_tcDepth0.xy + rowOfs[i] ) ).w;
depth[1] = prepassUncondition( depthSampler, ( IN_tcDepth1.xy + rowOfs[i] ) ).w;
depth[2] = prepassUncondition( depthSampler, ( IN_tcDepth2.xy + rowOfs[i] ) ).w;
depth[3] = prepassUncondition( depthSampler, ( IN_tcDepth3.xy + rowOfs[i] ) ).w;
depth[0] = deferredUncondition( depthSampler, ( IN_tcDepth0.xy + rowOfs[i] ) ).w;
depth[1] = deferredUncondition( depthSampler, ( IN_tcDepth1.xy + rowOfs[i] ) ).w;
depth[2] = deferredUncondition( depthSampler, ( IN_tcDepth2.xy + rowOfs[i] ) ).w;
depth[3] = deferredUncondition( depthSampler, ( IN_tcDepth3.xy + rowOfs[i] ) ).w;
// @todo OPENGL INTEL need review
coc = max( coc, clamp( half4(dofEqWorld.x) * depth + half4(dofEqWorld.y), half4(0.0), half4(maxWorldCoC) ) );

View file

@ -117,7 +117,7 @@ void main()
//med.rgb = large;
//nearCoc = 0;
depth = prepassUncondition( depthSampler, IN_uv3 ).w;
depth = deferredUncondition( depthSampler, IN_uv3 ).w;
//return half4(depth.rrr,1);
//return half4(nearCoc.rrr,1.0);

View file

@ -23,7 +23,7 @@
#include "../postFx.hlsl"
#include "../../shaderModelAutoGen.hlsl"
TORQUE_UNIFORM_SAMPLER2D(prepassBuffer,0);
TORQUE_UNIFORM_SAMPLER2D(deferredBuffer,0);
// GPU Gems 3, pg 443-444
float GetEdgeWeight(float2 uv0, in float2 targetSize)
@ -50,7 +50,7 @@ float GetEdgeWeight(float2 uv0, in float2 targetSize)
for(int i = 0; i < 9; i++)
{
float2 uv = uv0 + offsets[i] * PixelSize;
float4 gbSample = TORQUE_PREPASS_UNCONDITION( prepassBuffer, uv );
float4 gbSample = TORQUE_PREPASS_UNCONDITION( deferredBuffer, uv );
Depth[i] = gbSample.a;
Normal[i] = gbSample.rgb;
}

View file

@ -24,7 +24,7 @@
#include "shadergen:/autogenConditioners.h"
// GPU Gems 3, pg 443-444
float GetEdgeWeight(vec2 uv0, in sampler2D prepassBuffer, in vec2 targetSize)
float GetEdgeWeight(vec2 uv0, in sampler2D deferredBuffer, in vec2 targetSize)
{
vec2 offsets[9] = vec2[](
vec2( 0.0, 0.0),
@ -47,7 +47,7 @@ float GetEdgeWeight(vec2 uv0, in sampler2D prepassBuffer, in vec2 targetSize)
for(int i = 0; i < 9; i++)
{
vec2 uv = uv0 + offsets[i] * PixelSize;
vec4 gbSample = prepassUncondition( prepassBuffer, uv );
vec4 gbSample = deferredUncondition( deferredBuffer, uv );
Depth[i] = gbSample.a;
Normal[i] = gbSample.rgb;
}
@ -85,12 +85,12 @@ float GetEdgeWeight(vec2 uv0, in sampler2D prepassBuffer, in vec2 targetSize)
in vec2 uv0;
#define IN_uv0 uv0
uniform sampler2D prepassBuffer;
uniform sampler2D deferredBuffer;
uniform vec2 targetSize;
out vec4 OUT_col;
void main()
{
OUT_col = vec4( GetEdgeWeight(IN_uv0, prepassBuffer, targetSize ) );//rtWidthHeightInvWidthNegHeight.zw);
OUT_col = vec4( GetEdgeWeight(IN_uv0, deferredBuffer, targetSize ) );//rtWidthHeightInvWidthNegHeight.zw);
}

View file

@ -25,7 +25,7 @@
#include "./../torque.hlsl"
#include "./../shaderModelAutoGen.hlsl"
TORQUE_UNIFORM_SAMPLER2D(prepassTex, 0);
TORQUE_UNIFORM_SAMPLER2D(deferredTex, 0);
uniform float3 eyePosWorld;
uniform float4 fogColor;
uniform float3 fogData;
@ -33,8 +33,8 @@ uniform float4 rtParams0;
float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
{
//float2 prepassCoord = ( IN.uv0.xy * rtParams0.zw ) + rtParams0.xy;
float depth = TORQUE_PREPASS_UNCONDITION( prepassTex, IN.uv0 ).w;
//float2 deferredCoord = ( IN.uv0.xy * rtParams0.zw ) + rtParams0.xy;
float depth = TORQUE_PREPASS_UNCONDITION( deferredTex, IN.uv0 ).w;
//return float4( depth, 0, 0, 0.7 );
float factor = computeSceneFog( eyePosWorld,

View file

@ -25,7 +25,7 @@
#include "shadergen:/autogenConditioners.h"
#include "../../gl/torque.glsl"
uniform sampler2D prepassTex ;
uniform sampler2D deferredTex ;
uniform vec3 eyePosWorld;
uniform vec4 fogColor;
uniform vec3 fogData;
@ -38,8 +38,8 @@ out vec4 OUT_col;
void main()
{
//vec2 prepassCoord = ( uv0.xy * rtParams0.zw ) + rtParams0.xy;
float depth = prepassUncondition( prepassTex, uv0 ).w;
//vec2 deferredCoord = ( uv0.xy * rtParams0.zw ) + rtParams0.xy;
float depth = deferredUncondition( deferredTex, uv0 ).w;
//return vec4( depth, 0, 0, 0.7 );
float factor = computeSceneFog( eyePosWorld,

View file

@ -35,7 +35,7 @@ uniform mat4 matWorldToScreen;
uniform float velocityMultiplier;
uniform sampler2D backBuffer;
uniform sampler2D prepassTex;
uniform sampler2D deferredTex;
out vec4 OUT_col;
@ -44,11 +44,11 @@ void main()
vec2 IN_uv0 = _IN_uv0;
float samples = 5;
// First get the prepass texture for uv channel 0
vec4 prepass = prepassUncondition( prepassTex, IN_uv0 );
// First get the deferred texture for uv channel 0
vec4 deferred = deferredUncondition( deferredTex, IN_uv0 );
// Next extract the depth
float depth = prepass.a;
float depth = deferred.a;
// Create the screen position
vec4 screenPos = vec4(IN_uv0.x*2-1, IN_uv0.y*2-1, depth*2-1, 1);

View file

@ -39,7 +39,7 @@
// Uniforms
//-----------------------------------------------------------------------------
uniform sampler2D prepassTex ;
uniform sampler2D deferredTex ;
uniform sampler2D backbuffer ;
uniform sampler1D waterDepthGradMap;
uniform vec3 eyePosWorld;
@ -55,9 +55,9 @@ out vec4 OUT_col;
void main()
{
//vec2 prepassCoord = IN_uv0;
//vec2 deferredCoord = IN_uv0;
//IN_uv0 = ( IN_uv0.xy * rtParams0.zw ) + rtParams0.xy;
float depth = prepassUncondition( prepassTex, IN_uv0 ).w;
float depth = deferredUncondition( deferredTex, IN_uv0 ).w;
//return vec4( depth.rrr, 1 );
// Skip fogging the extreme far plane so that

View file

@ -25,7 +25,7 @@
#include "../../gl/postFX.glsl"
uniform sampler2D backBuffer; // The original backbuffer.
uniform sampler2D prepassTex; // The pre-pass depth and normals.
uniform sampler2D deferredTex; // The pre-pass depth and normals.
uniform float brightScalar;
@ -38,7 +38,7 @@ void main()
vec4 col = vec4( 0, 0, 0, 1 );
// Get the depth at this pixel.
float depth = prepassUncondition( prepassTex, IN_uv0 ).w;
float depth = deferredUncondition( deferredTex, IN_uv0 ).w;
// If the depth is equal to 1.0, read from the backbuffer
// and perform the exposure calculation on the result.

View file

@ -24,7 +24,7 @@
#include "../postFx.hlsl"
TORQUE_UNIFORM_SAMPLER2D(backBuffer, 0);
TORQUE_UNIFORM_SAMPLER2D(prepassTex, 1);
TORQUE_UNIFORM_SAMPLER2D(deferredTex, 1);
uniform float brightScalar;
@ -36,7 +36,7 @@ float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
float4 col = float4( 0, 0, 0, 1 );
// Get the depth at this pixel.
float depth = TORQUE_PREPASS_UNCONDITION( prepassTex, IN.uv0 ).w;
float depth = TORQUE_PREPASS_UNCONDITION( deferredTex, IN.uv0 ).w;
// If the depth is equal to 1.0, read from the backbuffer
// and perform the exposure calculation on the result.

Some files were not shown because too many files have changed in this diff Show more