Three.js: CSS3D elements render order

Created on 16 Jun 2017  路  9Comments  路  Source: mrdoob/three.js

Description of the problem

The CSS3D elements always occlude non-CSS3D elements.
I tried without success to change the zIndex property.

I think that CSS3D is always rendered first?
If it is correct, is there anyway to make the render order customizable?

Three.js version
  • [x] Dev
  • [ ] r85
  • [ ] ...
Browser
  • [x] All of them
  • [ ] Chrome
  • [ ] Firefox
  • [ ] Internet Explorer
OS
  • [ ] All of them
  • [x] Windows
  • [ ] macOS
  • [ ] Linux
  • [ ] Android
  • [ ] iOS
Hardware Requirements (graphics card, VR Device, ...)
Question

Most helpful comment

the only property that I find useful is zIndex, which did not affect the outcome.

Please show your code and explain what you are trying to do.

This has an effect.

document.body.appendChild( css3Drenderer.domElement );
document.body.appendChild( div );

css3Drenderer.domElement.style.zIndex = '0';
div.style.zIndex = '1';

All 9 comments

/ping @yomotsu

@mhoangvslev have you tried with raw CSS3D?

I really need your CSS3D because it synchronizes with 3D Scene.

Yes, but it would be great if you could help us investigate this issue by testing if what happens with raw CSS3D.

@mrdoob As stated before, the only property that I find useful is zIndex, which did not affect the outcome. Otherwise, please precise what you mean by "raw CSS3D", for I am very new to this.

the only property that I find useful is zIndex, which did not affect the outcome.

Please show your code and explain what you are trying to do.

This has an effect.

document.body.appendChild( css3Drenderer.domElement );
document.body.appendChild( div );

css3Drenderer.domElement.style.zIndex = '0';
div.style.zIndex = '1';

@mhoangvslev

I really need your CSS3D because it synchronizes with 3D Scene.

Do you mean, "non-CSS3D elements" is your WebGL Canvas? and you want to mix CSS3D and WebGL objects? If so, it is almost impossible. These 2 worlds are completely separated.

Oh, I guess I misread.

Yeah, you can't mix CSS3D objects with Canvas/WebGL objects. They're different layers. You can do some hacks though:
http://learningthreejs.com/blog/2013/04/30/closing-the-gap-between-html-and-webgl/

Was this page helpful?
0 / 5 - 0 ratings