Comments (6)
@jsantell @mrdoob could you take a stab at describing the approaches you each mentioned to using a shared context?
from model-viewer.
There is a limit of how many WebGL contexts a single document can have. I think it's 12.
One WebGLRenderingContext can be used to render all scenes by using Canvas2DRenderingContext's drawImage
(three.js example, webxr-polyfill does the same thing to fake having two canvases). Might be a bit weird if elements are different sizes, may have to have the WebGL context at fullscreen size and change the viewport for every element. The WebGL context could be from an OffscreenCanvas on the main thread. Doesn't matter in this case.
I have a PR out for the webxr-polyfill that improves perf that handles the canvas copying with ImageBitmapRenderingContexts instead of Canvas2DRenderingContexts, using an async createImageBitmap()
. In this case, each model element would be have an image bitmap and async create bitmaps from the WebGL context, which should be cheaper than drawImage. Bonus points, because then an OffscreenCanvas in a worker could be implemented resulting in the best perf option that won't block the main thread unless the GPU is completely clogged -- more info on this solution in the PR. OffscreenCanvas is still Chrome only, I think in 69.
An orthogonal solution could be using an Intersection Observer and lazily draw only models in view, but this probably not necessary off the bat.
from model-viewer.
@jsantell I like the fullscreen-sized context idea. Do you think that could obviate the need for post-processing antialiasing?
from model-viewer.
@cdata not using post processing, we can use the regular WebGL context attribute antialias
which works, but if we do use PP, then we'll use render targets which do not work with antialias, which means if we use any sort of PP, we'll need to add SSAA in the chain
from model-viewer.
Updated this issue to directly address the single webgl context solution. Opening issues for other performance improvements.
FWIW 16 is the max WebGL contexts I could create without things breaking
from model-viewer.
FWIW 16 is the max WebGL contexts I could create without things breaking
I think it's 8 in mobile.
Try loading https://mrdoob.github.io/rome-gltf/ on mobile.
from model-viewer.
Related Issues (20)
- Update lit dependency to 3.1 HOT 6
- SSAO not working on Example website
- Module not found: Error: Can't resolve './styles/evaluators', and many more HOT 5
- Unable to get canvas of the invisible model if there are multiple models on the page and there are less than two models visible HOT 4
- use of "auto" in /editor/ output creates wrong orbit distance
- Is is possible to launch AR mode automatically?
- Missing propagation of the progress event reason
- Frames Rendering to Incorrect Canvas - Multiple Model-Viewers on Page HOT 6
- Ar button problem HOT 1
- How to access the hierarchy and then Three.js changes each object. HOT 1
- When I use scene viewer the model is placed sideways. HOT 1
- Setup lantern demo : bulb light should be visible outside of lantern box
- Generated usdz has a random y rotation when the auto-rotate attribute is used HOT 2
- Generated USDZ files don't work anymore on VisionOS 1.2 beta HOT 5
- AutoUSDZ broken in iOS 17.5 beta HOT 18
- xr-environment attribute causes errors the second time a webxr session is started HOT 6
- WebXR mode does not time out when it fails HOT 4
- iOS REGRESSION: Apple Pay banner fails to render when opening AR QuickLook with USDZ blob
- modelviewer ar-placement= wall is flipping the glb model HOT 5
- Object requires a newer version of iOS
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from model-viewer.