Live data from Hacker News

Web GL Ocean Simulation

david.li

51–60 of 138 posts

Re: Web GL Ocean Simulation

#51
post #35

The 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.

Just to clarify - the bulk of the work here is done in GLSL shaders on the GPU, not with matrices in JavaScript. 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 directl…

>basically using graphics rendering pipeline to do GPGPU without need for OpenCL / CUDA

It would be really cool to see a project that would make that easier to do in JS more generally. Basically a similar idea to Parakeet or Numba, but with GLSL as a target.

Re: Web GL Ocean Simulation

#53
post #42
post #36

Earlier quoted context omitted.

I'm not sure how I'd feel about a repost to jsfiddle without my permission if I were the original author. How is this any different than reposting xkcd or other webcomics on alternate hosting without the author's permission?

because it's code in a browser. if the author didn't want us to look at the code, why would they let us download it?

Because you can see the code does not mean you have the right to distribute it. With your argument you mean it is ok to record music from some music service and post this wherever you like just because it is possible?

Ability to do something does not mean it is ok to do it.

Re: Web GL Ocean Simulation

#55

Earlier quoted context omitted.

"JS is not a great language for linear algebra." what does that even mean? It's a general purpose language. It all boils down to how you want to use it, like any other general purpose language. A lot of times in cases like this, people choose not to make it look pretty and easy to read to gain performance. This simulation is very CPU intensive, trying to have pretty code and speed is going to be tough.

Look into something like Octave, where matrices are first-order data types, and you'll know exactly what he means.

Had a look. Still think JS is fine.

Re: Web GL Ocean Simulation

#56
post #35

Earlier quoted context omitted.

Just to clarify - the bulk of the work here is done in GLSL shaders on the GPU, not with matrices in JavaScript. 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 directl…

>basically using graphics rendering pipeline to do GPGPU without need for OpenCL / CUDA It would be really cool to see a project that would make that easier to do in JS more generally. Basically a similar idea to Parakeet or Numba, but with GLSL as a target.

I think the closest you'll get right now is something like THREE.js that builds shaders for you out of a high level graphics API.

Re: Web GL Ocean Simulation

#57
I remember seeing this run smoothly on a P2 after a very small executable download in late 90's. How far we've come in a big, stupid circle back where we started.

Now instead of a small executable, we need a large executable to sit on top of a large API on top of the CPU before even touching the GPU, and a network connection to download all the dependant APIs and libraries every time the page is loaded.

The only impressive thing about this demo is how many YCombinator readers are impressed with blinkenlights

Re: Web GL Ocean Simulation

#59
post #42

Earlier quoted context omitted.

because it's code in a browser. if the author didn't want us to look at the code, why would they let us download it?

via reductio ad absurdum, do you also think it's alright to reappropriate swaths of CSS, HTML, and images from other people's web designs?

This isn't reappropriation. It's just putting something in public view in another form of public view, for better analysis.

Re: Web GL Ocean Simulation

#60

I remember seeing this run smoothly on a P2 after a very small executable download in late 90's. How far we've come in a big, stupid circle back where we started. Now instead of a small executable, we need a large executable to sit on top of a large API on top of the CPU before even touching the GPU, and a network connection to download all the dependant APIs and libraries every time the page is loaded. The only impr…

I'd venture that the differences these day is that there is no install step and it works on many different systems.
Post reply on HN