Searc

Tuesday 31 August 2010

A small update

I have now added height mapping to the sphere using the simple technique of just adding the height to the radius of the sphere while calculating the unit cube to sphere transaction.


And now close up
This far from perfect but i now need to think about adding an atmosphere effect and some GPU generated texture splatting to make it look a little more realistic.

Monday 30 August 2010

My first ever post

Ohh well i finally decided to create a blog. This is mainly because i keep pissing people off on the forums by showing off almost every aspect of my games programming. I am starting with my current project which is a spherical terrain, using 6 height maps of a cube, which are quite cleverly warped on to a sphere. Here is a few screenshots from the early development stages; i will explain a bit better later on.
The cube version before it has been warped




Here it is after the clever warping using a simple function which was so gregariously given to me by the lovely Jasmine over at GPwiki forums.

1:    Public Function CubeToSphereMapping(ByVal inputvector As Vector3) As Vector3
2:      Dim L As Single
3:      Dim x, y, z As Single
4:      With inputvector
5:        x = .X - 0.5
6:        y = .Y - 0.5
7:        z = .Z - 0.5
8:      End With
9:      Dim res As Vector3
10:      L = Radius / (x * x + y * y + z * z) ^ 0.5
11:      res.X = x * L
12:      res.Y = y * L
13:      res.Z = z * L
14:      Return res
15:    End Function  

Then we get





Early screenshot with some texturing and all 6 sides mapped to the cube.



Here is a wireframe version of the same