Edit: (Added pictures)
I have gotten particle effects working for some nice looking smoke and explosion effects. My question is simple, they’re visible behind objects. (Like if I trigger an explosion behind a wall or any object, you can see it through the object.)
I’ve narrowed it down to something with the zbuffer and blendstate.
If I change it to “TRUE” instead of “FALSE”, I get proper occlusion of particle effects behind objects, however the effects look terrible and blotchy.
Is there any easy way to get the nice looking effects and blending with proper occlusion, or am I just stuck with seeing particle effects through walls.
Here’s some pictures demonstrating what I’m seeing.
Nice looking smoke, no occlusion. (Can see through box)
Ugly looking boxy smoke, but occluded by box.
Edit: (Added pictures)
Try zstate.setWritable(false) or zstate.setWriteEnabled(false) (whichever one it is) with zstate.setEnabled(true)
Thanks for the help, that's an improvement.
I added that line and now the "boxy-ness" looks a lot less apparent, but it's still there.
Here's a the blendstate/texturestate code I'm using. (I took example from explosionfactory in JME)
bs = display.getRenderer().createBlendState();
ts = display.getRenderer().createTextureState();
zstate = display.getRenderer().createZBufferState();
Here's some new screenshots:
Here's the original (non-occluding) smoke:
Here's the smoke from the above code: (with the setwritable(false))
I like the look of the original smoke better. But the fact that it doesn't occlude behind objects is rather misleading sometimes, so I'm trying to figure this out.
Thanks for the quick response.
Okay, nevermind, I figured it out myself.
In the second picture (with occlusion) the smoke is "clipping" with the ground. That's what is creating that boxyness.
I think the best solution will be to raise the smoke up a little bit so it doesn't clip through the ground.
Thanks again for the help.
Yeah the issue you're talking about is well known. You can use a shader to blend the particle into the background as it gets closer to an object.
See this article: http://www.gamerendering.com/2009/09/16/soft-particles/
Nice article, you notice those effects a lot in games like aion or everquest, where big particles are used to create some fog near the floor.