Outdoor shadows solution for Quest3D
From now VRM offers an flexible solution for realtime shadowing in outdoor Q3D scenes!
Now compatible with Q3D 4.3 and with hardware shadow maps support!
Dynamic sun position
Dynamic geometry and animated characters
Support for partially opaque objects with alpha texture such as trees, foliage and etc.
Shadows are deferred and don't depend on shading of your objects
Seamless integration with "Screen Space ambient occlusion for Quest3D"
Full source code of implementation and demo scene with comments
Large-scale environments (size of demo scene is 500x500 meters)
Documentation and tutorials
Updated for Q3D 4.3 [NEW!]
Support of hardware shadow maps [NEW!]
Global shaders and flexible shadow map resolution [NEW!]
Post-process implementation of deferred shadow maps [NEW!]
Several options available in-box, you can use blured shadow-maps or jittered ones (like in GTA4), you can also turn on and off SSAO, making it easier to gather both fast & beautiful shadow solution.
Jittered & blured shadow
Benefits of integrated SSAO
"Outdoor shadows solution for Quest3D" include highly commented demo scene with all shader source codes.
Additional free download:
Download Outdoor shadows solution executable demo package|
Download Shadows solution executable demo with skinned character and nature painter
Tutorial 1: "Adding Outdoor Shadows Solution to rendering pipeline"
Tutorial 2: "Fixing bugs of limited precision"
Tutorial 3: "Adding Smart material"
And more to come...
Parallel-split deferred shadow maps for Quest3D
This is implementation of shadow mapping technique that is widely used in modern games.
Parallel-split shadow maps address problem of limited resolution of shadow maps textures,
this limitation is especially important for large-scale environments when scene is lit using directional light source.
More about algorithm itself you can read from this great article, published in GPU Gems 3
Deferred shadows is an approach to shadows calculation when shadow term is calculated in screen-space for all objects at ones.
Current implementation uses jittered PCF to soften edges of shadows and screen space blur to soften PCF result.
"Smart" blur is used to keep edges of geometry sharp and prevent leaking of shadows to neighbor geometry.
There are two
source code packages:
"Parallel-split deferred shadow maps for Quest3D"
"Parallel-split deferred shadow maps + Screen Space Ambient Occlusion for Quest3D"
Last one contains integration and source code of SSAO.
Limitations and hardware consideration:
Depth of the scene and shadow maps are stored in 16bit two channel float textures.
This limits hardware to GF 6xxx series by specification and practically to 8xxx series by fill-rate consideration.
Q3D 4.3 version might provide us with hardware shadow maps, this is special kind of "textures" that allows very fast rendering into them and good precision.
By utilizing them, performance might be dramatically improved. [future release]
Maximal resolution of shadow maps is limited to application resolution, the bigger resolution of application the better resolution of shadow maps you will have.
This limitation might be overcome in Q3D 4.3 version that should allow to use render to texture channels with size bigger than application window resolution. [future release]
As scene geometry need to be rendered several times:
depth, shadow map split #1,
shadow map split #2,
final render, this puts additional work on CPU as well as GPU.
Current implementation is frustum culling friendly and only objects in overlapped areas of splits will be rendered several times.
At the same time if amount of surfaces is not really big (less than 50) you might consider using collapsed mesh of static object for depth and shadow maps rendering.
In source code you will find implementation of Global shader for rendering depth and shadow maps, it can improve performance if you render objects separately.
Another option is a usage of different amount of split planes, and partial usage of them for shadow maps.
For example Crysis is using 4 split planes but only first three is used for shadows calculation.
Plans for future development and improvement:
Semi-transparent objects as shadow receivers, for example, window glass captures shadow and reflection is dimmed at shadowed area. This is not translucent shadows. Such object can receive shadow but not cast it.
Implementation of non-deferred version of Parallel-Split shadow maps with usage of ARGB8bit textures for shadow maps in Q3D 4.2.3 and hardware shadow maps in Q3D 4.3. This implementation is targeting older hardware and usage of shadows without SSAO or other depth based techniques.
Update for Q3D 4.3 that will include usage of hardware shadow maps, new Global shaders and flexible shadow map resolution.
Post-process implementation of deferred shadow maps. No guarantees, under research.
Links to discussions of Outdoor shadows solution for Quest3D: