SimpleWater.jm3d is black

I created a custom mesh and added a simple material to it as a test, and it works great. Then, I added a ShaderBlow MatCap material to it, looks great and works fine. Then, I added this material to it:

waterMat = new Material(mainapp.getAssetManager(), “Common/MatDefs/Water/SimpleWater.j3md”);

And the geometry is rendered completely black!! I do have ambient and directional lights in my scene, and they are lighting up my plaers 3d model properly. Why is SimpleWater.jm3d black? Is there something special about it?

Thanks,
Andy

Because you need a waterProcessor in order to have the reflection and refraction rendered.
https://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/test/jme3test/water/TestSimpleWater.java

I ran this code…

[java]private void initProcessors(){
//create processor
waterProcessor = new SimpleWaterProcessor(mainapp.getAssetManager());

    waterProcessor.setReflectionScene(skynode);
            
    waterProcessor.setDebug(true);
    mainapp.getViewPort().addProcessor(waterProcessor);

    waterProcessor.setLightPosition(new Vector3f(40,140,40));

    //create water quad
    //waterPlane = waterProcessor.createWaterGeometry(100, 100);
    Box b = new Box(1, 1, 1); // create cube shape
    Geometry waterPlane = new Geometry("Box", b);
  //  Spatial waterPlane=(Spatial)  geom;
    waterPlane.setMaterial(waterProcessor.getMaterial());
    waterPlane.setLocalScale(40);
    waterPlane.setLocalTranslation(22, 22, 111);
    this.queueNodeAttachment(waterPlane,  getRootNode());
    
    MainApp.getAssetPreloader().waterMat = waterProcessor.getMaterial();
}[/java] 

And the cube that spawns is just completely black. Very strange.

Could you post a screen shot?
Also the water processor is not made to work on a box, you’ll have reflection issue with it. It’s done to make a water plane.

I actually did get this working after using that test scene. However, the material does indeed have messed up reflection. I put the material on some voxels, for voxel water, and it performs with great fps rates but the reflection/refraction just looks messed up. I just want the shader to reflect the scene but completely upside down, so you just see the sky in the water (any maybe other stuff but that can come later).

like this : http://www.youtube.com/watch?v=FEaQIMX68Wk
http://www.gamasutra.com/view/feature/6367/an_intro_to_cellular_automation.php

That water material shader should be included in JME3 cause that is just downright amazing :stuck_out_tongue:

EDIT:
Here is what I have so far using the material of an active simplewaterprocessor…

<img src=“http://i.imgur.com/s9Wzh1w.jpg” alt="" /

In an ideal world, the ‘reflection normal’ would be straight up into the air, not off on a weird angle. How would i achieve this? Could I just edit the waterprocessor or do I need to tear apart the shaders?