Page curl effect using graphics 2.0 and shaders

Ah the magic of trig. :slight_smile:

btw - how would you keep the front as the image but have the back of the page be a flat color - white probably to simulate a paper look… What do you add or change in your latest to get this effect?

The first CoronaColorScale(texture2D(…)) (the earlier return) is the back pixel. Basically, just replace the texture2D () call with vec4(1.)Ā or vec4(1., 1., 1., 1.). White is all ones, just as in Corona itself.

If you don’t want the black border you can just strip the stuff inĀ  UPPER_SHADOWS or whatever I called it. (I’m actually thinking I can hoist that out into two or three manually oriented auxiliary rects–one per edge–with their own shader, then just layer the shadow on top of the front page. This would cut out those per-pixel tests for shadows in the effect proper and the shapes could be made a much better fit anyhow.)

By the way, since I’m seeing ā€œreal world useā€ in action, I’m considering all these things you’re trying for my stable of options.Ā  :slight_smile:

Actually, since you’ve already been running with it (do you have a video or sample, by the way?), maybe I’d be wasting time trying to add my own scene transition support into an eventual plugin. I’m thinking in the end of just exposing some functions like SetNormal (), SetPoint (), and SetRadius () and abstracting away the underlying bits.

Have you considered putting together a suite of scene transitions? It sounds like you must already be playing around with them. I’d like to see how well ā€œrelatedā€ plugins end up working.

Your post was synchronistic timing as I’d just finished a version of a page curl which is just an animating image across the screen. So I have time to help test and work through a composer ready page curl.

You’re right, it’s been easy to create a transition module. So far, I’ve only required a proper fade to black, a 2.5d card cover book open effect and the page curl. With use of custom effects in the composer transition effectsList, any kind of transition is possible.

Anyway, I’ll PM you some video grabs and a break down of the Composer related code thus far…

@StarCrunch - just to let you know in case you don’t have auto alert, PM sent.

I’ve added some provisional touch controls.

It’s more straightforward than what I thought would need doing, but seems decent enough. What I’m going for is that the part you grabbed on the side will track the touch (though allowing for a little ā€œwindupā€ near the right-hand side), but the ā€œhow much to rollā€ scale factor is a bit off, and currently defeating my attempts to puzzle it out. Also, it can kind of freak out near the corners.Ā  :smiley: (I’m probably doing a math.atan2(0, 0) there.)

Anyhow, I’ll continue trying to nail this down.

UPDATE : The touch controls are nearly there, I think. The early part of the roll is a little off (this is more obvious with some orientations than others), mostly owing to trying to combine a couple kludges. :unsure: A bit too tired to do it the right way, at the moment, but I’ll need to figure it out eventually if I want to be maintain shadow proxies outside the shader, or anything along the same lines.

I still don’t have any great ideas about fixing touch along the right-hand side. Try dragging up and down there to see what I mean.

Any styling recommendations from anybody who’s used one of these before? It seems to make most sense to me to have just a vertical strip at the edge as done here for the touchable region, but obviously one wouldn’t want a translucent rounded rect indicating that part… Or can I safely assume ā€œthey’ll know what to doā€?

Anyhow, I’ll probably give it a couple days’ rest and then begin trying to package it up.

EDIT : Well, I couldn’t get this out of my head, so I figured out the early parts of the roll. Man, so many sheets full of slightly wrong formulae…

Hi!

I slogged away and now have what I consider a feature-complete version 1.0. In any event, the API is basically in place. A few use cases can be found in main.lua ; theseĀ can be enabled by changing the appropriate

--[[ 

lines to

---[[ 

(I’m still uncertain whether the somewhat odd capture results are par for the course with groups or an error on my part.)

As a reminder, the current WIP is here. I think I’ll freeze that once I finally submit this as a plugin, in the not-too-distant future.

Also, while probably not the most exciting reading material, the current documentation can be foundĀ here. This is very much a first draft, which aims above all for accuracy, but could probably stand a few revisions for clarity. Any constructive criticism would be most appreciated!

Bug testing ought to follow fairly soon, though I think I’ll give it a few days, especially since I need to give some other things a little love. The sample I have in mind for the plugin should be equally well-suited for stress-testing the various features.

Known issue : Switching ā€œmodesā€ while the page is unrolling (after releasing a touch) freezes the page in place. (I have a pretty good idea of the cause.) EDIT: Seems to be fixed.

That is just amazing! I have tested your code and the effect looks awesome. I will dig into the code later but I bet I won“t understand half of it  :unsure:

I“m just thinking about how will the effect look when the page is turned back?!?

Seems like this video might have a good sollution:Ā https://www.youtube.com/watch?v=IShu45tqtuk

It would also be possible and maybe easier to ā€œanimateā€ the whole ā€œturn backā€ effect like in this video:Ā https://www.youtube.com/watch?v=EVHksX0GdIQ

Thank you so much for doing this SteveĀ  :slight_smile:

You are my heroĀ  :rolleyes:

Good to hear, Tom.

I’ve just uploaded an update of the project and the docs, together with quite a few samples.Ā There were some last-minute interface changes, but now I’m finally pleased with them. I felt it was quite well along, so I filed a plugin submission, too.