Giter VIP home page Giter VIP logo

webgl-water's Introduction

webgl-water's People

Contributors

evanw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

webgl-water's Issues

what's the water simulation algorithms underling?

very impressive!!after playing it many times,i decide to learn the code carefully。it will be painful without ideas or algorithms guidance。 the most mysterious is how you simulate water。i am not sure you use terrain simulation,or more complex theory like Navier-Stokes equations。can you give me some reference on water simulation,please?

IntersectCube algorithm????

This is a very beautiful example. I do not understand the algorithm of IntersectCube, when I read this example source code, can you give me some ideas?

vec2 intersectCube(vec3 origin, vec3 ray, vec3 cubeMin, vec3 cubeMax) {
vec3 tMin = (cubeMin - origin) / ray;
vec3 tMax = (cubeMax - origin) / ray;
vec3 t1 = min(tMin, tMax);
vec3 t2 = max(tMin, tMax);
float tNear = max(max(t1.x, t1.y), t1.z);
float tFar = min(min(t2.x, t2.y), t2.z);
return vec2(tNear, tFar);
}

Make the water container a bowl (half sphere)

Beautiful work!! ... Would like to create a version where the bowl is a hemispherical fishbowl shape and get the reflection maths right... polar coordinates, or quaternions or just bespoke sin and pi maths...? Any ideas to help perchance? Thank you so much!! Jez.

have waves die on pool edges

very beautiful work.

i having been looking at your shader code in water.js and am wondering what addition i would need to make so the water ripples do not bounce of the edges of the pool, but rather die there?

i have been looking at this water ripple approach so far:
http://jsfiddle.net/esteewhy/5Ht3b/6/

thanks for your advice.

the trick of cube culling?

In the cube vertex shader, the code below flips the inside and outside faces of the cube. So when enable GL_CULL_FACE, we can see the inside faces instead of the outside faces.
position = gl_Vertex.xyz;\ position.y = ((1.0 - position.y) * (7.0 / 12.0) - 1.0) * poolHeight;\

But why does the top face of the cube disappear when I look up from the bottom of the cube ?
What's the trick here ? I just cannot find it.

capture_0
capture_1

Waves: ball: submersed.

Shouldn't their be some effect if the ball moves underwater, especially if close to surface? Regrettably I was unable to find a reference on the subject. Though I think it would be fair to assume for each circular section n perpendicular to the axis of the motion. Causes a compression, positive on the forward and negitive on the aft, of it's area equally in all directions.

Problem running on mobile platforms

The behaviour of the water is different when running on mobile hardware compared to what is seen on desktop h/w.

On desktop, the movement of the water is dampened over time and relatively quickly returns to a smooth surface.

On both ios and android the surface appears to be perturbed by additional velocities which stop the water from ever settling back to a smooth state.

One obvious difference is that the pixel ratio, when run on the desktop h/w, is 1.0 but on the mobile h/w it varies (on the examples I have tried it on) - 2.0 on an iPhone and 2.75 on an Android. Not sure if this is related - but it struck me that the "averaging of neighbour pixels" may be looking "further away" than expected and picking a velocity that is higher than an immediate neighbour - causing the wrong average to be calculated. But that's a wild stab in the dark.

I'm struggling to debug the shaders - to compare the actual calculated values on the different h/w - but I'll continue trying...

Any thoughts/fixes would be appreciated.

Water level

Hi, i try to make a tank level indicator based on your work, do you think it's easy to make water height dynamic (as a parameter)? (0-100% for example)
I need also change cube's width, height, depth (as parameters also)!

Awesome

I'm really awesome by your animation on http://madebyevan.com/webgl-water/
The only detail which I do not get why it is missing, is when the ball is fully immersed in the water and you move it, it is not propagate to the fluid.

Amazing... any documentation?

This is by far one of the best examples that I've found on water/fluids on a container.

We've been struggling to change the container to be a cylinder (to simulate a glass of water) rather than a cube. I see you're using Mesh.cube to accomplish this, but we haven't been able to change it to an actual Cylinder. Any guidance would be greatly appreciated... thanks and congrats on the demo!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.