Sign in to follow this  
51mon

Wave that approaches triangle from sine?

Recommended Posts

51mon    342
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
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
Alrecenk    400
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

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