🎥 Make videos programmatically with React
Clarify page turn face compositing order
Jonny Burger7035ef40a5fd
diff --git a/packages/docs/docs/effects/page-turn.mdx b/packages/docs/docs/effects/page-turn.mdxindex 87d018fd58..7ab3a0fdb8 100644--- a/packages/docs/docs/effects/page-turn.mdx+++ b/packages/docs/docs/effects/page-turn.mdx@@ -70,7 +70,7 @@ Direction of the light in degrees, controlling shading on the front of the fold.### `render?`-Which faces to show: `'both'`, `'front'`, or `'back'`. Defaults to `'both'`. The back is composited over the front where they overlap.+Which faces to show: `'both'`, `'front'`, or `'back'`. Defaults to `'both'`. When both faces are enabled, the curled back of the page is drawn over the front. Transparent areas of the back reveal the front underneath.### `backPageOpacity?`diff --git a/packages/effects/src/page-turn/shader.ts b/packages/effects/src/page-turn/shader.tsindex 4872076259..c432080c0f 100644--- a/packages/effects/src/page-turn/shader.ts+++ b/packages/effects/src/page-turn/shader.ts@@ -54,6 +54,7 @@ fn samplePage(pixel: vec2f) -> vec4f {back = vec4f(mix(color.rgb, params.paperColor.rgb * color.a, tint) * backShade, color.a);if (params.geometry.w == 1.0) { return front * coverage; }if (params.geometry.w == 2.0) { return back * coverage; }+ // Premultiplied source-over: the curled back covers the front, which shows through its alpha.return (back + front * (1.0 - back.a)) * coverage;}`;