look up table
Hello,
I am simulating corrosion with particles. I adjust the color of a particle according to his life time. If a particle is dead, it get black and i use alpha channel to simulate holes in the surface.
But how can i use a lookup table, to find colors according to the life time of a particle?
I got the colors from real life images of corrosion. According to his lifetime i have to choose one of them. How longer a particle lives, how darker brown it get.
The easiest way to do it is to use a 1D texture. You create your lookup table as a texture 1 pixel high by N pixels across, going from initial time at the left to 'maximum' time at the right (the end of your table). When rendering, divide the life of your particle by the maximum time represented by your texture, and use the resulting 0..1 value as a texture coordinate. You get interpolation between neighbouring entries for free which can be quite nice.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement