Skip to content

Conversation

@the-owl
Copy link

@the-owl the-owl commented Aug 3, 2016

SVGRenderer has some issues with z-sorting: painter sort which is currently used sometimes gives wrong results and it can't deal with intersecting objects. As a solution, I've implemented an algorithm that builds a BSP tree and splits objects into smaller pieces. Here is an example (set useBSP = false to see the difference).
It only supports triangles and lines, but it can probably be improved in future.

@mrdoob
Copy link
Owner

mrdoob commented Aug 3, 2016

Very nice! The good thing is that this also works for CanvasRenderer! I guess it doesn't handle UVs though?

@the-owl
Copy link
Author

the-owl commented Aug 4, 2016

I didn't expect this to work with CanvasRenderer, so I didn't add UVs handling because SVGRenderer doesn't support textures. It also could be improved in future.

@mrdoob
Copy link
Owner

mrdoob commented Aug 4, 2016

I see... Do you think you could add UVs to this PR?

@the-owl
Copy link
Author

the-owl commented Aug 8, 2016

I've added UV handling and an option for CanvasRenderer

@ToJans
Copy link

ToJans commented Sep 9, 2016

This might be a long shot, but if I understood correctly transparent object rendering might also benefit from this?

@Mugen87
Copy link
Collaborator

Mugen87 commented Oct 2, 2019

Not sure this PR is still necessary. Just because SVGRenderer seems a bit deprecated (and CanvasRenderer already removed). In the meanwhile you can render SVG files with WebGL thanks to SVGLoader (see #13616).

Besides, when reading the code I've noticed a lot of objects are created when the BSP tree is computed per frame. This approach might lead to noticeable GC pressure. Without knowing the performance implications, it seems to be hard to merge such a change...

@Mugen87
Copy link
Collaborator

Mugen87 commented Oct 4, 2019

Closing for now.

@Mugen87 Mugen87 closed this Oct 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants