Repository navigation
Conversation
| this.skysphere.renderOrder = 1; | ||
|
|
||
| // TODO: hook to transparent attribute | ||
| this.skysphere.visible = false; |
There was a problem hiding this comment.
... would there need to be more logic around that? There are a few places that expect the skysphere to exist.
|
Thanks for the PR! We will take a look. I wonder if there is a connection to #239 |
|
@forresto can you confirm which browsers/platforms you are experiencing this in as we go to test for ourselves? |
|
Quick comments:
|
|
Safari, Chrome, and Firefox on Mac.
I think that would make sense. I wasn't sure if there might be a rendering feature that could use both
|
Would that prevent having transparent and non-transparent elements on the same page? |
If using That being said, I don't have any actual numbers of using alpha vs not in terms of performance. There are plans (#216) of using different strategies of rendering based off of usage (one element on desktop? it gets their own webgl context. multiple elements on mobile? they reuse the same webgl context) which can investigate this a bit more. I'll look today in breaking out the scene.background changes in #237 which would make this a bit easier as well. Previously that change couldn't stand alone, but I think that's no longer the case (or my original assumptions were wrong!) |
|
Now I see how clearing works :) Demo: https://3d-model-viewer-component.webflow.io/transparent-hack |
| const webGlOptions = {antialias: true}; | ||
|
|
||
| // TODO: hook to transparent attribute | ||
| const isTransparent = true; |
There was a problem hiding this comment.
Since Renderer is a singleton we don't have a way to get an attribute in here. TBD how that should work. Ideas?
There was a problem hiding this comment.
This renderer is responsible for all elements/scenes, currently, so a renderer can be responsible for both a transparent and non-transparent scene -- ModelScene is unique per element, however
| }); | ||
| this.renderer.autoClear = false; | ||
| // TODO: hook to transparent attribute | ||
| this.renderer.autoClear = isTransparent; |
There was a problem hiding this comment.
A handful of components use the renderer outside of elements -- composing environment maps or shadows, or any WebGLRenderTargets -- autoClear should not change as they affect all of those framebuffers
There was a problem hiding this comment.
How can I keep it false and avoid other scenes bleeding in?
There was a problem hiding this comment.
@forresto we do per-scene (in other words, per-element) renderer configuration in the render loop itself. See https://github.com/GoogleWebComponents/model-viewer/blob/master/src/three-components/Renderer.js#L135-L171.
However, this may not be suitable for all kinds of renderer configuration, and autoClear is probably not going to be suitable as it clears the whole context.
In the future, we intend to support additional rendering modes (Jordan already referenced this, but I'll ping it again as an example: #216). As we start to get into that, we should be able to layer on configurations like this.
There was a problem hiding this comment.
Are you recommending that I hold more work on this PR for #216? I can use my branch for now, since it seems to work.
There was a problem hiding this comment.
👍 thanks @forresto yeah I think it would be best to pin this PR for now and come back to it soon as we start to upgrade our approaches to rendering.
|
Adding a big 👍 to this feature. Super looking forward to it being possible. |
|
@pushmatrix we were considering creating 2 internal webgl contexts (when needed) one for |
|
Hey, I am really looking forward to use |
|
Here's a build of my branch: https://uploads-ssl.webflow.com/5c013e2442f37ff004567ee6/5c17c0247910f0e6fe21dde9_model-viewer.min.js.txt (you can rename to .js) Note that the build is a few months behind the official version. |
|
@forresto Thanks for your reply :) will try to incorporate your build, hope that background transparent can be incorporated in the official build soon. |
|
I spent a little bit of time poking at this problem. The main roadblock that I ran into is that we need to set So, we should not force Relatedly, it seems desirable for us to generally move away from |



Reference Issue
Conversation in #182
TODO:
background-color="transparent"