Jump to content
  • Advertisement
Sign in to follow this  
4fingers

Algorithm for Conical or Diamond gradients

This topic is 3787 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

I am wanting to know how you could create these gradients, so far I have only gotten a linear gradient using this:
gradient = sin(pos.x * Pi)
The gradients I am wanting to make are Conical: http://aycu38.webshots.com/image/44037/2000058759270077993_rs.jpg and Diamond: http://aycu18.webshots.com/image/43017/2000052956529979247_rs.jpg Thanks [Edited by - 4fingers on February 5, 2008 11:47:06 AM]

Share this post


Link to post
Share on other sites
Advertisement
For diamond, determine manhattan distance: (pos.x + pos.y) / size

Conical is a bit trickier... the core is to get the angle theta=atan2(pos.y, pos.x), but then you run that through a transform that turns its 0..2*pi value into a 1..0..1 interpolated value. |abs(pi-theta)|/pi is the linear version, which might look okay.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!