|
|
|
|
All use of my digital work is covered by this
Creative Commons Deed.
Please do not use any of my work for commercial purposes, thank you. |
|
|
|
Creating Terrain (1 of 7)
|
|
|
|
|
|
|
|
|
|
|
|
The first part of the article will discuss the history of the technology and show how it has changed
over the years. The second part will show some example of how to create of a terrain using the latest methods
and compiler from Shaderlab. This article is designed to work
with most Q3 engine type games and does not use any specific engine features.
The source files
contain a collection of maps that were used to create the screenshots for this article. If you want to
experiment with terrain blending and alpha fade brushwork while reading this article then I recommend
you have a look at the source files.
I would like to thank Randy "ydnar" Reddig for constantly answering my questions and offering technical
support with the finer details of the DotProduct2 system. Ken "kat" Beyer and Tom "shallow" Waters for
providing excellent feedback on the content and layout.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The initial terrain was a collection of fixed sized triangles arranged in a mesh or grid.
The texturing was done via a metashader (a collection of special shaders) and the
blends on the terrain were done via an external alpha map. (PCX file format)
The terrain brushes were groupered together and given special keys that specified total
layers used, metashader information and external alpha map name / location.
The terrain was vertex lit and generally glowed because of the flat lighting model.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The next change was a subtle one with regards to technology but visually was a giant leap forward.
The metashader was changed to use lightmaps instead of flat vertex light. This allowed for
the rest of the map to cast shadows onto the terrain.
The terrain mesh and blending was still done as before but there were several third party
tools available which could help with the creation process.
As the terrain textures were often stretch over large distances a detail texture was added to
give the illusion of greater texture resolution. This did come at a price to the video card.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Finally a new system was developed and the metashader was replaced with a single shader.
The steepness of the terrain was used
for blending purposes and the triangle grid could now be any shape or size!
It was now easier to make realistic terrain shapes but this system had one flaw,
each terrain shader could only support two textures.
The best solution at the time was to hide the material seams with paths
or roads but even these textures could only be stretch so far. There was also no way to control
the blends manually which meant that blending occurred at the mercy of the triangles.
|
|
|
|
|
|
|
|
|
DotProduct2 + Alpha Fade Terrain
|
|
|
|
|
|
|
|
|
|
|
|
|
|
With the Alpha Fade system, terrains can be blended easier with the DotProduct2 shader
as the initial pass on the terrain and then fine tuning with Alpha Fade brushes afterwards.
The previous DotProduct2 texture limitation was broken and using the Alpha Fade brushes
on the borders between different blends, multiple DotProduct2 shaders could now be seamlessly
linked together.
The Alpha Fade brush system can work with any texture with an alpha channel and the relevant
shader setup can also be blended with the same precision as terrains.
|
|
|
|
|
|
|
|
|
|