Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

openGL - creating a bending surface

I've been studying openGL for a while, I'd like to create a book with the page turning effect, but the pages should "bend" themselves. So now I'm wondering how one could bend a surface and animate it in openGL. Sounds like a multiple-per-vertex-shaders depending on the position of the vertex, isn't it?

Or perhaps a single shader with multiple branches

like image 345
Johnny Pauling Avatar asked Feb 19 '23 22:02

Johnny Pauling


2 Answers

Page turning is implemented as a cone that varies its radius and apex angle at various stages of the "curl". Here is a tutorial for iOS that walks through the math. The original paper by Xerox PARC is here.

Hope this helps!

like image 186
Ani Avatar answered Feb 26 '23 21:02

Ani


Implement the bending as a curve equation, and apply that curve to the vertex position depending on the distance from the binding (you may use an additional vertex attibute for this).


Update as per suggestion (formerly comment):

If look at a cone you can see, that it consists of a circular curve (around its axis) which is tapered to its tip. This is the curve you'd create for a cone method page curl effect. The surface of a cone with its tip at the origin and its axis being Z is described by the analytic surface

S(u,v) = (x*cos(u*2*pi) + y*sin(u*2*pi))*v + z*v*a

where x,y,z are the cartesian unit vectors and a = 2*tan(opening angle)

like image 25
datenwolf Avatar answered Feb 26 '23 21:02

datenwolf