¿El sistema de partículas Three.js como fondo forzado detrás de otros objetos?

I have a particle system that I am using to generate background stars - I have it tracking position with the camera but sometimes, the stars will render closer than the bodies which they are meant to be the background for.

Is there a way to force the particle system to always render behind the other meshes in my scene (almost as a background wallpaper - but moving with rotation)?

Muchas gracias.

preguntado el 06 de septiembre de 12 a las 17:09

1 Respuestas

This is relatively easily.

  • create a renderer with autoclear = false
  • clear your render with renderer.clear();
  • render your particle system as a separate scene
  • clear the depth of the rendering with renderer.clear(false, true, false);
  • then render all other objects.

And voila, you have a particle system that always stays behind the scene.

http://jsfiddle.net/vuQ9R/10/

Respondido el 07 de Septiembre de 12 a las 09:09

Even easier. With just one scene, you can set depthWrite a false in the particles material and particles.renderDepth = 0: jsfiddle.net/vuQ9R/13 - mrdoob

yep I made it too damn hard again - Gero3

Haha, I would have done it like this some months ago too. But you learn tips and tricks every day. - mrdoob

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.