Hey,
I tried out the water test and it looks awsome.
I tried out putting a particleemitter in the water (half in half out) and it doesn’t render anything below the water the particleemitter is just cut into half.
Any ideas?
Another question is: is there a way to create a ball of water?
Which water? If you mean the simple water I guess your particle emitter is not attached to the right node so it cannot be reflected. https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:advanced:water
No waterballs, with a reflection map you can maybe achieve a similar effect.
TestCubeMap is kind of like a water ball, except that it reflects/refracts a cubemap, so it is not exactly correct.
Without water:
With water:
Sphere centre points are on ZX plane where Y is 0
I might have to ask Remy/nehon about this, it seems particles and filters are natural born enemies or something X_X
mhhh strange…could you give a test case?
thats not only the particles I guess, because the water is only visible around the spheres.
It actually almost works if you look straight down on the water, I can see the reflection for a moment.
[java]
import com.jme3.app.SimpleApplication;
import com.jme3.effect.ParticleEmitter;
import com.jme3.effect.ParticleMesh;
import com.jme3.light.DirectionalLight;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import com.jme3.post.FilterPostProcessor;
import com.jme3.water.WaterFilter;
public class TestParticleWater extends SimpleApplication {
public static void main(String[] args) {
TestParticleWater test = new TestParticleWater();
test.start();
}
private FilterPostProcessor fpp;
private WaterFilter water;
private float initialWaterHeight = 0.0f;
private Vector3f lightDir = new Vector3f(-4.9236743f, -1.27054665f,
5.896916f);
@Override
public void simpleInitApp() {
fpp = new FilterPostProcessor(assetManager);
water = new WaterFilter(rootNode, lightDir);
//
water.setWaterHeight(initialWaterHeight);
water.setWaterTransparency(0.05f);
fpp.addFilter(water);
viewPort.addProcessor(fpp);
ParticleEmitter fire = new ParticleEmitter("Emitter",
ParticleMesh.Type.Triangle, 30);
Material mat_red = new Material(assetManager,
"Common/MatDefs/Misc/Particle.j3md");
mat_red.setTexture("m_Texture",
assetManager.loadTexture("Effects/Explosion/flame.png"));
fire.setMaterial(mat_red);
fire.setImagesX(2);
fire.setImagesY(2); // 2x2 texture animation
fire.setEndColor(new ColorRGBA(1f, 0f, 0f, 1f)); // red
fire.setStartColor(new ColorRGBA(1f, 1f, 0f, 0.5f)); // yellow
fire.setInitialVelocity(new Vector3f(0, 2, 0));
fire.setStartSize(1.5f);
fire.setEndSize(0.1f);
fire.setGravity(0);
fire.setLowLife(0.5f);
fire.setHighLife(3f);
fire.setVelocityVariation(0.3f);
rootNode.attachChild(fire);
DirectionalLight sun = new DirectionalLight();
sun.setDirection(new Vector3f(-0.1f, -0.7f, -1.0f));
rootNode.addLight(sun);
}
}
[/java]
This is the depth write issue.
Particle is not detected as an “object” by the water because it doesn’t write depth.
If you enable depth write, you get artifacts since you don’t have depth sort per-particle and because the water only blends it when the depth allows it, its a yes or no kind of thing.
Alpha to coverage does not work also since depth is not altered.
We might need to write alpha value for a pixel, and then use it to blend in the water effect.
Sorry for revivng this old thread but I’m also having trouble with Particle Effects being inside the water…
I guess it is a noob - question, but how exactly do I
enable depth write?
particle.getMaterial().getAdditionalRenderState().setDepthWrite(true);
Thank you very much !