Web GL Ocean Simulation
31–40 of 138 posts
Re: Web GL Ocean Simulation
#32Re: Web GL Ocean Simulation
#33The code is quite cool to look at. Love seeing the extensive use of matrices and mathematics to create such a beautiful and mesmerizing display. If anyone is interested in playing around with it, I threw it up at JSFiddle here: http://jsfiddle.net/zyAzg/ Excellent demo.
I wonder if it was all handwritten. Esp. functions like invertMatrix or premultiplyMatrix. Or what he used to generate the code. I once used WolframAlpha to get me some complicated formulas and wrote a custom WA-plaintext-output-to-C translator for that output to use it in my code. Here is the script: https://github.com/albertz/helpers/blob/master/wolframalpha_... Example input: http://www.wolframalpha.com/input/?i=s…
For example, in your case you are solving Ax=b which you can easily solve by a simple LU decomposition. Plus if your A changes, your exact formula is wrong, so using an LU decomposition just makes sense. Plus your code will look way cleaner as well. And way easier to debug.
Re: Web GL Ocean Simulation
#34This runs at about 7 frames per second in Chrome on my 10-month-old 13" Macbook Pro at work. Are people with better graphics cards seeing 60 (or even 30) fps? I'd love to be able to see this in all its glory.
Re: Web GL Ocean Simulation
#35The code is quite cool to look at. Love seeing the extensive use of matrices and mathematics to create such a beautiful and mesmerizing display. If anyone is interested in playing around with it, I threw it up at JSFiddle here: http://jsfiddle.net/zyAzg/ Excellent demo.
All that matrix code you see in the source here is basically just the minimum prerequisite for doing 3D graphics, it would be the same if you just wanted to get a spinning cube with some camera control.
The real magic happens in the shaders which compute water mesh displacement, normals and shading directly on the GPU (21 simulation passes + 1 rendering pass + 1 initialization pass, using several floating point textures, seems like stateful simulation with ping-ponging, basically using graphics rendering pipeline to do GPGPU without a need for OpenCL / CUDA).
Re: Web GL Ocean Simulation
#36The code is quite cool to look at. Love seeing the extensive use of matrices and mathematics to create such a beautiful and mesmerizing display. If anyone is interested in playing around with it, I threw it up at JSFiddle here: http://jsfiddle.net/zyAzg/ Excellent demo.
Re: Web GL Ocean Simulation
#37The code is quite cool to look at. Love seeing the extensive use of matrices and mathematics to create such a beautiful and mesmerizing display. If anyone is interested in playing around with it, I threw it up at JSFiddle here: http://jsfiddle.net/zyAzg/ Excellent demo.
How do you know the author is ok with that?
Re: Web GL Ocean Simulation
#38Earlier quoted context omitted.
I wonder if it was all handwritten. Esp. functions like invertMatrix or premultiplyMatrix. Or what he used to generate the code. I once used WolframAlpha to get me some complicated formulas and wrote a custom WA-plaintext-output-to-C translator for that output to use it in my code. Here is the script: https://github.com/albertz/helpers/blob/master/wolframalpha_... Example input: http://www.wolframalpha.com/input/?i=s…
It's worth pointing out that you should rarely, if ever, use exact formulas since there are a lot of problems with numerical stability amongst other things. Often it is faster to just numerically solve the system. For example, in your case you are solving Ax=b which you can easily solve by a simple LU decomposition. Plus if your A changes, your exact formula is wrong, so using an LU decomposition just makes sense. Pl…
Re: Web GL Ocean Simulation
#39> Your browser does not appear to support the required technologies. It would've been nice to have an 'I don't care, proceed anyway' button. The check excludes Safari 7, which runs the demo just as well as Chrome. http://jsfiddle.net/bYHfh ^ removes the hasWebGLSupport() invocation. Very nice demo, though!
Re: Web GL Ocean Simulation
#40This runs at about 7 frames per second in Chrome on my 10-month-old 13" Macbook Pro at work. Are people with better graphics cards seeing 60 (or even 30) fps? I'd love to be able to see this in all its glory.