PDA

View Full Version : Color scales



mithun_daa
11-14-2003, 07:24 AM
any suggestions for making a color scale. i wanna assign different colors for different elvations in the terrain. any links to related sites would also help.
thank u

Tom Nuydens
11-14-2003, 07:52 AM
Put your colors in a 1D texture, and put the elevation of each vertex into a texture coordinate. You can do this offline, or dynamically using a vertex program.

-- Tom

mithun_daa
11-14-2003, 08:24 AM
Originally posted by Tom Nuydens:
Put your colors in a 1D texture, and put the elevation of each vertex into a texture coordinate. You can do this offline, or dynamically using a vertex program.

-- Tom

im sorry. i guess the question was too vague. what im trying to do is assign different colors for different elevations. for this i want to create a color scale. say for elvation zero u assign blue (water) and for the heighest elevation assigne white(snow) and there are a whole bunch of other colors that are blended in between. the mid point could be a mountain and i want it say brown in color.
how do i go about creating this scale. i also wanna provide a feature in which the color scale can be changed by the user, maybe he/she wants red to be zero elevation and blue as the heighest elevation. does opengl have any such feature.
thank u

Relic
11-14-2003, 08:43 AM
Easy, as Tom said.
But YOU have to setup the 1D texture with the colors the user chooses.
To do that you can start with a default black to white ramp and let the user drop colors into, one of lets say 256 slots.
For each slot the user defined, linearly interpolate intermediate colors between the defined colors and fill the whole ramp this way.
The rest is done with 1D texturing the terrain elevation with 0.0 to 1.0.