It has now been a few months since we’ve had a team dedicated to
R&D and focusing on our graphics engine and tools. The following is a description of what we've been working on.
Topics discussed in this post are:
- Dynamic time of day, weather and visibility transitions
- Picture in picture
- Morph animation
- Atmospheric effects framework
- Precipitation cones
- Sun shafts
- Volumetric clouds
- Volumetric mist
- Instancing and procedural mesh functionality
- Tri-planar mapping for dynamic soil
- Decal system for tyre tracks
- Voxel systems
- Instanced grass
- Instanced rock
Dynamic time of day, weather and visibility transitions
Our dynamic environment system
controls time of day, weather and visibility. Unlike our old environment system
from a few years back, our current one is fully dynamic (any time of day,
weather and visibility combination is possible, rather than discrete settings).
However, due to time constraints when developing it, we never took the time to
fully expose these features, and so it isn’t readily apparent when using the
sims.
In late 2012, because our Patria
clients had such high expectations, we wanted to impress them in any way we
could, and enabling / showcasing this existing functionality was one way to do
so. I changed the framework in such a way that it can be turned on / off in the
dynamic environment file in the library. When dynamic transitions are enabled,
changes in time of day, weather and visibility occur via a transition that
takes place over about a second (the duration is configurable).
In its current useage it’s pretty
much just eye candy, but it highlights that we're using a dynamic system and showcases
our technology a bit. Future military projects might require full use of the
dynamic environment, whereby full control over time of day, weather and
visibility is needed (rather than us just providing a few pre-selected discrete
settings).
Picture in picture
The sim now supports picture in
picture functionality. We experienced some rendering artifacts when trying to
ship with this functionality earlier this year, but have fixed this now (well…
hopefully we have, we’ll verify soon, and remedy any issues that arise).
Morph animation
I started working on integrating
a new animation technique, called morph animation, into our sims. Currently we
use a very outdated method using multiple static meshes that we simply switch
between. This method would allow us to blend between these static meshes
instead (and thus require fewer discrete animation frames, we’d only require a
few control frames and would procedurally create the rest). This would give
smoother animation, save memory, and save time for the artists. However, this
functionality is not yet finished, and so is not available yet. We are
investigating using animation middleware, which would probably prove to be an
even better route. As such, work on morph animation is on hold for now.
Atmospheric effects framework
This is a framework that
integrated precipitation cones, sunshafts, volumetric clouds and volumetric fog
into the sim. Each of these will be discussed separately hereafter.
Precipitation cones
This is another environment
enhancement that has been carried over from Patria and integrated into our
sims. For Patria we required snow, in addition to rain. The traditional method
of using particle systems proved insufficient – the density of snow required
was not feasible using particle systems without incurring unacceptable
performance penalties. A new method was thus required. This new method uses
what is called a precipitation cone, and can now be used to supplement our
current method of rendering rain (and snow). It is currently ready for use, but
I will work with Deon to finalize it and phase it in in the coming weeks.
Sun shafts
Another feature of the new
atmospheric effects framework. This adds an additional dynamic element to the
scene, and makes the sim graphics look more current gen. As with all of the
atmospheric effects features, it is currently ready for use, but I will work
with Deon to finalize it and phase it in in the coming weeks.
Volumetric clouds
I had implemented volumetric
clouds before, using Direct3D9, and so porting this over to our engine was
fairly trivial. Although volumetric clouds are typically only a requirement for
flight sims etc, they are a feature of many highly-regarded engines (such as
CryEngine 2 onwards) and they can contribute to a more realistic looking scene.
As with all of the atmospheric effects features, these are ready for use, but
Deon and I will probably focus on the other atmospheric effects features first.
Volumetric mist
This is an extension of the
volumetrics clouds system. Our current mist / fog solution is very traditional
– in our pixel shaders we simply alter the colour of surfaces based on
equations that take distance and various fog parameters into consideration.
Combined with depth-of-field, this can be quite effective for distant
atmospheric haze. However, when fog and mist are enabled, it appears quite flat
and bland. With volumetric mist, there is actual, tangible mist floating in
front of you. You can see it being affected by the wind and can drive through
it. This supplements, rather than replaces our current visibility system. This
is currently ready for use, but I will work with Deon to finalize it and phase
it in in the coming weeks.
Instancing and procedural mesh functionality
Our graphics engine has quite a
bit of overly-complicated, inflexible mesh classes that we have struggled to
work with. Additionally, our engine did not support instancing, which is a
method that is very effective for drawing large numbers of objects. Seeing how
well SpeedTree performs (it uses instancing), we decided that we needed an
instancing framework of our own, as well as a procedural mesh class for it to
use. This allows us to procedurally generate geometry and then mass-place it.
This system is complete, and is currently being used for various features that
are currently in progress, including tyre tracks, as well as our new grass and
rock rendering system.
Tri-planar mapping for dynamic soil
Our method of texturing the
dynamic soil resulted in texture stretching, and did not look particularly
good. Christian implemented a technique called tri-planar mapping that solves
the problem. This same technique (tri-planar mapping) has proven to be
re-usable, and is also used for our new rock rendering system. This is currently
only ready to use for certain types of dynamic soil (we need to upgrade the
system to work for dynamic soil that has multiple strata). For ‘dumped’ soil
(haultrucks, LHDs, shovels etc) this method can be used to get better visuals.
Deon and I need to discuss whether this can be integrated into our art process.
Decal system for tyre tracks
Christian has leveraged the
instancing system described earlier in order to implement tyre tracks. This
works by placing lots of decals on the ground beneath the wheels. The results
look very good and we’d like to get this functionality into a sim soon. A
programmer on a vehicle team would need to have their graphics object vehicle
class inherit from and implement an interface called IGraphicalTyreTrack.
Christian will give more details when required.
Voxel systems
Toward the end of last year it
was decided that we would need to implement a voxel-based system to meet the
requirements for the upcoming continuous miner project. A full-blown voxel
engine is a massive undertaking, made even more daunting by the distributed
nature of our sims (sending the data across the network is a problem). We have
opted to go for a toned-down voxel system framework that integrates into our
engine and allows only small portions of the world to be represented as voxels.
This is still a work-in-progress, but much of the core work and technical
challenges have been done. The voxel system does not yet look pretty (and there
are some rendering artifacts remaining), but the dynamics and graphics objects
logic and communications are in place. Much of the high-risk work is out of the
way. In the next month or two we will see this system fleshed out.
Instanced grass
For Patria I wrote a system
called a landscape populator, which populates the landscape with objects like
grass. Although it worked well enough, I had to perform a draw call for every
grass patch, and Patria was already pushing the limits enough that we couldn’t
risk adding more performance overhead. However, Christian has upgraded this
class to use the instancing functionality described earlier. A lot of work has
been put into this, to provide our own version of SpeedGrass. From a tech
perspective, this has proven to look and perform very well. We still need to
integrate it into the art process before it becomes an official feature of our
sims. We have discussed it with Deon and have a plan for this.
Instanced rock
Deon was lamenting the fact that
we couldn’t implement realistic rocky terrain worlds, and that what he wanted
for Sudan world wasn’t feasible with our engine. He required lots of very small rocks distributed
over the terrain that the vehicle cannot drive over, to limit driving to
certain sections of the world. Simply texturing the terrain differently does
not give the correct visual cues and detracts from the realism of the sim.
Christian extended the landscape populator (essentially, duplicated and
modified the grass system) so that it procedurally generates and distributes
many small rocks. As with the grass, on the engine side this is working well,
but we need to work with Deon and Shelvin to establish the best way to
integrate this into the art pipeline.