[SOLVED] Water? I'm dumb

Hello guyz,

after a year I returned to jme and I want to make water surface.

The problem is, in all tutorials which I made up are some files, which you have to have in assets.

I looked up to find how to make it and I didn’t find a way to do it.
Which is an easiest way to make water surface?

Sorry than I’m dumb, just really can’t find it out.

Thanks

1 Like

I think you’re looking for the test-data files, which are here:

1 Like

For water you can use a waterprocessor or a water filter.
Both can be added via Code and the second one should be supported by the sdks scene Composer.

So you have to be clear what you are looking dir or which Tutorials you refer to (out Wiki?)

1 Like

jme3-testdata is included as a library in the SDK. Or you can get the 3.1.0 version from JFrog Bintray:

1 Like

Thanks, just,

I’m looking for the easiest way to make water surface.

I didn’t solve from tutorials the easiest way to make it.

1 Like

I tried this code

SimpleWaterProcessor waterProcessor = new SimpleWaterProcessor(assetManager);
waterProcessor.setReflectionScene(rootNode);

    // we set the water plane
    Vector3f waterLocation = new Vector3f(0, -58, 0);
    waterProcessor.setPlane(new Plane(Vector3f.UNIT_Y, waterLocation.dot(Vector3f.UNIT_Y)));
    viewPort.addProcessor(waterProcessor);
    // we set wave properties
    waterProcessor.setWaterDepth(50);         // transparency of water
    waterProcessor.setDistortionScale(0.05f); // strength of waves
    waterProcessor.setWaveSpeed(0.05f);       // speed of waves
    // we define the wave size by setting the size of the texture coordinates
    Quad quad = new Quad(1000, 1000);
    quad.scaleTextureCoordinates(new Vector2f(10f, 10f));
    // we create the water geometry from the quad
    Geometry water = new Geometry("water", quad);
    water.setLocalRotation(new Quaternion().fromAngleAxis(-FastMath.HALF_PI, Vector3f.UNIT_X));
    water.setLocalTranslation(-500, -58, 500);
    water.setShadowMode(ShadowMode.Receive);
    water.setMaterial(waterProcessor.getMaterial());
    rootNode.attachChild(water);

And it does not work for me. Why?

1 Like

Define “does not work”. Is there an error?

1 Like

looks like it can’t load material :smile:

1 Like

To be honest it looks like you’ve followed two half tutorials and came up with the result. You havent specified any texture.

1 Like

This is your problem.

Create a scene node, attach your terrain/Geometry and sky to the node, then add scene node to your rootNode. Attach water and light to rootNode. Use the scene node for reflection.

waterProcessor.setReflectionScene(scene);

Edit, forgot to say why,

public void setReflectionScene(com.jme3.scene.Spatial spat)
Sets the reflected scene, should not include the water quad! Set before adding processor.

1 Like

Thanks guyz,

you helped me a lot to get understanding this problem.

Thanks.

2 Likes

Where do people get those sweet sky maps from?

1 Like

I think that’s just one of the test data sky maps. I could be wrong, though… it looks very familiar.

2 Likes

https://jmonkeyengine.github.io/wiki/jme3/advanced/free_skymaps.html

2 Likes