Generating Terrain on the GPU vs on the CPU

Started by
11 comments, last by multifractal 10 years, 8 months ago


That is really interesting. Is it more efficient to generate height maps in a pixel shader than to do the calculations on a vertex shader and just modify the position?

The heightmap and normal map are roughly 16x the resolution of the mesh tiles. At one point I had a separate CPU-side noise generator to produce the meshes, but vertex-texture-fetch seems to work just fine.

Also are each of your quads/tiles individual meshes?

There are all the exact same mesh, instanced once per tile.

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

Advertisement

Most modern GPUs have unified shader models, so there are no dedicated vertex or fragment units. They are shared.


So doing these calculations on the vertex shader are no different (performance wise) than doing them on a pixel shader?


Yes and no.
Per-vertex/per-pixel the amount of time taken will be the same but the pixel shader is going to be (more than likely) executed many more times than if you did the same work per-vertex.

Sorry to mess with this old thread but after a lot of tweaking I got my openCL program to generate a 128x128 heightmap in ~1ms. I was doing a lot of non-GPU friendly things in my previous implementation...

This topic is closed to new replies.

Advertisement