The initial plan was to learn to program in C++ and to write my own game engine for the VR project. While I am learning programming at RMIT University in Melbourne at the moment, I expect it will be quite a while until I reach the level required to do this. So I am taking some short cuts and have started building the VR Software using DarkBasic Professional from The Game Creators. This will give me a very good learning base to understand what is involved in writing 3D software and the principals involved.
With regards to the terrains, the plan is to build 3D Terrains with maximum realism. I want the 3D worlds that will be part of the VR project to be as realistic as possible including skies with moving clouds and the sun moving across the sky giving realistic day/night cycles. I also want water to be as realistic as possible, from both above and below as well as realistic vegetation. If someone has any suggestions or requests, please don't hesitate to contact me through the Contact page.
I quickly discovered that it is much easier to say I want realistic terrains than it is to actually build them. This will end up being quite a learning experience and I don't expect to finish in a hurry. I have also realised that I could spend years just working on the terrains if I plan on writing everything involved myself , so I will be using some tools that other DarkBasic Pro users have already written and have given the source code out for free.
I am starting with some simple terrains as I want to work on other parts of the project at the same time. This will give me some place to play with characters etc. To build a simple terrain I will need some ground and a sky. Then I can work on improving these.
A Simple Sky
The sky is usually made in one of 2 ways, by building a skybox or a skysphere. A sky box is a huge box that is textured internally with images that will make up the sky and surrounding distant terrain. There are also a few tricks that are used so that the seams of the box are not visible, one trick is to enlarge each side a fraction so they go beyond the corner. This makes the textures at the corners blend better. If you look at the image to the left you will see a screenshot showing a skybox and a simple terrain from outside the skybox. The idea is to centre the player in the middle of the skybox and move the skybox with the player. When viewed from the centre the seams are not obvious and you would not know it was made from a cube. A skysphere is made in a similar way but uses a huge sphere instead of a cube. The image required to texture a skysphere is a bit trickier than a skybox
There are a lot of different ways of making the ground in DarkBasic Pro, but the structure is much the same. The
basic structure is a large mesh of polygons as shown in the picture to the right. The mesh then needs to be
contoured and textured to resemble a landscape.
Contouring the terrain is the simple part, you just need to change the vertical, y coordinates of the corners of the polygons. There are a few different ways to store the mesh, and a nice trick involves welding the common vertices so only 1 value needs to be changed to move the corner of all the adjacent polygons up or down. The details of this is a bit beyond me at the moment but the code is freely available.
The texturing of the terrain is a lot more complicated, especially if you want a nice blend of textures over the terrain. To simplify the process of contouring and texturing the terrain, a terrain editor of some type will simplify the task immensely. One very good terrain editor that has been written in DarkBasic Pro can be seen here. The picture to the left shows a screenshot from the editor, and to the right, a really cool video shows the editor in action, contouring and texturing the landscape and then running around the landscape in first person view mode. Through the use of shaders Tersculpt allows up to 6 textures to be painted onto the terrain. The textures can also be overlapped and blended. The shader uses two colour maps that are made by the editor, from the colourmaps the shader determines where to texture the terrain. Without the use of this type of shader the terrain can only be textured in a very limited way. Rather than spend a lot of time making my own terrain editor, I plan on using Tersculpt to build my first terrains.
I have just noticed a very nice environmental plugin for DarkBasic Pro that is under development. It is being
documented here. It looks
very promising, here are some screenshots down the right hand side and here is the expected features.
Splitting (for Newton physics)
Import/Export Advanced Terrain and .DBO
Multiple shaders for different water (eg. tropical, lake, river etc.)
Birds, fish, land mammals etc.
Interactive (eg. run away from player if they stray too close)
Variable characteristics (eg. some will let player get closer than others)
Random and controlled weather
Full range of conditions such as rain, snow etc.
Full day/night cycle
Scrapped (might include later) -
This plugin looks very promising and could save me a lot of work as a lot of the features included are features I would like to include in the VR project. I think I'll move onto another stage of the project and see how this develops.