Worklog for Pete Rigz

Worklog 1

Return to Worklogs

PVS Update(Posted 2004-08-12)
Quick update. The PVS system I had was a little out dated since I made some changes to the way meshes are organised and triangulated, so I got it up to speed again.

I also fixed some niggly little bugs with it and added a decent new feature. Before, it would work so that each time you stepped onto a new terrain mesh, it would hide and show whatever tiles could or could not be seen from anywhere inside that mesh tile. Now though, you can increase the resolution of the PVS data, so that a 'PVS tile' is actually a 1/4 or 1/8 the size of a mesh therefore increasing the efficiency of the visibilty system.

For example, say that in one half of a mesh a hill in the distance was being excluded by a load of terrain, but in the other half it wasn't. The old way I did it would have had to render that hill in the half where it was occluded, but now with a smaller resolution it can be hidden. At the end of the day polys rendered can be saved at the cost of a little more memory.

Heres some screen shots of the pvs working:

in wireframe without PVS switched on you can see lots of terrain behind the rocky hill

and with it on most of this terrain behind is hidden. In this particular scene about 30k polys are saved.


Next thing I want to try is re-implement real time LOD that I had right at the start of the project. It will be tricky given that there are multiple surfaces for each tile depending on the textures, but I have some ideas :)


--------------------------------------
TimelineFX - Particle Effects for Blitzmax

What there is so far(Posted 2004-08-05)
I've been working on this terrain engine since the start of the year with a few breaks here and there because of other work.

Basically it's a tile based terrain engine with a number of different features. This is what's implemented so far:

- Mesh auto generated from heightmap

- LOD algorithm to apply more detail to areas that need it and less where it doesn't saving on tris rendered. Cracks are also fixed between tiles.

- Possible Visible Sets so areas of terrain hidden from view are not rendered.

- Advanced colour map generation with a number of steps -
>Lightmap (Thanks to Flynns Lightmapper)
>Colour map based on terrain slope (using textures or just a colour) - Again uses the normal map created from Flynns Lightmapper, -thanks!
>Separate Colour map based on terrain height
>Flooding to give the effect for submerged under water
These steps have an alpha value to dictate how much they effect the final colour map.

-Terrain textured using vertex alpha to blend textures together. For the immediate area of the terrain under the camera another mesh is overlayed showing an even higher detailed texture.

-Colour map control, meaning you can generate a 2048x2048 colour map for a 512x512 map. This colour map is also automatically sliced into your size of choice segments, eg 512x512. For vertex alpha texturing, this is unecessary, however if you need it to run on lower end PCs you can generate the map without vertex alhpa texturing and just rely on the colour map and the close-up detail for texturing.

-Uses linear interpolation to get the terrain height at any point fast.

-Lots of control over how many surfaces the map will use. The terrain is organised so you have terrain tiles with differing levels of LOD and then you have an area size which says how many of these tiles apply to one mesh. So you could have a patch size of 17*17 (vertices) and an area size of 4 (4x4 tiles per mesh) which will give greater control over the lod of the map. However the larger the area size the less effect PSV has as there would be less terrain mesh tiles to hide. But these options atleast give you a decent degree of control to get teh best speed out of a map.

-Plenty of optimisations. Theres allsorts, mainly for the triangulation of the map, vertices won't be created if they're not needed, same goes for the triangles.

-Efficient data storage. Most of the map data is stored in banks to save memory as much as possible. a 512x512 map with very high detail uses about 58mb, with lower detail just 35mb. The PVS data for example, needing only to store either true or false, uses every bit of the bytes to store the data.

They're the main features. At moment it simply creates terrains from heightmaps, but really it's crying out for an editor. I'll be releasing it as open source so maybe someone can make one. I might do one myself, not sure yet.

At the moment I am optimising more and ironing out any bugs. I also want to document it a bit better aswell.

Heres a few screenshots:

Heres a shot of how the map can look up close with the overlayed detail mesh.

A colour map:

A segmant of a 2048x2048 colour map. You'd use this kind of colour map if you weren't using vertex alpha texturing and just relying on a detail map, and the up-close texturing.



--------------------------------------
TimelineFX - Particle Effects for Blitzmax