HI all! u have a particule effect with all the blending option working fine, but… when an object is behind or front of the particle system i have a problem with the z-sort and a saw the object in front of the particle, when the object it's behind… any clue on how to solve that? thanks in advance!!
HI all! u have a particule effect with all the blending option working fine, but... when an object is behind or front of the particle system i have a problem with the z-sort and a saw the object in front of the particle, when the object it's behind... any clue on how to solve that? thanks in advance!!
Post a snapshot of the problem and the code that sets up your ZBufferState on the root/scene node.
BlendState as1 = display.getRenderer().createBlendState();
TextureState tsParticle = display.getRenderer().createTextureState();
pMesh = ParticleFactory.buildParticles("particles", 100);
pMesh.setStartColor(new ColorRGBA(1, 0, 0, 1));
pMesh.setEndColor(new ColorRGBA(0, 1, 0, 0));
pMesh.setMaximumAngle(360f * FastMath.DEG_TO_RAD);
ZBufferState zstate = display.getRenderer().createZBufferState();
pMesh.setRenderState(tsParticle); // textura loaded
after that i add to the root ( sceneUniverse is a Node Class ) all object are attached to sceneUniverse
On the render section
sceneUniverse.updateRenderState(); // sceneUniverse is the root
Are you sure that you want to have zstate disabled?
Change zstate.setEnabled(false); -> zstate.setEnabled(true); and perhaps it'll solve your problem. At least it worked for me.
Try using this as well:
zbuffer.setFunction( ZBufferState.TestFunction.LessThanOrEqualTo );
and set the render state of the root scene node:
zstate.setEnabled(true); // same error
zbuffer.setFunction( ZBufferState.TestFunction.LessThanOrEqualTo ); // same error
maybe is the bouding sphere of the particles?? any clue is that is posible and how to solve that ?
Are you getting an actual error or are you just not seeing the proper z-depth on the particles?
If an error, copy it here.
If its just a z-depth issue, did you attach the z-buffer to the scene's root node? If its just attached to the particle node then it won't propigate into world-space and produce the expected z-ordering.
Hi! it's just not seeing the proper z-depth on the particles. it work fine with the others object it's just with one with this not proper set z-buffer all z-buffer are applied to the scene root and not to the object itself
here is an attach jpg, the sun if over the particle (wrong) and the earth is fine. the particle need to be over the sun
any clue of what could happend?
What geometry did you attach your particles to? It's hard to tell from the pic you posted.
When troubleshooting problems like this, it is sometimes easier to see what is going on if you
- increase your particle flow so that what you are seeing is not so dispersed
- make the geometry that your particles are attached to visible if you are culling it
- make the geometry that your particles are attached to invisible if you are not culling it
- make the geometry that your particles are attached to a different material/color that has a higher contrast with the particles so that you can more easily see what is going on.
Of course, you could post your ~entire~ scene code so that the devil in the details can be spotted by me (or someone else) reading/tracking this thread.