Water color black in color

Hello Sir, I am using water processor for creating water in my map but it is rendering black in color in map. I also added light source for water even though it is black in color. please help me how to get rid this black color. Then below are the image,

What material have you applied to the water geometry?

Thanks for the reply. I didnt apply any material to it. I am using SimpleWaterProcessor object to create the water. the constructor internally applying material to the water mentioned below.

material = new Material(manager, “Common/MatDefs/Water/SimpleWater.j3md”);
material.setFloat(“waterDepth”, waterDepth);
material.setFloat(“waterTransparency”, waterTransparency / 10);
material.setColor(“waterColor”, ColorRGBA.White);

Then i am getting this material and applying in the my water like,

water.setMaterial(waterProcessor.getMaterial());

I dont know why my water is black.

Did you add the processor to your viewport?

How is your scene graph organized? How did you set the reflectionScene?

I am still getting the same issue. see the pic below.

My code for creating the water is below.

[SimpleWaterProcessor waterProcessor = new SimpleWaterProcessor(assetManager);
waterProcessor.setReflectionScene(sceneModel);

    // we set the water plane
    Vector3f waterLocation=new Vector3f(0,50,50);
    waterProcessor.setPlane(new Plane(Vector3f.UNIT_Y, waterLocation.dot(Vector3f.UNIT_Y)));
    viewPort.addProcessor(waterProcessor);

    // we set wave properties
    waterProcessor.setWaterDepth(40);         // transparency of water
    waterProcessor.setDistortionScale(0.05f); // strength of waves
    waterProcessor.setWaveSpeed(0.05f);       // speed of waves
    waterProcessor.setLightPosition(new Vector3f(-200, -6, 250));
    // we define the wave size by setting the size of the texture coordinates
    Quad quad = new Quad(400,400);
    quad.scaleTextureCoordinates(new Vector2f(6f,6f));

    // 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(0, 1, 10);
    water.setShadowMode(RenderQueue.ShadowMode.Receive);
    water.setMaterial(waterProcessor.getMaterial());
    rootNode.attachChild(water);]

Please help me how to fix it.

Does sceneModel have any children? Is it attached to anything?

No my scene model doesn’t have any child. it is attached to only root node. Is my scene model(sceneModel = assetManager.loadModel(“main.scene”):wink: can be responsible for black color in water?.

If I read your code correctly, sceneModel is the sub-scene where you put objects that will be reflected in the water.

If there’s nothing in that sub-scene then nothing will appear reflected in the water. The surface of the water will tend to be black. Also, if the reflected objects have lit textures, the subscene will need lights.

1 Like

Thank you very much for your help. What you said it was right since there was nothing in the sub-scene that’s why it was displaying black in color. so i added sky and it is reflecting it and there is no black water. Is it correct right?

You might also want the mountains and the character to be reflected in the water. Your call!