Bug 56237

Summary: [chromium] backface visibility doesn't work correctly on perspective-projected layers
Product: WebKit Reporter: Vangelis Kokkevis <vangelis>
Component: Layout and RenderingAssignee: Vangelis Kokkevis <vangelis>
Status: RESOLVED FIXED    
Severity: Normal CC: jamesr, kbr
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch kbr: review+

Vangelis Kokkevis
Reported 2011-03-11 18:33:56 PST
The math used to compute the direction of the Z axis doesn't produce the right answer for complex transforms (ones with perspective projection, non-uniform scaling, etc) To see the problem go to: http://www.webkit.org/blog-files/3d-transforms/morphing-cubes.html and uncheck "backfaces visible". You'll notice faces popping in and out.
Attachments
Patch (10.75 KB, patch)
2011-03-11 18:41 PST, Vangelis Kokkevis
kbr: review+
Vangelis Kokkevis
Comment 1 2011-03-11 18:41:13 PST
Kenneth Russell
Comment 2 2011-03-14 18:26:41 PDT
Comment on attachment 85563 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=85563&action=review Looks good to me. One comment. > Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp:815 > + FloatQuad mappedLayer = combinedDrawMatrix.mapQuad(FloatQuad(layerRect)); > + FloatSize horizontalDir = mappedLayer.p2() - mappedLayer.p1(); > + FloatSize verticalDir = mappedLayer.p4() - mappedLayer.p1(); > + FloatPoint3D xAxis(horizontalDir.width(), horizontalDir.height(), 0); > + FloatPoint3D yAxis(verticalDir.width(), verticalDir.height(), 0); > + FloatPoint3D zAxis = xAxis.cross(yAxis); It seems odd to do these operations in 2D. Intuitively I would transform the four points of the quad in 3D (probably without the perspective portion of the matrix) and then do the appropriate vector differences and cross products. However I gather that TransformationMatrix doesn't provide enough control to do this. As long as you've tested this math to your satisfaction I'm sure it's OK.
Vangelis Kokkevis
Comment 3 2011-03-16 16:06:46 PDT
Note You need to log in before you can comment on or make changes to this bug.