PDA

View Full Version : Page Curl



stephenRuan
09-03-2003, 07:55 PM
Hello, Where can i find some code or algorithm introduction about page curl?
I want to use OPENGL make a software FX.

dorbie
09-04-2003, 01:41 AM
This should really be in the beginners section.

Effects like this tend to load two images as two textures. The new image is drawn to the screen on a simple quad then the old image is drawn on a geometry mesh on top.

The mesh is then animated to look like a turning page and it looks like the perfect image warp operation for the page curl.

To get the basics working you need to understand OpenGL animation with the doublebuffer, OpenGL texturing, and the generic graphics concept of the "painters algorithm".

Bonus points for:

Z buffering to avoid self occlusion of the old page.

Lighting on the curl mesh with surface normals.

Shadows cast from the old page onto the new.

Any other fancy effect you can come up with, like bump mapping, transparency etc.

john
09-04-2003, 05:25 AM
ah, but the REAL trick (to add to the "bons points section") is how to animate the page so it isn't just a "simple quad" undergoing a rigid rotatation.... and solving that is solving something akin to cloth animation insofar as you pick up a corner and it pulls adjacent verticies as a function of the page-space distance, etc.

jwatte
09-04-2003, 07:44 AM
That's an artist problem. Poor programmer just plays the animation he's handed :-)

dorbie
09-04-2003, 10:40 AM
You don't get bonus points for that, it should be in version 1.0 or you get an fail, the thread is page *curl*, that's why I put the background on a simple quad and the foreground on a mesh.

Evaluators could make this easier for you or you could code it but it shouldn't take an artist for a simple curl deformation on a mesh.

jwatte
09-04-2003, 03:17 PM
> it shouldn't take an artist for a simple > curl deformation on a mesh

If the only effect you're interested in is
a single page curl, then that's true.

I'm drawing the conclusion that if you want
a curl, you probably are going to end up
wanting 102 other effects as well. At that
point, using a data driven approach with
artists generating the data is what you want
to be doing.

Personally, I think that the phletora of
tutorials on the web (and in books) that show
people how to draw using hard-coded data are
doing a dis-service. While you have to start
somewhere, I think that starting at vertex
arrays is the right thing, and then mention
that vertex arrays are typically loaded from
data files.

Anyway.

john
09-04-2003, 04:02 PM
well, a simple quad isn't a quad mesh, is it? you can't animate a page wrinkling and curling with *A* *SIMPLE* quad. You need lots of them; probably in a strip, too.

also, since when has all animation been replay back what an artist gives you? that's like... well, there's no fun in that, is there?

I realise that making a page curl isn't hard, but the description of a "simple quad" turning makes it sound as though you're advocating something extremely trivial. Meh.

stephenRuan
09-04-2003, 06:02 PM
Originally posted by dorbie:
[B]The mesh is then animated to look like a turning page and it looks like the perfect image warp operation for the page curl.
B]
thanks, my question is how to create the mesh just like the right image warp operation.I used some hardware FX system,they
control page curl through some parameters like radius, angle, offst,etc. I need a algorithm use this parameters to create a correct mesh.the page curl must under my control.

cyclone
09-04-2003, 06:04 PM
A single patch where vertices near the bottom-right corner can have their positions tranformed by a a simple formula can perhaps to be a good start ?

[This message has been edited by cyclone (edited 09-05-2003).]

SirKnight
09-05-2003, 05:49 AM
well, a simple quad isn't a quad mesh, is it? you can't animate a page wrinkling and curling with *A* *SIMPLE* quad. You need lots of them; probably in a strip, too.


He didn't say you would curl the simple quad, but the mesh on top of the quad. Actually, why would you need the quad in the first place? Why not just have a mesh with the texture on it and bend that up? Well...I guess you can use the background quad for a background image or something. Like in PSP for example, when you do a page curl, the part behind the curl is like a grey, or whatever you choose (if I remember correctly). Maybe that's where the quad comes in, is to draw that part.


-SirKnight

jwatte
09-05-2003, 09:56 AM
Assuming this is video, doing an A->B roll, the background quad is the B footage (destination image).

Doing a really realistic page curl without stretching is somewhat hard. You might need to look into cloth simulation systems for that.

Doing cheesy page curl; either roll-up or peel-off; is a matter of sweeping an imaginary rolling pin across the mesh, and rolling/peeling up the vertices that are on the "back" end of that pin, by rotating them around the pin's center axis. This will stretch a bit, but you often don't notice.

dorbie
09-06-2003, 01:02 AM
Poster "john", my simple quad was the background and it doesn't curl, my *MESH* was the foreground, picture mesh = *subdivided* surface under arbitrary warp. This is simple stuff and doesn't need debate. Sorry, no offence but we both know this is obvious and I explained it clearly.

Poster stephenRuan; .... yea..... what jwatte said, except that the rolling pin won't stretch the sheet, sorry jwatte, rolling pin for page curl = unstretchy goodness. It's probably the simplest solution.

Addendum; rolling pins stretch dough etc. not infinitely thin surfaces.


[This message has been edited by dorbie (edited 09-06-2003).]

jwatte
09-06-2003, 09:10 AM
> rolling pin for page curl = unstretchy goodness

Except for those triangle edges that cut into the imaginary rolling pin's surface because they're straight, and the pin is round, of course :-)

I hope we could agree that if you tesselate really highly ("limit infinity") then stretchiness goes to 0, and you probably hit "good enough" WAY before you get to infinity.

dorbie
09-06-2003, 10:03 AM
Well now you're talking about the approximation of tesselation, the theoretical surface won't stretch but the surface tesselation edges will actually shrink slightly due to piecewise surface approximation, however this will only happen at the interface between the flat and curved surface, as it rolls over it's on a rolling pin of constant radius and won't stretch or shrink unless you reorient the cylinder. You can't claim some simulation would do better, you can't get path length and absolute location correct simultaneously in any scheme without infinite subdivision, and it's debatable which is more correct.

Ultimately this is a real nit. W.r.t. the difference you're talking about the length of a chord vs the arc path length. I'd be much more concerned about the piecewise linear image interpolation on texture and the effect on any edges in the image, and tesselation on all silhouettes. This is the more compelling reason for highly tesselating the curl.

You could subdivide the cyliner through the surface rather than at the verts on the surface, i.e. fake the radius slightly higher based on the subdivision chord vs arc error but it probably ain't worth the trouble, it won't help with the piecewise linear visual problems that are the real challenge.

[This message has been edited by dorbie (edited 09-06-2003).]

john
09-07-2003, 05:25 PM
"He didn't say you would curl the simple quad, but the mesh on top of the quad"

.. except a mesh IS also a quad of one mesh. My point is that there is a differnce between a mesh which is one quad, and a mesh which is a series of quadstrips where #vertices >> 4.

quad == polygon(n=4) == mesh of one primitive

which was my point.

dorbie
09-09-2003, 12:14 AM
Unbelievable, no "john" you're wrong. The meaning especially in context with one entity called a "mesh" another entity called a "simple quad" should have been clear. Your second post made your error absolutely clear, your followup is just pedantic and flagrantly dishonest.

john
09-09-2003, 03:06 AM
Well, each to his own. But clarity IS important and it is IMHO that your message was not as clear as it could have been. It isn't a small thing; technical writing MUST be precise.

The key problem is the meaning you attribute to a mesh. A mesh does NOT imply a set of triangle quad strips. A mesh is simply a group of connected vertices: hence, a quad is a mesh, a quad strip is also a mesh, and a set of quad strips is also a mesh. that might not be true where you come from, but I'd argue that is most certainly the case in most rigiourous discussions of what a mesh is defined to be. This is the same as the argument that a triangle is a polygon, a quadrilateral is a polygon, and an n-sided shade is a polygon, but a polygon is NOT NECESSARILY a triangle.

You wrote:


The new image is drawn to the screen on a simple quad then the old image is drawn on a geometry mesh on top.

all of which says "we have two sets of geometry. one is a simple quad, and the other is [some geometry]". you MIGHT have meant that a mesh is a grid, but that isn't what you said and it is NOT a known and standard term to describe a quadrilateral strip as a mesh. call it pedantic if you will, but that is NOT what you wrote and it IS important to be clear especially when describing something to someone who asked the question in the first place.

writing technical papers/discussion MUST be clear.


[This message has been edited by john (edited 09-09-2003).]

stephenRuan
09-09-2003, 04:09 AM
Doing cheesy page curl; either roll-up or peel-off; is a matter of sweeping an imaginary rolling pin across the mesh, and rolling/peeling up the vertices that are on the "back" end of that pin, by rotating them around the pin's center axis. This will stretch a bit, but you often don't notice.
How can I define each vertex's rotating angle,is there a mathmatical model to describe simple page curl?

dorbie
09-09-2003, 10:01 AM
John, my post was absolutely clear.


Originally posted by john:
well, a simple quad isn't a quad mesh, is it?

That was your position, but now you are saying:


Originally posted by john:
.. except a mesh IS also a quad of one mesh.

It's clear that that wasn't your point in the earlier post, but I don't really care. It has to be the most pedantic observation I've seen, and is wrong anyway. A mesh clearly describes subdivision of some sort.

It's important to be clear, yes, but you observing it's important doesn't mean I wasn't. Clearly I was.

[This message has been edited by dorbie (edited 09-09-2003).]

dorbie
09-09-2003, 10:15 AM
Stephen,

One way is to start with a page of some width, to roll this around a moving cylinder or rolling pin, you want to start a cylinder resting at the end of the page and over time decrease it's horizontal location. You then subtract each vertex location from the cylinder location and use the remainder if it is less than 0.0 as the distance around the radius of a circle in x and z to move the point. It would be the rolling pin effect described above and you can play with the radius etc for best effect. Pre and post rotate in x and y while starting at a corner for diagonal curl effects.

stephenRuan
09-09-2003, 06:54 PM
To dorbie:
That's what I want.Thanks very much! you make it clear to me .

dorbie
11-17-2012, 03:49 PM
This is an interesting thread given Apple's bullshit Page Turn patent. 2003 and the 3D page turn was described here in technical detail required for anyone knowledgeable in the art to implement, but it was obvious even back then.