Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement preserve-3d #739

Closed
jrmuizel opened this issue Jan 18, 2017 · 5 comments
Closed

Implement preserve-3d #739

jrmuizel opened this issue Jan 18, 2017 · 5 comments
Assignees

Comments

@jrmuizel
Copy link
Contributor

@jrmuizel jrmuizel commented Jan 18, 2017

The basic plan is to use a bsp tree to do plane-splitting like Gecko does.

It probably makes the most sense for this work to wait for the work in #742

@jrmuizel jrmuizel mentioned this issue Jan 18, 2017
20 of 24 tasks complete
@kvark
Copy link
Member

@kvark kvark commented Mar 24, 2017

Me and @mrobinson are interested to implement this.

@kvark
Copy link
Member

@kvark kvark commented Mar 30, 2017

Got https://github.com/kvark/plane-split, going to try hooking it up to WR next.

@jrmuizel
Copy link
Contributor Author

@jrmuizel jrmuizel commented Mar 30, 2017

The license should probably at least be dual with MPL2

@kvark
Copy link
Member

@kvark kvark commented Mar 31, 2017

Some observations from looking into this:

  1. when "preserve3d" is active for a sub-tree of the document, the elements are supposed to naturally be ordered by depth on a per-pixel level. It can have children that are "flat", not sure if we can support it from the start or implement as a follow-up.
  2. plane splitting is one of the ways to draw intersecting semi-transparent objects, it is viable on the way because most of the things are planes and thus can be trivially split
  3. we could have used the depth buffer for opaque objects, but that conflicts with the current approach. Thus, we need to split all the planes (including opaque ones) and assign the produced ordering to Z indices that are currently obtained from the original primitive order.
  4. when 2 planes intersect, we should only need to split one of them to avoid intersection (not both), and then return the draw order
  5. splitting can be done incrementally: we can have a splitter object that gets mutated each time we add a plane to it, this function returns the split plane and ordering info
bors-servo added a commit that referenced this issue May 1, 2017
Basic preserve-3d support

Goes towards #739

This is a basic implementation that features a green test case. It can be merged independently, but more work is expected to solidify it.
There is a lot of interaction of "preserve3d" stacking contexts with filters, composite ops, and such, that is not thought-through or tested at the moment. The new code should be totally safe as long as the client continues to use `TransformStyle::Flat` (as both Gecko/Servo still do).

r? @glennw

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/webrender/1169)
<!-- Reviewable:end -->
@kvark kvark self-assigned this May 5, 2017
bors-servo added a commit that referenced this issue May 8, 2017
Better Preserve3D support

Follow up to #1169
Includes #1207

r? @glennw @mrobinson

  - "preserve-3d" only affects children stacking contexts and contained items
  - generated polygon coordinates of non-zero local bounds
  - sorting order

The Servo PR is being [worked on](servo/servo@master...kvark:preserve3d), but it's not required here, since it may safely continue using `TransformStyle::Flat`.

There is at least one feature on the horizon to be implemented before  #739 can be truly closed.
The `TransformStyle` should be moved out of the stacking context and deserve it's own pushable item (similar to clip-scroll groups). This is required because an item without "preserve-3d" automatically becomes "flat" but does not establish a stacking context, which is [tested by Servo](https://raw.githubusercontent.com/servo/servo/master/tests/wpt/css-tests/css-transforms-1_dev/html/transform3d-sorting-004.htm).

Edit: apparently, Chrome disagrees here, so the current approach of WR might stay.
Create Bugstar [issue-1362543](https://bugzilla.mozilla.org/show_bug.cgi?id=1362543).

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/webrender/1208)
<!-- Reviewable:end -->
@glennw
Copy link
Member

@glennw glennw commented Jul 21, 2017

preserve-3d support has merged. Let's close this and open new issues for any specific bugs / missing features.

@glennw glennw closed this Jul 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.