View Full Version : Heightmap vertex shader?
09-29-2005, 12:56 AM
I'm trying to find out if it is at all possible to have the GPU deal with the height map texture via a vertex program instead of having to create all the vertices using the height map in the program then pass them to the driver.
And if so, can someone please point me to a tutorial or sample code.
All the examples I can find that deal with height maps convert the height map to vertices on the CPU. I instead want to pass the height map to the driver for it to create the vertices.
09-29-2005, 01:59 AM
Call me an OpenGL oldie, but I've never used shader extensions, and I can't remember if you could do a texture lookup in a vertex program... But either way, if you can do a texture lookup in a vertex shader, it seems to me you could use a spare matrix to map world coordinates (incoming vertices) to texture coordinates--this part you should definitely be able to do it's just an extra transformation-- the "ground" plane (I'd call it XZ, I think everyone else would say XY) and then use the color/intensity whatever you use to determine the height of a cell as the final component, scaled by some bias depending on how large you want the range of your hills/valleys to be.
Plus thanks to texture filtering you get cheesy LOD for free by determining how fine your grid is.
09-29-2005, 02:12 PM
ok, maybe I should ask, with current GL hardware, what would be the best way to handle a heightmap (for terrain). There seems to be way too many options.
And please DO NOT keep older cards in mind. I'm not asking for the most backward compatable way, which appears to be create the mesh within the software that uses the heightmap.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.