Commit graph

1228 commits

Author SHA1 Message Date
Azaezel 496b6a3ea8 truncation warning cleanups dx side (was also causing cornercase crashes gl side) 2016-02-26 00:21:01 -06:00
Azaezel 8c5810adad The final step (barring any overlooked missing bits, requested refactors, and of course, rolling in dependencies already submitted as PRs) consists of:
renderPrePassMgr.cpp related:
A) shifting .addFeature( MFT_XYZ); calls from ProcessedShaderMaterial::_determineFeatures to ProcessedPrePassMaterial::_determineFeatures
B) mimicking the "// set the XXX if different" entries from RenderMeshMgr::render in RenderPrePassMgr::render
C) fleshing out ProcessedPrePassMaterial::getNumStages() so that it shares a 1:1 correlation with ProcessedShaderMaterial::getNumStages()
D) causing inline void Swizzle<T, mapLength>::ToBuffer( void *destination, const void *source, const dsize_t size )  to silently fail rather than fatally assert if a source or destination buffer is not yet ready to be filled. (support for #customTarget scripted render targets)

Reflections:
A) removing reflectRenderState.disableAdvancedLightingBins(true); entries. this would otherwise early out from prepass and provide no color data whatsoever.
B) removing the fd.features.addFeature( MFT_ForwardShading ); entry forcing all materials to be forward lit when reflected.
C) 2 things best described bluntly as working hacks:
C1) when reflected, a scattersky is rotated PI along it's z then x axis in order to draw properly.
C2) along similar lines, in terraincellmaterial, we shut off culling if it's a prepass material.

Skies: scattersky is given a pair of rotations for reflection purposes, all sky objects are given a z value for depth testing.
2016-02-16 02:50:49 -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 5b5c6b9907 Deferred Shading
Phase 1: buffers
engine:
provides the following hooks and methods
A) render target "color", and "matinfo". these correspond to texture[0] = "#color";  texture[2] = "#matinfo"; entries in scripts
B) utilizes the independentMrtBitDepth method added GarageGames#857 to set color to an 8RGBA if cards support it
C) adds an RenderPrePassMgr::_initShaders() method to support void RenderPrePassMgr::clearBuffers(). This operates as a pseudo-postfx by rendering a veiwspace plane which fills the screen, then calls a shader which fills both the introduced rendertarget buffers and the prepass buffer to relevant defaults (white with full alpha for prepass, black with full alpha for color and material respectively)

script:
\game\tools\worldEditor\main.cs adds additional hooks similar to GarageGames#863 for colorbuffer, specular map, and backbuffer display
\game\core\scripts\client\lighting\advanced\deferredShading.cs adds the clearbuffer shader, visualizers, and the ShaderData( AL_DeferredShader )  +  PostEffect( AL_DeferredShading ) which combine the various buffers into the output which reaches the screen under normal conditions, as well as the extended debug visualizers.
again, note the lines

   texture[0] = "#color";
   texture[1] = "#lightinfo";
   texture[2] = "#matinfo";
   target = "$backBuffer";
in particular for the core tie-in.

shader:
\game\shaders\common\lighting\advanced\deferredColorShaderP.hlsl
\game\shaders\common\lighting\advanced\gl\deferredClearGBufferP.glsl
the previously mentioned shaders which clear the buffers to specified colors

\game\shaders\common\lighting\advanced\deferredShadingP.hlsl
\game\shaders\common\lighting\advanced\gl\deferredShadingP.glsl
the tie-in shaders

the rest are visualizers

purpose: to expose methodology that allows one to render color, lighting and material information such as specular and gloss which effect the result of both when combined

long term intent: the previous prepass lighting methodology while serviceable, unfortunately had the side effect of throwing out raw color information required by more modern pipelines and methodologies. This preserves that data while also allowing the manipulation to occur only on a screenspace (or reflected speudo-screenspace) basis.
2016-02-16 01:50:58 -06:00
Areloch cb22357eb2 Merge pull request #1461 from Azaezel/textureLinearization
Diffuse/albedo texture linearization
2016-02-16 01:23:16 -06:00
Areloch 98b3d3294d Merge of PR #855 2016-02-16 00:23:02 -06:00
Anis f30aac3655 Merge pull request #1424 from rextimmy/fmod_crash_fix
Changed order of fmodex library unload.
2016-02-16 00:26:47 +01:00
Anis 168a2fe029 Merge pull request #1419 from irei1as/patch-1
mQuat.h change to fix QuatF::angleBetween
2016-02-16 00:22:39 +01:00
irei1as 6891d348af Update mQuat.h 2016-02-15 18:50:18 +01:00
irei1as 39613c0d87 Optimized
You're right. If the normalized quaternions are in a variable or something for normal uses it's just a waste to force the change hidden inside again.
2016-02-15 18:43:56 +01:00
Anis 74c189681c Merge pull request #1504 from Lopuska/patch-16
ResourceLeakFix for OpenGL
2016-02-15 14:08:44 +01:00
Anis b009d678fa Merge pull request #1505 from Azaezel/OcclusionQueryFixGL_Clean
courtessy @Lopuska: opengl occlusion query fix
2016-02-15 14:07:09 +01:00
Areloch eebb1852f0 Merge pull request #1507 from RoundedIcon/PlayerScalingFix
Works  nicely.
2016-02-13 11:17:28 -06:00
RoundedIcon 7924f056bd Fix for collision issues with scaled players
Players scaled after their creation have collision issues with terrain.
Changing this bit of code fixes those issues for downsized players, even
when shrunk to 10% of their original size.
2016-02-01 16:58:39 -07:00
Azaezel 0f173df0d4 setDetailFromDistance aspect ratio friendly adjustment 2016-01-28 00:42:08 -06:00
Azaezel 23c4b52e1f courtessy @Lopuska: opengl occlusion query fix 2016-01-18 00:28:09 -06:00
Anis e2d789e87d Update gfxGLTextureTarget.cpp 2016-01-18 06:17:20 +01:00
Anis ca31ef3f1a Update gfxGLWindowTarget.cpp 2016-01-18 06:15:07 +01:00
Anis 500a237892 Update gfxGLWindowTarget.h 2016-01-18 05:56:00 +01:00
Anis c3ef59e39c Update gfxGLWindowTarget.cpp 2016-01-18 05:55:48 +01:00
Anis 0728282287 Update gfxGLTextureTarget.cpp 2016-01-18 05:55:36 +01:00
Anis 58a604d363 Update gfxGLCircularVolatileBuffer.h 2016-01-18 05:49:05 +01:00
Areloch 6235f63deb Merge pull request #1395 from Azaezel/AssertDivNULL
credit to @MusicMonkey5555 for spotting. asserts for Div/NULLs
2016-01-16 17:53:00 -06:00
Areloch 32ec7f0ef6 Merge pull request #1474 from Azaezel/navMess
mDirtyTiles changed from std::queue to a vector
2016-01-16 17:21:49 -06:00
Areloch 41038ec9ae Merge pull request #1502 from Lopuska/patch-1
Glow buffer graphic corruption fix on OpenGL.
2016-01-16 13:07:06 -06:00
Areloch ff2df5c43f Merge pull request #1478 from Areloch/VolFog2
Volumetric Fog Take 2
2016-01-15 11:22:25 -06:00
Anis cae97cac37 Glow buffer graphic corruption fix on OpenGL.
Caused by a wrong target size. (probably it was ok on the very old OpenGL 1.5 version)
Before fix, wrong behaviour:
http://goo.gl/dik7Ia
After fix, all right:
http://goo.gl/IsrckM
2016-01-14 23:51:35 +01:00
Areloch c2da755dc2 Fix for the directory scan for modules so it doesn't trim off characters in the path.
Resubmitted to clear the excess history entries.
2016-01-08 00:19:11 -06:00
rextimmy e3b228db8b Fix for OpenGL/D3D11 bottom border offset 2015-12-28 09:17:14 +10:00
Areloch 24dc8e6990 Merge pull request #1473 from Tribes2-SCP/tinyXMLFix
Fix TinyXML Build errors
2015-12-21 01:10:15 -06:00
Areloch d30529bbeb Merge pull request #1459 from Azaezel/dangedDecalDatablocks
corrects ghosted decal datablock lookup flaw
2015-12-20 02:17:56 -06:00
Marc Chapman ac7d6e6691 Updated paths for collada tdictionary.h 2015-12-13 03:33:39 +00:00
Robert MacGregor d6226a71ca Fix NULL pointer deref crashes in WorldEditor::selectObject & WorldEditor::unSelectObject 2015-12-02 01:47:29 -05:00
Areloch 21be97d206 Missed a few files. 2015-12-01 00:49:37 -06:00
Areloch a90eb9762b Re-submission of the Volumetric Fog PR, with cleanup. 2015-12-01 00:10:13 -06:00
Azaezel b0b39b5f83 mDirtyTiles changed from std::queue to a vector
allows us to leverage  .push_back_unique(&foo); and .clear();
2015-11-27 16:17:30 -06:00
Areloch 272e3138a0 Merge pull request #1470 from Azaezel/waterIsNotStatic
As I nor az have been able to find any issues with this so far, I'll push this through. We can handle any emergent problems as they come up, but so far it looks solid.
2015-11-26 12:37:20 -06:00
Robert MacGregor d3c7edfe42 Fix TinyXML Build errors 2015-11-22 02:45:25 -05:00
Azaezel b6bd8c863c removes StaticObjectType flag from water objects.
https://github.com/GarageGames/Torque3D/issues/1458
2015-11-20 10:52:57 -06:00
Areloch 703fff01fb Merge pull request #1460 from Azaezel/FileFallbackFoulups
fillin for fallbacks for filesystem funcs
2015-11-16 21:42:22 -06:00
Areloch 113bb6b62d Merge pull request #1463 from Azaezel/bulletBreak3
missed a convexSweepTest early-out check.
2015-11-14 16:12:57 -06:00
Azaezel 74a194a277 missed a convexSweepTest early-out check. 2015-11-14 11:26:42 -06:00
Areloch dbe870f8e5 Merge pull request #1433 from Azaezel/CommandControl
The TypeCommand type brings up a full notepad-esque interface.
2015-11-13 00:31:22 -06:00
Areloch 1a009d6dd3 Merge pull request #1443 from Areloch/TAM_Implementation
TAML, Assets and Modules implementation
2015-11-12 23:54:27 -06:00
Areloch 92aa785bb2 Merge pull request #1442 from Azaezel/shadow_caching
This all seems to work pretty well.
2015-11-12 12:49:58 -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 f719731c52 fillin for fallbacks for filesystem funcs 2015-11-09 19:40:30 -06:00
Areloch 51b6469922 Merge pull request #1439 from Azaezel/initTextureSpace
ensures opengl texSpaceMat is initialized from the get-go
2015-11-09 10:55:10 -06:00
Azaezel b1fccc848c corrects ghosted decal datablock lookup flaw 2015-11-07 09:04:47 -06:00
Azaezel f4d40bf1b0 hooks meshroads up to the material system for castrays (at a minimum, sound playback) 2015-11-05 10:18:17 -06:00