Commit graph

27 commits

Author SHA1 Message Date
Areloch b19a4b22c8 Implementation of reflection and skylight probes.
Moves lighting math to the diffuse/specular two-channel logic.
2018-09-16 22:15:07 -05:00
Areloch b4a1d18f42 Core implementation of Physical Based Rendering. 2018-09-15 20:19:57 -05:00
Azaezel 1138637718 crashfix from prior commit 2018-03-14 18:44:51 -05:00
Azaezel 02541ab1f9 shader hooks and gen cleanups 2018-03-13 18:07:58 -05:00
Areloch 8c807485b1 Reworks the $Core::commonShaderPath variable usage to be a static variable in ShaderGen for efficiency(only one getVariable when shadergen is initialized), as well as implements the ability to set a default value, and ensures that it tries to set a path even if the pref variable is missing which is important for ported projects from older builds. 2017-07-24 00:40:27 -05:00
Areloch 25686ed4be Implementation of sRGB image support. Overhauls the linearization setup to utilize the sRGB image types, as well as refactors the use of ColorF and ColorI to be properly internally consistent. ColorIs are used only for front-facing/editing/UI settings, and ColorFs, now renamed to LinearColorF to reduce confusion of purpose, are used for color info in the engine itself. This avoids confusing and expensive conversions back and forth between types and avoids botches with linearity. Majority work done by @rextimmy 2017-06-23 11:36:20 -05:00
Areloch edd1e0a270 Removes Direct3D9 functionality. 2017-05-28 16:51:31 -05:00
Areloch af8fbf0e3a Goes and replaces the references/names that use Prepass to be Deferred, since we're actually using deferred. 2017-04-11 00:23:14 -05:00
Areloch 1ed8b05169 Initial implementation of the new Base Game Template and some starting modules.
This makes some tweaks to the engine to support this, specifically, it tweaks the hardcoded shaderpaths to defer to a pref variable, so none of the shader paths are hardcoded.

Also tweaks how post effects read in texture files, removing a bizzare filepath interpretation choice, where if the file path didn't start with "/" it forcefully appended the script's file path. This made it impossible to have images not in the same dir as the script file defining the post effect.

This was changed and the existing template's post effects tweaked for now to just add "./" to those few paths impacted, as well as the perf vars to support the non-hardcoded shader paths in the engine.
2017-02-24 02:40:56 -06:00
Azaezel c6e2563a38 went overzealous on the bitangent cleanup when reviewing parallax. the W multiplier can and should stay. the y flip can remain gone. 2016-12-11 15:04:33 -06:00
Azaezel a5755be681 factoring in tangentW casues parallax (but not normals) to swap specular highlight directions. removed that, as well as a prior attempted workaround. 2016-12-06 23:30:35 -06:00
James Urquhart 3496c549b5 Hardware Skinning Support
- Supports GL, D3D9 & D3D11
- Extends vertex formats & shadergen to support blend indices and weights
- Adds basic support for using 4x3 matrices for shader constants
- Supports software fallback
2016-08-21 01:43:30 +01:00
Anis e13513f059 Merge pull request #1713 from Azaezel/c4189_cleanup
adresses C4189 warnings
2016-08-07 00:38:51 +02:00
Azaezel 76fe7937ce adresses C4189 warnings ('identifier' : local variable is initialized but not referenced) 2016-07-31 10:46:52 -05:00
Azaezel 21d1bfa64c 3.9 fix: on the hlsl side: corrects improperly applied specularpower
(slider in conjunction with cubemap). gl side kills a redundant test
2016-07-27 16:48:55 -05:00
Azaezel 942235d114 Fixes vertcolor code insertion order, and applies it adaptively based on defered or forward lit context 2016-05-25 03:08:28 -05:00
Azaezel d79b9a2988 removes w=z trick (was causing fisheye, effectively) 2016-05-18 06:38:13 -05:00
rextimmy 41e5caf22b Direct3D11 Engine/source changes 2016-03-20 21:52:11 +10: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
LuisAntonRebollo 15c8922028 Fix ShaderGen cubemap feature. 2014-12-15 18:28:17 +01:00
LuisAntonRebollo 1ac8fab884 Changes for get necesary sampler names for OpenGL shaders. 2014-11-08 18:31:14 +01:00
Azaezel c3813ad913 implicit truncation warning cleanup. 2014-07-09 16:25:42 -05:00
DavidWyand-GG eb2fd2bf5f Fix for Issue #94 for Cubemap render bug 2012-10-17 11:46:17 -04:00
DavidWyand-GG 7dbfe6994d Engine directory for ticket #1 2012-09-19 11:15:01 -04:00