mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-12 19:31:41 +00:00
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.
This commit is contained in:
parent
2044b2691e
commit
2753f562e8
54 changed files with 1477 additions and 464 deletions
|
|
@ -182,6 +182,7 @@ Material::Material()
|
|||
mAlphaRef = 1;
|
||||
|
||||
mCastShadows = true;
|
||||
mCastDynamicShadows = true;
|
||||
|
||||
mPlanarReflection = false;
|
||||
|
||||
|
|
@ -288,7 +289,7 @@ void Material::initPersistFields()
|
|||
|
||||
addField( "useAnisotropic", TypeBool, Offset(mUseAnisotropic, Material), MAX_STAGES,
|
||||
"Use anisotropic filtering for the textures of this stage." );
|
||||
|
||||
|
||||
addField("envMap", TypeImageFilename, Offset(mEnvMapFilename, Material), MAX_STAGES,
|
||||
"The name of an environment map cube map to apply to this material." );
|
||||
|
||||
|
|
@ -390,6 +391,9 @@ void Material::initPersistFields()
|
|||
addField( "castShadows", TypeBool, Offset(mCastShadows, Material),
|
||||
"If set to false the lighting system will not cast shadows from this material." );
|
||||
|
||||
addField( "castDynamicShadows", TypeBool, Offset(mCastDynamicShadows, Material),
|
||||
"If set to false the lighting system will not cast dynamic shadows from this material." );
|
||||
|
||||
addField("planarReflection", TypeBool, Offset(mPlanarReflection, Material), "@internal" );
|
||||
|
||||
addField("translucent", TypeBool, Offset(mTranslucent, Material),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue