Waterfall effect

I want to make waterfall effect .I want to incurvation quad and add quad into WaterRenderPass.anyone can help.thanhks.






import javax.swing.ImageIcon;

import jmetest.curve.TestBezierCurve;
import jmetest.effects.RenParticleEditor;
import jmetest.terrain.TestTerrain;

import com.jme.app.SimpleGame;
import com.jme.bounding.BoundingBox;
import com.jme.bounding.BoundingSphere;
import com.jme.bounding.BoundingVolume;
import com.jme.curve.BezierCurve;
import com.jme.curve.CurveController;
import com.jme.image.Image;
import com.jme.image.Texture;
import com.jme.light.LightNode;
import com.jme.light.PointLight;
import com.jme.math.Plane;
import com.jme.math.Ring;
import com.jme.math.Vector3f;
import com.jme.renderer.Camera;
import com.jme.renderer.ColorRGBA;
import com.jme.renderer.Renderer;
import com.jme.renderer.pass.BasicPassManager;
import com.jme.scene.Controller;
import com.jme.scene.Skybox;
import com.jme.scene.TriMesh;
import com.jme.scene.shape.Box;
import com.jme.scene.shape.Quad;
import com.jme.scene.state.AlphaState;
import com.jme.scene.state.CullState;
import com.jme.scene.state.FogState;
import com.jme.scene.state.LightState;
import com.jme.scene.state.RenderState;
import com.jme.scene.state.TextureState;
import com.jme.scene.state.ZBufferState;
import com.jme.system.DisplaySystem;
import com.jme.util.TextureManager;
import com.jme.util.geom.Debugger;
import com.jmex.effects.LensFlare;
import com.jmex.effects.LensFlareFactory;
import com.jmex.effects.particles.ParticleFactory;
import com.jmex.effects.particles.ParticleGeometry;
import com.jmex.effects.particles.ParticleMesh;
import com.jmex.effects.particles.SimpleParticleInfluenceFactory;
import com.jmex.effects.water.ProjectedGrid;
import com.jmex.effects.water.WaterHeightGenerator;
import com.jmex.effects.water.WaterRenderPass;
import com.jmex.terrain.TerrainBlock;
import com.jmex.terrain.util.MidPointHeightMap;
import com.jmex.terrain.util.ProceduralTextureGenerator;
import com.sun.corba.se.spi.legacy.connection.GetEndPointInfoAgainException;

public class hieuungparticle extends SimpleGame
{
   
   
   
    private WaterRenderPass waterEffectRenderPass;
    private ProjectedGrid projectedGrid;
    private BasicPassManager pManager;
   
   
    
   public static void main(String[] args)
   {
      hieuungparticle app=new hieuungparticle();
      app.setDialogBehaviour(ALWAYS_SHOW_PROPS_DIALOG);
      app.start();
      
   }

protected void simpleInitGame()
   {
buildWater();

}
private void buildWater()
   {
      waterEffectRenderPass = new WaterRenderPass( cam, 4, false, true );
      
      //set equations to use z axis as up
      waterEffectRenderPass.setWaterPlane( new Plane( new Vector3f( 0.0f, 1.0f, 0.0f ), 0.0f ) );
      waterEffectRenderPass.setTangent( new Vector3f( 1.0f, 0.0f, 0.0f ) );
      waterEffectRenderPass.setBinormal( new Vector3f( 0.0f, 1.0f, 0.0f ) );
      waterEffectRenderPass.setClipBias( 0.001f );
      waterEffectRenderPass.setWaterMaxAmplitude( 0.001f );
      
      WaterHeightGenerator waterHeight = new WaterHeightGenerator();
      waterHeight.setHeightbig(10);
      
      projectedGrid = new ProjectedGrid("Water", cam, 200, 100, 0.01f, waterHeight);
   //   projectedGrid.setRenderQueueMode(Renderer.QUEUE_OPAQUE);

      waterEffectRenderPass.setWaterEffectOnSpatial( projectedGrid );
      waterEffectRenderPass.setEnabled(false);
      
      projectedGrid.setLocalTranslation(new Vector3f(-8,-18,30));
      pManager=new BasicPassManager();
      pManager.add(waterEffectRenderPass);
      
      rootNode.attachChild(projectedGrid);
   }

}

   

Is that possible to do the same today with JME3 and the new water post ?

Just use the particle emitter.

how do you make the water falling ? ( particules are just for the bottom of the fall i guess )

some sort of animated normal map to fake the flow of water on a reflective and refractive surface. :stuck_out_tongue:

No, i was thinking about using falling particles for the water too. Maybe more lines than dots…

1 Like

i’ll try this two solutions thanks

Post pictures if they look cool/get it to work? :wink:

I was hoping to do something like that : http://www.youtube.com/watch?v=jlF_mPzyIbI&feature=related with rocs and water falling without particules like the video ( i’m meaning the water descending )



Can the post water do that ?

Hello!



Honestly, in that video it looks like some trickery is going on (which is computer graphics in a nutshell, but I digress). I swear the waterfall looks like some sort of animated texture. Maaaaaybe the waterfall itself is an animated mesh, odds are it is, but it’s not obvious. The “fog” at the bottom of the falls is to hide the hardest part of the waterfall to animate which is where the waterfall meets the flatter river surface. The river itself is something fancy pants like the post water filter. Honestly, I’m not sure if you’d even want the post water filter on the waterfall itself unless you were going for a close-up reflection. With the amount of entropy of water falling, reflections are not visible from more than a few feet away because of all the noise in the water. Same goes for it’s translucency. If there’s a cave behind a waterfall, it probably isn’t very visible because of how solid falling water appears. It would probably look pretty fake if you could see through it.



Now, as for using the post water for the waterfall itself… I’m not sure. I know there was a post yesterday about making it reflect from all directions if you need the close up reflective property. But as I said before you’re going to want the water to appear more solid, and a bit foamy from the fall. Otherwise it will look really fake/cheesy. If you tweak the wave height and size etc etc, it might look convincing.



Oh. But that fog effect at the bottom is probably a must. Where the water smacks into the river surface would be a total !@*$! to animate :stuck_out_tongue: It sorta sucks in a way, because with a waterfall that short I’m not even sure there would be a cloud. The falling water needs more momentum and time to dissipate and cause the mist. But whatever, if you don’t think about it too hard it works :stuck_out_tongue:



2 cents deposited.

~FlaH

2 Likes

awesome answer thank you i’ll do my best

normen said:
No, i was thinking about using falling particles for the water too. Maybe more lines than dots..


I'll do this solution it's better , thanks normen