Reflections are not showing on water plane

I have set up a water plane with the following settings, but the reflections are not showing they why they should be…











The code im using is follwing.

[java] rootNode.attachChild(mainNode);



SimpleWaterProcessor waterProcessor = new SimpleWaterProcessor(assetManager);

waterProcessor.setLightPosition(new Vector3f(-3f, -10f, 5f));

waterProcessor.setWaterColor(ColorRGBA.Brown);

waterProcessor.setReflectionScene(mainNode);

Geometry waterPlane = waterProcessor.createWaterGeometry(2000, 2000);

waterPlane.setLocalTranslation(-750, -30, 500);

waterPlane.setMaterial(waterProcessor.getMaterial());

waterPlane.setShadowMode(ShadowMode.Receive);

waterPlane.setLocalRotation(new Quaternion().fromAngleAxis(-FastMath.HALF_PI, Vector3f.UNIT_X));

rootNode.attachChild(waterPlane);

viewPort.addProcessor(waterProcessor);[/java]

i might be wrong on this, but it might be to do with the geometry of your blocks intersecting the water plane, if it’s a single face/side going through the plane, it wont reflect properly - you may need to ‘slice’ the geometry at the water level,

again apologies if i’m totally wrong on this…

xp61 said:
...if it's a single face/side going through the plane, it wont reflect properly - you may need to 'slice' the geometry at the water level,

That may explain the floating panels but what about the rabbit? See the while color bleeding around the ears and hand...they are the reflection of it, in the water....and the rabbit is standing far from the water surface...

I think for some reason, the reflection is not being mirrored.They are being projected as they are in the real world.Wild guess though.

oh right i thought the floating panels were half submerged in the water, sorry…



also make sure everything in your scene is attached to the node going into the water processor

ok, after some observation, i figured out that when im on a higher ground with the rabbit, reflection turns out to be ok.



But, when I am under a certain level(y axis value), reflection starts to look like the attached pic.(first post)



Any idea about this?

the first pic looks to me as you would expect it, if the rabbit is just at the waters edge and you are directly behind it, the angle is picking up just the sky, you would need the camera from the far side looking back to see the rabbit reflected in the water?

no the rabbit not at the water edge. I am posting another screen shot,…



im really getting confused about what is right and wrong.

also check your water geometry plane level (height) is exactly the same as the level in the water processor,



other than that i would go into the test water example demo and learn from that how exactly everything should work…

1 Like

thanks, this was the problem, they were not at the same level :slight_smile:



I was using the default water plane from the processor,

[java]Geometry waterPlane = waterProcessor.createWaterGeometry(10, 10);

waterPlane.setLocalTranslation(-5, 0, 5);

waterPlane.setMaterial(waterProcessor.getMaterial());[/java]



in this code, i didnt notice that, it dont allow me to change the level(y axis) of water plane.



This should be mentioned in the doc.



But,now there is another issue, when, the panel is partially submerged in the water, reflection looks like the following.





But, there are some parts of this level, where some platforms will oscillate up and down through waterplane.And splicing a model, exactly where it will intersect with the water plane it not handy.So, any idea?

What revision of JME do you use?

Those issues are because clipping plane for reflection and refraction, was not implemented. So submerged object were reflecting on the water, and emerged were refracting. (the artifacts on your pictures are refracted objects that shouldn’t)

But this was changed in revision 6273 http://code.google.com/p/jmonkeyengine/source/detail?r=6273

Try to update and it should work.

If you have a more recent revision …well there is probably an issue.

I am using the latest revision.

ok i see what’s going on then

On the waterProcessor there are 2 methods :

setRefractionClippingOffset and setReflectionClippingOffset. Try to set them to 0.0, and tell me if the result is better.

yeh, results are a lot better, but i think, still somethings are not right…i see some distance between the reflection and water surface, is it what it is supposed to be?







it may look small, but, it is very prominent when the rippling.

Now you understand the problem :stuck_out_tongue:

that’s why there are those 2 parameters that you can tweak.

Try to set the refraction clip plane to 0.2f.

You need to find the good compromise