Fix Firefox z-sorting issues. #1
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR addresses the Firefox glitching issues in demo 5.
Firefox's sorting of z-transformed elements is pretty awful. Creating a scene that renders correctly often relies on balancing transforms along the z axis with
z-indexand (in this case) DOM order. This "fix" moves the track into it's own element and places it after the other elements in the scene — in Firefox this will cause the track element to render underneath the other objects, preventing the glitching. If you move the element to the top of the scene you'll see the glitching again.I've made the track an
<img>element but there's no reason not to use a CSS background instead.Something else you should be aware of; Firefox won't try to depth sort anything if there are more than 100 descendant elements in your 3D scene. Once you hit that magic number you'll have to sort the elements yourself by shifting them around in the DOM, which will kill performance. You can see this issue in my old CSS lighting demo. Try using the DOM inspector to remove elements until the x-wing renders correctly.