[SOLVED] Particles rendered from behind a wall :(

Hello!



Now it’s time to play with particles n_n



Basic, but first decent result:







Yay! Lovely particles n_n



Ok, now we can suppose this post is related to a question :slight_smile:



Look at the “fountain” from behind:







Woa. Water from chernobyl, you can see it through walls…



I thought all I needed was a bounding box:


      Box wallBox = new Box("wall", new Vector3f(), new Vector3f(0.5f, 2,
            0.5f));
      StaticPhysicsNode wall = getPhysicsSpace().createStaticNode();
      wall.attachChild(wallBox);
      wall.generatePhysicsGeometry();

      wall.setModelBound(new BoundingBox());
      wall.updateModelBound();



The same has been made for the particle system:

      particles.setModelBound(new BoundingBox());
      particles.updateModelBound();



-> Now I feel ModelBounds are not meant to that kind of end... they're for picking purpose so?

Not yet feeling easy with rendering, I felt this would perhaps help:

wall.setRenderQueueMode(Renderer.QUEUE_OPAQUE);


particles.setRenderQueueMode(Renderer.QUEUE_TRANSPARENT);



but no, it doesn't :(

Hmm, please help before it starts looking like a Sorcerer's Apprentice clone, jME version ;)
Thanks!

the particles need a zbufferstate

Ah thanks, that's the solution n_n



      ZBufferState zstate = display.getRenderer().createZBufferState();
      zstate.setEnabled(true);
      particles.setRenderState(zstate);



But! The answer brings a new question...



The counts show the engine still creates the particles, even if they are not visible... any idea why that could be?

thanks!

They are drawn as long as they are in the camera's frustum…  even if they would be obscured by something.

Ok thanks for that!

  • This has just made me understand frustum!



    Setting:

cam.setFrustumFar(5);



clearly shows that the particle are not rendered anymore as they leave the camera scope - Framerate improves and counts are back to few.

:D Thanks all!
even if they would be obscured by something.

Has anyone worked on occlusion culling??


I could probably handle something like that if not. ;)


I think it would be a decent addition to jME

yeah, momoko_fan did.  You should be able to find it on the forums