Hello,
I hope this hasn’t been posted yet …
I’m noob at jme, and i’m trying to modify one of the exemple (TestProjectedWater for info) to allow me to display a Terrain with some simple objects (cubes etc …) with reflective water (for terrain and objects)
and shadows and skybox.
With the init code below i got all i want except the shadow (yep there’s no ShadowRenderPass cause i tried everything i can to do it but unfortunately).
Is there someone who can help me to complete it for adding Shadows ? (i Want shadow of the objects on the terrain if u see what i mean)
I’m really lost… :?
Here’s init code :
protected void simpleInitGame() {
display.setTitle( “Water Test” );
cam.setFrustumPerspective( 45.0f, (float) display.getWidth() / (float) display.getHeight(), 1f, farPlane );
cam.setLocation( new Vector3f( 100, 50, 100 ) );
cam.lookAt( new Vector3f( 0, 0, 0 ), Vector3f.UNIT_Y );
cam.update();
setupKeyBindings();
buildLighting(); // setup lights
setupFog();
terrain2 = charge_Terrain2(); // Load a Terrain
buildSkyBox(); // …don’t attach skybox anywhere inside
objects.attachChild(createObjects()); // some misc objects
objects.attachChild(createPanneaux()); // some misc objects
water_reflection.attachChild( terrain2 ); // Add terrain to reflection
water_reflection.attachChild( objects );// Add object to reflection
// Init cool looking water
waterEffectRenderPass = new WaterRenderPass( cam, 4, true, true );
waterEffectRenderPass.setClipBias( 0.5f );
waterEffectRenderPass.setWaterMaxAmplitude( 5.0f );
//setting to default value just to show
waterEffectRenderPass.setWaterPlane( new Plane( new Vector3f( 0.0f, 1.0f, 0.0f ), 0.0f ) );
projectedGrid = new ProjectedGrid( “ProjectedGrid”, cam, 100, 70, 0.01f, new WaterHeightGenerator() );
waterEffectRenderPass.setWaterEffectOnSpatial( projectedGrid );
waterEffectRenderPass.setReflectedScene( water_reflection );
waterEffectRenderPass.setSkybox( skybox );
// Attach skybox
rootNode.attachChild( skybox );
// Attach water ???
rootNode.attachChild( projectedGrid );
rootNode.attachChild( water_reflection );
RenderPass rootPass = new RenderPass();
rootPass.add( rootNode );
RenderPass fpsPass = new RenderPass();
fpsPass.add( fpsNode );
pManager.add( waterEffectRenderPass );
pManager.add( rootPass );
pManager.add( fpsPass );
rootNode.setCullMode( SceneElement.CULL_NEVER );
rootNode.setRenderQueueMode( Renderer.QUEUE_OPAQUE );
fpsNode.setRenderQueueMode( Renderer.QUEUE_OPAQUE );
}