How can i replace a texture to change geometry of sphere.

Ok i know the title was kinda confusing . But I have a preety high poly sphere in blender and i have made a texture that is an image of the earth’s heightmap. So i use the heightmap to displace the earth and make it looks like the earth. But … then i would have to do the same thing for all my other planets. So is there a way of replacing my “height” texture with another one instead of having hundreds of meshes?

There are three approaches (I have done both for deforming a sphere with textures)

  1. loading the sphere then moving the vertexes, then rendering it. (Use the GeomVertexRewriter to do this)
  2. displace the vertexes in a vertex shader. To do this you will need to write a custom shader, and pass in the texture.
  3. Perform the operation in some other application and save the deformed mesh.

Ether way the math comes down to (for a sphere centered around the origin) basically multiplying the vertex location by 1+height

Thank you craig. Ill check out the vertex shader then… or the geomvertexrewriter. He he i know it wont be the easiest thing in the world but i would like to give it a try. thanks for the suggestions :slight_smile:

i’m pretty sure that you’d need texture-prefetch for the vertex-shader. dunno if and how easy those are available so far.

That’s not hard, I’ve been doing that for my water shaders as well. All GeForce 6 series and higher cards have support for vertex textures.

It’s just a matter of declaring a sampler in your vertex shader instead of your fragment shader.