I am currently working on an OpenGL procedural planet generator. I hope to use it for a space RPG, that will not allow players to go down to the surface of a planet so I have ignored anything ROAM related. At the moment I am drawing a cube with VBOs and mapping onto a sphere.
I am familiar with most fractal heightmap generating techniques and have already implemented my own version of midpoint displacement (not that useful in this case I know).
My question is, what is the best way to procedurally generate the heightmap. I have looked at libnoise which allows me to make tilable heightmaps/textures, but as far as I can see I would need to generate a net like this.
Leaving the tiling obvious.
Could anyone advise me on the best route to take?
Any input would be much appreciated.
Answer
First of all, I'm not sure why you want to implement a height map (i.e. geometry displacement) if people won't be able to land, it just seems more efficient to normal map it or something.
With that said, what you want is to convert from an arbitrary (x, y, z)
to a (u, v)
coordinate, which is trivial. No cubemap needed.
- Every
(u, v)
texel has a height (heightmapRGB = height
) and a position(x, y, z) = pos
. - Find and normalize the position,
NORMAL(x, y, z) = N
. - New vertex =
pos+N*height
.
This will work better with a higher tessellation. Also use the proper libnoise
spherical mapping for your heightmap, which will look something like this (but black and white):
No comments:
Post a Comment