Question

I'm currently trying to create a procedural planet generating tool. I have started off by mapping a cube to a sphere like so:

alt text

Next I'm using Libnoise to a heightmap cube using 3D Perlian noise. I am able to generate a seamless cubmap. I have checked this in photoshop and though I had to rotate the heightmap images to get them to fit in the net I think they are the correct orientation.

I have tried getting the perlin value for the co ordinates before they are mapped to a sphere and after, but I am unable to make the edges match up:

alt text

At the moment I am creating geometry between -0.8 and +0.8 and then adding 0.2 * heightmap percentage.

Either I am making use of the heightmap data wrongly or the heightmaps are not orientated correctly (I suspect it is a little of both).

Was it helpful?

Solution

I found the problem. Draw a cube from -1 to 1, map it to a sphere and then once it is a sphere, multiply each co ordinate by 1 + ( percentage * heightmap value) so for example if you wanted the heightmap to add or take away up to 20% of the sphere:

x *= 1 + ( 0.2 * heightmapValue);
y *= 1 + ( 0.2 * heightmapValue);
z *= 1 + ( 0.2 * heightmapValue);

looking somethign like this:

cube

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top