Sign in to follow this  
takis

look up table

Recommended Posts

takis    150
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.

Share this post


Link to post
Share on other sites
superpig    1825
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this