I’m not sure about the number of hoops you jumped through to get the punchthru tho?
Can’t you just render the monitors screen mesh into the punchthru alpha to show through to your CSSRenderer behind the WebGL canvas?
the css3d-mixed sample also shows this.. notice at oblique angles, the boxy picture frame properly occludes the CSS content.
The key insight being that the CSSRenderer is placed behind the (webgl canvas with alpha=true)
Yes! Glad to hear!
And yes, overlaying the CSSRenderer on a WebGL renderer is a great use case.
You can even do some fancy stuff by putting the CSS renderer behind the WebGL rendererer and doing some tricks to punch through the webGL revealing the CSS renderer behind it… which lets you make it appear as if the HTML is truly inside your 3d scenes… But it is pretty tricky to implement that, so I’d definitely start with CSS on top until you get comfortable with it.
“positionMarkers” is getting called every frame, and each marker is doing a raycast.to check if it is occluded (behind the object).
Since your model is pretty dense (lots of triangles) this is really slow.
There are a few different ways to address this…
Use an invisible low poly version of your model that you do the raycasting against.
Use the CSSRenderer but integrated more deeply with threejs. Instead of having it as an overlay on top of the scene… put the cssrenderer Behind the threej…
edit: hahah found my earliest reference to it from 13 years ago!! :
opened 09:51PM - 21 May 12 UTC
closed 04:43PM - 24 May 12 UTC
Question
Hello,
i am interested in creating a HUD in webgl. I know html can be used to o… verlay over the scene, but having the UI accelerated on the card can have some mighty advantages, mostly integration with the rest of the app, 3D transforms/transparency and shader special effects.
I was wondering if there was a way to dual render a scene and blend/overlay it. For example to render a a first time with a perspective camera, and then render a second HUD layer on top with an orthographic camera and blend it with the first.
thanks
and some potential pitfalls to watch out for:
opened 04:49AM - 30 Jul 16 UTC
closed 05:54PM - 03 Apr 17 UTC
##### Description of the problem
CSS Renderer elements disappearing/flickering … at small scales..
I'm doing some mixing of gl three.js rendering and css3 html ui.
To do this, I have to scale down my CSS3Objects to match the resolution of my GL world where 1 unit = 1 metre. At this scale, the CSS3 objects start to flicker and disappear when viewed at slightly oblique angles.
I've reproduced the problem using the periodictable demo, by setting scale on the scene to 0.002
and scaling the min/max zoom on the trackball control to allow closer zooming in...
http://vectorslave.com/periodic/css3d_periodictable.html
If you hit the Helix button and zoom in and out, you may see tiles disappearing...
Any ideas about this/confirmations?.. it's drivin me nuts!
##### Three.js version
- [ ] Dev
- [x ] r79
- [ ] ...
##### Browser
- [] All of them
- [x] Chrome
- [ ] Firefox
- [ ] Internet Explorer
##### OS
- [] All of them
- [x] Windows
- [ ] Linux
- [ ] Android
- [ ] IOS
##### Hardware Requirements (graphics card, VR Device, ...)
Also.. as an extension to this.. you can also put another CSS layer on top of everything if you want something with nice transparency / blending but no occlusion… or using the punchthru for occlusion, but limited blending/transparency.
2 Likes