Torque3D/Engine/source
Azaezel 196b214eae engine:
defines and alters a series of material features for deferred shading in order to define a fully fleshed out multiple render target gbuffer patterned after the general principles outlined http://www.catalinzima.com/xna/tutorials/deferred-rendering-in-xna/creating-the-g-buffer/ (though I cannot stress enough *not* using the identical layout)

script:
removes dead material features (ie: those that never functioned to begin with)

shader:
bool getFlag(float flags, int num) definition for retreiving data from the 3rd (matinfo) gbuffer slot's red channel (more on that shortly)

purpose:
_A)_ Small primer on how material features function:
When a https://github.com/GarageGames/Torque3D/search?utf8=%E2%9C%93&q=_determineFeatures call is executed, certain conditions trigger a given .addFeature(MFT_SOMEFEATURE) call based upon material definition entries, be it a value, a texture reference, or even the presence or lack thereof for another feature. In general terms, the first to be executed is ProcessedShaderMaterial::_determineFeatures followed by ProcessedPrePassMaterial::_determineFeatures. The next commit will provide the bindings there. For now it's enough to understand that one of those two will trigger the shadergen subsystem, when rendering a material, to check it's associated list of features and spit out a shader if one is not already defined, or reference a pre-existing one that includes codelines determined by that list of features.

Relevant execution of this is as follows:
DeclareFeatureType( MFT_DeferredDiffuseMap ); - Name
ImplementFeatureType( MFT_DeferredDiffuseMap, MFG_Texture, 2.0f, false ); - Codeline Insertion Order
FEATUREMGR->registerFeature( MFT_DeferredDiffuseMap, new DeferredDiffuseMapHLSL ); - Hook to class which actually generates code
alternately    FEATUREMGR->registerFeature( MFT_Imposter, new NamedFeatureHLSL( "Imposter" ) ); - a simple feature that serves no purpose further than as a test of it's existence (to modify other features for instance)

class DeferredDiffuseMapHLSL : public ShaderFeatureHLSL - Class definition
{
getName  -embeded in the proceedural shader as a remline both up top and before actual code insertions
processPix  - pixel shader codeline insertions
getOutputTargets - used to determine which buffer is written to (assumes only one. depending on branched logic, older features that may be run for either forward or deferred rendering depending on circumstance may have a logical switch based on additional feature flags. as an example:  TerrainBaseMapFeatHLSL::getOutputTargets)
getResources - associated with the Resources struct, closely aligned with the hardware regestry
 getBlendOp - used to determine what blend operation to use if a material requires a second pass (defaults to overwriting)
setTexData - ???
processVert - vertex shader codeline insertions
};

_B)_
The resultant Gbuffer layout defined by the previous commit therefore is as follows:
defaultrendertarget (referred to in shaders as out.col or col depending on GFX plugin) contains either lighting and normal data, or color data depending on if it is used in a deferred or forward lit manner (note for forward lit, this data is replaced as a second step with color. why custommaterials have traditionally had problems with lighting)
color1 (referred to in shaders as out.col1 or col1 depending on GFX plugin) RGB color data and an A for blending operations (including transparency)
color2 (referred to in shaders as out.col2 or col2 depending on GFX plugin) contains:
 red channel comprising material flags such as metalness, emissive, ect,
 green channel for translucency (light shining through, as oposed to  see-through transparency), blue for
 blue for specular strength (how much light influences net color)
 alpha for specular power (generally how reflective/glossy an object is)

long term purpose:
further down the line, these will be used to condition data for use with a PBR subsystem, with further corrections to the underlying mathematics, strength being replaced by roughness, and power by metalness
2016-02-16 02:23:23 -06:00
..
app Initial Implementation of the Taml, Asset and Modules systems. 2015-10-13 15:19:36 -05:00
assets Initial Implementation of the Taml, Asset and Modules systems. 2015-10-13 15:19:36 -05:00
cinterface Remove value constructors for ConsoleValueRef & fix callbacks which use them. Fixes issue #1289 2015-05-08 09:04:04 +10:00
collision Issue found with PVS-Studio: 2015-07-16 22:02:18 -05:00
component Replaced a ton of ConsoleMethods with the DefineConsoleMethod Macro. 2014-11-03 22:42:51 -05:00
console Fix TinyXML Build errors 2015-11-22 02:45:25 -05:00
core Merge pull request #1395 from Azaezel/AssertDivNULL 2016-01-16 17:53:00 -06:00
environment Missed a few files. 2015-12-01 00:49:37 -06:00
forest shadow caching 2015-10-13 18:12:19 -05:00
gfx Update gfxGLTextureTarget.cpp 2016-01-18 06:17:20 +01:00
gui Merge pull request #1478 from Areloch/VolFog2 2016-01-15 11:22:25 -06:00
i18n Issue found with PVS-Studio: 2015-07-21 23:22:21 -05:00
lighting engine: 2016-02-16 02:23:23 -06:00
main Pass by const reference 2015-02-20 18:42:32 -05:00
materials engine: 2016-02-16 02:23:23 -06:00
math Merge pull request #1419 from irei1as/patch-1 2016-02-16 00:22:39 +01:00
module Initial Implementation of the Taml, Asset and Modules systems. 2015-10-13 15:19:36 -05:00
navigation mDirtyTiles changed from std::queue to a vector 2015-11-27 16:17:30 -06:00
persistence Some cleanup and adding in the necessary changes to cmake. 2015-10-13 15:50:30 -05:00
platform Initial Implementation of the Taml, Asset and Modules systems. 2015-10-13 15:19:36 -05:00
platformMac Merge pull request #1173 from JeffProgrammer/gestalt_fix_gg 2015-07-23 16:20:36 +10:00
platformPOSIX Fixes for dedicated build on linux. 2014-05-30 12:35:39 +02:00
platformSDL release the mouse from window constraints when poping up a window prompt 2015-08-10 21:54:30 -05:00
platformWin32 Fix for the directory scan for modules so it doesn't trim off characters in the path. 2016-01-08 00:19:11 -06:00
platformX86UNIX Fix missing va_end's 2015-02-20 18:42:29 -05:00
postFx Issue found by PVS Studio: 2015-07-28 23:25:09 -05:00
renderInstance Deferred Shading 2016-02-16 01:50:58 -06:00
scene shadow caching 2015-10-13 18:12:19 -05:00
sfx Merge pull request #1424 from rextimmy/fmod_crash_fix 2016-02-16 00:26:47 +01:00
shaderGen engine: 2016-02-16 02:23:23 -06:00
sim Initial Implementation of the Taml, Asset and Modules systems. 2015-10-13 15:19:36 -05:00
T3D Merge of PR #855 2016-02-16 00:23:02 -06:00
terrain engine: 2016-02-16 02:23:23 -06:00
testing All unit tests that run now pass. 2014-09-29 11:38:44 +10:00
ts setDetailFromDistance aspect ratio friendly adjustment 2016-01-28 00:42:08 -06:00
util diffuse/albedo texture linearization 2015-11-11 13:52:46 -06:00
windowManager Re-submission of the Volumetric Fog PR, with cleanup. 2015-12-01 00:10:13 -06:00
ggEndOfLineFix.txt Engine directory for ticket #1 2012-09-19 11:15:01 -04:00