Jump to content
  • Advertisement
Sign in to follow this  
51mon

Wave that approaches triangle from sine?

This topic is 3789 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 want to make a curve that approaches a triangle wave from a sinus wave. Does anybody know some fast / convenient way to calculate this? The curve should look like a sine wave raised to a number greater than 1 but with more “linear” transition from lowest to highest value. Like the sketch below but symmetric :) Thanks

Share this post


Link to post
Share on other sites
Advertisement
You can get something like that if you take an ordinary triangle wave and smooth it out using quadratic/cubic/quintic/whatever interpolation.

If you happen to own a copy of GPU Gems 3, there's ready made shader code with cubic interpolation in chapter 16. It uses x*x*(3.0 - 2.0*x) for that matter.

Share this post


Link to post
Share on other sites
You could take a weighted average of a sine wave and a similar triangle wave. Something like t*sine + (1-t)*triangle for 0<t<1 .

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!