Commit graph

64 commits

Author SHA1 Message Date
Duion 99f7f1a97c some better default values 2017-02-25 17:44:48 +01:00
Anis 5d38357785 Merge pull request #1636 from Azaezel/TranslucentTargetTweak
puts forward-lit #targetname assignment of faux diffuse maps back
2016-08-21 20:10:59 +02: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
Azaezel aae017fcc3 file name reporting for 'sampler not defined' and rtParams error reports. 2016-08-01 08:49:36 -05:00
Areloch 2d934032ea Adds a check so if we're trying to hit a named target, it doesn't spam the console with errors about not finding the diffuse texture. 2016-07-07 00:52:57 -05:00
Azaezel 702e63cb0c puts forward-lit #targetname assignment of faux diffuse maps back 2016-06-07 13:54:30 -05:00
Areloch ee6d9961e3 Merge pull request #1582 from Azaezel/SubSurf
Reimplements a form of subsurface scattering
2016-05-25 13:35:44 -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 00cc949011 reimplements a form of subsurface scattering 2016-04-15 00:20:55 -05:00
Areloch 6a40b8bb84 Merge pull request #1559 from rextimmy/dx11_clean
Direct3D11 Support
2016-03-29 00:51:23 -05:00
Azaezel e475b3060b won't need that any more after this 2016-03-20 16:51:24 -05:00
rextimmy 41e5caf22b Direct3D11 Engine/source changes 2016-03-20 21:52:11 +10:00
Azaezel ed264e4e12 from @rextimmy automatically adds a sky feature to skies. (render sorting and orientation. previously required setting in script.) 2016-03-16 18:10:07 -05: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
Areloch cb22357eb2 Merge pull request #1461 from Azaezel/textureLinearization
Diffuse/albedo texture linearization
2016-02-16 01:23:16 -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 b778121fc4 castDynamicShadows defaults to false, flipped it over to true for materials on mobile/animated assets. 2015-11-02 23:06:51 -06:00
Azaezel 2753f562e8 shadow caching
SPECIAL NOTE: highly suggest https://github.com/GarageGames/Torque3D/pull/1441 or a variation thereof to prevent debug spew and false-postives for occlusion results.

With significant research, development and prototyping assistance from both @andr3wmac (shaders and partial hook work), and @LuisAntonRebollo (additional culling)

System operates as follows:
1) materials are given an additional castDynamicShadows boolean entry. (Default at time of writing is true by request. Personal usage at time of writing defaults to false. value is default-initialized in materialDefinition.cpp. script/gui exposed)
2) lights are given a staticRefreshFreq and dynamicRefreshFreq (in milliseconds). script/gui exposed
3) materials are (effectively) sorted into dynamic and static shadowmap render lists based on flag. (see shadowMapPass.cpp)
4) initial shadowmaps are generated for each light and 'list'.
5) as each refreshFreq times out, the relevant shadowmap for a given light is refreshed.

Special notes:
dynamicRefreshFreq for all lights is set to a (script exposed) 8MS refresh timer.
StaticRefreshFreq for the lions share of lights defaults to 250 MS (1/4 of a second)
scattersky's embedded light, which is intended to operate in a mobile manner, defaults to 8
to reiterate, these are all customizable per-light via script/inspector gui in the case of alternate project needs.
2015-10-13 18:12:19 -05:00
Areloch 95ab3a33a5 Merge pull request #719 from rextimmy/dxtnm-parallax-fix
Fix to allow parallax mapping with dxtnm textures via the red channel.
2015-08-27 23:59:20 -05:00
Areloch 5c688260d5 Issue found with PVS-Studio:
Many places utilize post-incrementation with iterators, but it's better performance to use pre-incrementation.

Resolved by changing the iter++ instances to ++iter;
2015-07-13 23:08:17 -05:00
Dennis Brakhane 6d5571e233 Fix preprocessor directive 2015-02-25 21:12:01 +01:00
LuisAntonRebollo 1f8dc19fbe Fix non OpenGL builds with old projects. 2015-02-15 20:27:46 +01:00
Daniel Buckmaster 014b566014 Merge remote-tracking branch 'gg/development-3.6' into development
Conflicts:
	Engine/source/T3D/gameFunctions.cpp
2015-01-29 21:17:38 +11:00
Luis Anton Rebollo 6492028bb2 Merge pull request #1035 from bpay/memfixes
Memfixes
2015-01-25 13:42:32 +01:00
Daniel Buckmaster ae284a89ec Merge branch 'development' into defineconsolemethod
Conflicts:
	Engine/source/materials/materialDefinition.cpp
2014-12-26 13:22:16 +11:00
Azaezel a4adf28ef5 mVertexFormat validation fix
With Permission from Jeff Faust.

   // AFX CODE BLOCK (bug-fix) <<
(no text, self evident)
2014-12-22 17:55:10 -06:00
Azaezel c6cdfafe4e cleaned up variant of https://github.com/GarageGames/Torque3D/pull/768 alterations: opengl support, in-shader bug-reporting, direction vector fit to material slider-bar. 2014-12-21 14:07:42 -06:00
Daniel Buckmaster 9396ae7176 Merge remote-tracking branch 'Winterleaf/Development-Console' into defineconsolemethod
Conflicts:
	Engine/source/T3D/missionMarker.cpp
2014-12-21 21:23:55 +11:00
Ben Payne dc780ddcae Fix use-after-delete 2014-12-11 19:09:02 -05:00
LuisAntonRebollo 6f975dd14a Fix a crash when change a material reclect cubemap. 2014-12-11 12:29:44 +11:00
LuisAntonRebollo 98e3651db5 Merge pull request #940 from BeamNG/add_opengl_support
Add/Activate OpenGL render.
2014-11-30 02:48:13 +01:00
LuisAntonRebollo 2f8d18c0c0 Merge pull request #929 from BeamNG/remove_old_opengl_code
Remove unnecesary code for handle OpenGL.
2014-11-30 02:22:24 +01:00
LuisAntonRebollo 03ffa1ddd3 Merge pull request #925 from BeamNG/shaderdata_samplernames
Add sampler names to ShaderData
2014-11-30 02:21:30 +01:00
LuisAntonRebollo 1c95ce21d6 Merge pull request #608 from BeamNG/use_gfxdevice_setupgenericshaders
Use GFXDevice::setupGenericShaders for support non Fixed Fuction Pipelines.
2014-11-30 02:20:00 +01:00
LuisAntonRebollo fab2bb46c5 Changes for get necesary sampler names for OpenGL shaders. 2014-11-30 02:18:28 +01:00
LuisAntonRebollo dd08fd2e7d Add OpenGL support. 2014-11-08 20:21:50 +01:00
LuisAntonRebollo 1ac8fab884 Changes for get necesary sampler names for OpenGL shaders. 2014-11-08 18:31:14 +01:00
LuisAntonRebollo f101fbe820 Remove unnecesary code for handle OpenGL. 2014-11-08 18:11:35 +01:00
LuisAntonRebollo 79e158d528 Add sampler names to ShaderData for use on old versions of OpenGL and Opengl ES2 that not support explicit sampler location on shader files. 2014-11-08 17:50:37 +01:00
Daniel Buckmaster 3082bb3adc Merge pull request #884 from GarageGames/development-3.6
Version 3.6.2
2014-11-05 20:28:01 +11:00
Vincent Gee acb192e2a5 Replaced a ton of ConsoleMethods with the DefineConsoleMethod Macro. 2014-11-03 22:42:51 -05:00
bank 62006e8b3c Remove unneeded double-initialization of the vars. 2014-10-19 14:30:46 +11:00
Daniel Buckmaster b507dc9555 Merge branch 'master' into console-func-refactor
Conflicts:
	Engine/source/app/net/net.cpp
	Engine/source/console/astNodes.cpp
	Engine/source/console/compiledEval.cpp
	Engine/source/console/console.h
	Engine/source/console/consoleInternal.h
	Engine/source/console/engineAPI.h
2014-10-14 15:09:11 +11:00
rextimmy 3c56bf3a56 Fix to allow parallax mapping with dxtnm textures via the red channel. 2014-07-03 17:56:47 +10:00
Azaezel ebbd8a2e02 Instancing clones the results of a previously used material to it's next instance. As such, it and Dynamic Cube Mapping are mutually exclusive features. 2014-06-20 14:45:12 -05:00
LuisAntonRebollo 6450294855 Fixes for dedicated build on linux.
Thx @Bloodknigh for Signal fix.
2014-05-30 12:35:39 +02:00
Thomas Fischer c850d60a4f Merge pull request #621 from BeamNG/glsl_shadergen
Update GLSL Shadergen.
2014-05-23 07:52:35 +02:00
LuisAntonRebollo ba36617aec Add RenderPassData::mSamplerNames for OpenGL code. Not used on DX9. 2014-04-17 17:48:33 +02:00
LuisAntonRebollo 33742599b3 Use GFXDevice::setupGenericShaders for support non Fixed Fuction Pipelines.
OpenGL and DirectX11 not support FFP, and GFDevice::disableShaders has not the necessary information to decide the shader to be used.

GFDevice::SetupGenericShaders is used instead of GFDevice::disableShaders.

GFDevice::disableShaders will be deprecated on T3D 4.0
2014-04-13 17:57:40 +02:00