-1

Is there a way in js to set something like layers? I want some objects in my canvas to no matter what - be rendered on top of everything, and some to be rendered behind everything, regardless of their real position in the scene.

Is it possible?

what is the way to do that?

Thanks

Normal
  • 528
  • 4
  • 19

1 Answers1

3

One method is to use multiple scenes. Set renderer.autoClear=false, then to render, something along the lines of:

renderer.clear();
renderer.render(bottomLayer, camera);
renderer.clearDepth();
renderer.render(topLayer, camera);

That wouldn't be suitable in some cases. If not, then you might look into the object renderOrder and material polygonOffset properties.

msun
  • 761
  • 4
  • 8