Jump to content
  • Advertisement
Sign in to follow this  
takis

look up table

This topic is 4854 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
Advertisement
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
If i understand it correctly: i just have to put my N colors in an 1xN array.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!