Commit graph

19 commits

Author SHA1 Message Date
Azaezel d79b9a2988 removes w=z trick (was causing fisheye, effectively) 2016-05-18 06:38:13 -05:00
Azaezel 9472bfd3ca addresses https://github.com/GarageGames/Torque3D/issues/1537 via the following:
908be4818f/Engine/source/materials/materialDefinition.cpp (L261) denotes power as sharpness, reflected in the size/falloff of a highlight halo *

908be4818f/Engine/source/materials/materialDefinition.cpp (L264) denotes strength as overall brightness of highlights. **

*and sharpness of reflection if using a cubemap.
**  reflected in cubemapped objects as also degree of 'reflection' vs diffuse/albedo coloration.
2016-03-01 20:25:52 -06:00
Azaezel 496b6a3ea8 truncation warning cleanups dx side (was also causing cornercase crashes gl side) 2016-02-26 00:21:01 -06:00
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
Azaezel ce2964d2d0 diffuse/albedo texture linearization
http://http.developer.nvidia.com/GPUGems3/gpugems3_ch24.html
2015-11-11 13:52:46 -06:00
Azaezel 215ae1429e ensures opengl texSpaceMat is initialized from the get-go (whines in console otherwise) 2015-10-11 22:47:33 -05:00
Luis Anton Rebollo 25a790103e Merge pull request #1116 from Lopuska/patch-16
Intel OpenGL - fix a crash/shader compile error when you activate Vertex...
2015-02-07 22:24:55 +01:00
Luis Anton Rebollo be84142502 Merge pull request #1118 from Lopuska/patch-17
fix #1117
2015-01-24 22:59:06 +01:00
Anis 4ccf89ba8e fix to avoid a missing sampler name declaration 2015-01-21 14:39:05 +01:00
Anis 5d392e373e Update shaderFeatureGLSL.cpp 2015-01-20 19:13:25 +01:00
Anis c9116dd4a4 OpenGL fix - fixed a crash when you activate Alpha Threshold checkbox without a diffuse map 2015-01-20 19:07:29 +01:00
Anis f05b1b5cbd fix #1117 2015-01-20 17:02:56 +01:00
Anis 9d84372dc8 Intel OpenGL - fix a crash/shader compile error when you activate Vertex Lit from Material Editor 2015-01-19 20:56:02 +01:00
LuisAntonRebollo 15c8922028 Fix ShaderGen cubemap feature. 2014-12-15 18:28:17 +01:00
LuisAntonRebollo 4409a12af6 Fix GLSL out fragment shader color. 2014-11-30 05:32:40 +01:00
Anis 2582670925 Update shaderFeatureGLSL.cpp
fix compile shader
2014-11-27 20:31:58 +01:00
LuisAntonRebollo dd08fd2e7d Add OpenGL support. 2014-11-08 20:21:50 +01:00
LuisAntonRebollo 9221b4dd10 Update GLSL Shadergen. Not used on DX9. 2014-04-17 18:39:13 +02:00
DavidWyand-GG 7dbfe6994d Engine directory for ticket #1 2012-09-19 11:15:01 -04:00