I am generating a water Material but when it is applied to a Geometry, all that it shows it a Black Material The code to generate the material is being run within the appInit (its in a constructor within appInit) so I am not sure if this has anything to do with it but here is the code I am using to generate the material and attach the sceneprocessor.
[java] SimpleWaterProcessor wp = new SimpleWaterProcessor(Main.app.getAssetManager());
wp.setReflectionScene(Main.app.getRootNode());
// we set the water plane
Vector3f waterLocation=new Vector3f(0,-6,0);
wp.setPlane(new Plane(Vector3f.UNIT_Y, waterLocation.dot(Vector3f.UNIT_Y)));
Main.app.getViewPort().addProcessor(wp);
Material wat = wp.getMaterial();[/java]
the water plane configuration is wrong it should be the surface plane of the water.
Not sure you will get something working with your mesh configuration
the same thing happens, it looks like what happens if you don’t attach the waterProcessor to the ViewPort. It still happens even when it is attached to a Node instead of a BatchNode so that obviously isn’t it… I am assigning the material to a geometry in a static array that I clone and translate for each use, would that affect it at all?
kind of, if I attach the geometry from the array then no but If I generate the material and geometry directly in the InitApp() then yes it does. And actually, if I attach the geometry from the array in the InitApp() then it doesn’t show up at all but in the other subRoutines that are started in InitApp() it works fine somethings wacky here
Oh ok. When you clone a geometry the default behavior is to also clone the material attached to it.
The problem doing this is that only the original material will be updated by the water processor. That would explain your issue.
Use geometry.clone(false) to keep the same material for all the geometries