Skip to content
Craig-Macomber edited this page Sep 14, 2010 · 3 revisions

I’m developing a terrain system that should allow easy mixing of procedural content with specified content from the editor )

It may end up getting its own, or using some other editor.

Web Build:
Infinite Ralph

The design has 3 parts:
1) Editor
See editor thread. Allows user to place, rotate and scale maps in the form of alpha masked textures
2) Bakery
Generates maps for tiles. Tiles can have an arbitrary offset and size. Optimized for baking large quantities of tiles through the use of shaders.
The bakery will also handle the procedural placement of meshes such as trees, rocks etc.
3) Renderer
Works in to modes, prebaked, where is uses baked tiles, or realtime baking where tiles are baked as needed. The renderer will be included in the actual game (and the bakery as well if in realtime baking mode), and will handle all the LOD, shading, height map meshing, and such. It will basically manage tiles, and feed all the output render maps to the terrain shader (if a terrain shader is used). It will also handle displaying and clipping of all the meshes placed by the baker.

Status:
( 2010:02:25)
Panda3D 1.7+ now required.

Renderer Plans:
I’m planning to implement a geo clip mapping based renderer for high performance seamless LOD. This is planned to be done by pulling tiles from the file source and rendering to texture with them as the camera moves to generate the textures needed to do the geoclipmapping. This means that none of the height data (or any of the procedurally generated textures) would have to be brought over to the CPU side for any of the rendering process. Yes, you may sometimes want to sample height values on the CPU, but not needing the height maps on the CPU for basic rendering means you will only probably need to copy maybe one of the LODs to ram, and only some of the nearby tiles.

Bakery basics works. Can bake tiles from map shader files. Can bake efficiently during runtime using render to texture queueing system without disrupting frame rate significantly. Supports generating maps of any size (in world) and resolution supported by GPU.

Still missing are features related to offset sampling of other maps and multiple passes of one shader for things like erosion passes. This will be needed, along with several other things, to allow (the most common approach to) good normal map generation. Seams have been resolved.

With the editor missing, the bakery only generates stuff procedurally, though it is currently possible to make textures and use them in the map shaders to design terrain, this is not the intended workflow, and thus has not been used.

Renderer displays GeoMipTerrain tiled together. Currently is it set to use brute force. It also uses an experimental approach to LOD that avoids massive tile/block counts and see-through seams. Large Background tiles are render first, then over drawn with the detailed ones.

The renderer now supports texture modes such as glow and gloss, and uses the auto shader generator. The tools to make good normal maps easily are not done, so none are displayed yet, though they technically should work just like glow and gloss. Support for masked detail textures is now functional.

An auto tiling system has been implemented that displays tiles as needed. It works well in conjunction with the new LiveBakery class which is intended for rendering tiles in realtime. It now generates tiles smoothly without major effects on frame rate.

main.py is now infinateRalph.

Images:
Here is a height map generated with the bakery procedurally.

Here is the current renderer. It has some seams, and the performance is not fantastic, but it does work. Note the glow map for the cities. This is from the included infinite ralph sample.

All the maps are 4 8 bit color channels which causes precision issues in the height map. Support for other options will be added. Current workaround is packing/unpacking into vec3. This in understood by geoMipTerrain loader, so the precision makes it all the way along, but it is kinda messy.

Map note: Care must be taken to make the edges of adjacent height maps the same (must have the same pos values, not 1 pixel apart) while the textures should not be the same (should be 1 pixel apart) though may need an extra 1 px margin for filtering of the edges to prevent seams. Possibly everything could be setup like the height maps, and the UV could be adjusted to compensate. This has been implemented, and should not need to need considered by users of the terrain system.

License:
This project is intended to be developed as a panda feature and thus is under the same license as panda. If anyone wants to get involved and help the project along, it would be appreciated, though at the moment the scope of it is within my grasp, and I currently don’t have any issues that I don’t know how to handle. Discussion of the design would be good though.

Example Map Generation Shaders
Look at the map shaders in the repository

Clone this wiki locally