News for hackers. Stuff that matters.
Re:Graphtoy by lligallo on Sunday January 03, 2021 @08:25PM (#25627023)
Checkout this video by the author. It makes a full 3d complex scene out of a math formula, with step by step explanation https://youtu.be/8--5LwHRhjk
Re:Graphtoy by AceJohnny2 on Monday January 04, 2021 @03:59AM (#25629035)
Oh, it's Inigo Quilez

He's known as "iq" in Shader circles and is basically a god. He's also the (co?)creator of Shadertoy.com

Re:Graphtoy by devmunchies on Sunday January 03, 2021 @11:13PM (#25627870)
He links to shadertoy[1] with the code. it looks like the code is in C? how is it rendering in the browser?

[1]: https://www.shadertoy.com/view/WsSBzh

Re:Graphtoy by Netcob on Monday January 04, 2021 @05:25AM (#25629555)
You write GLSL, which is a shader language. Specifically, in this case, you write code that determines the color of a pixel given its coordinates (and some other input variables).

On Shadertoy, they use WebGL to create a little rendering pipeline that in the simplest configuration renders two triangles to form a rectangle, using your GLSL code. Since it's WebGL (should be supported by all modern browsers, mobile included), that code is executed directly on your GPU.

In more complex Shadertoy scenarios, you can do multiple passes where you render to different buffers and then use those buffers as textures in other passes. One of the uses of that is keeping state between frames, which would not be possible in a purely shader-based system otherwise. For example, if you have some sort of player character you move around the world, you may use one pixel to store the position, another to store the rotation and so on. Or you can use the image output from the previous frame as the input for the next frame to compute IIR functions, simulate cellular automatons and so on. I think by now you can even render to cube maps and multiple viewports (for VR).

There's even a "sound" shader you can write that is called once and then renders a waveform for one minute and then plays that back while displaying the regular shader.

Re:Graphtoy by detaro on Sunday January 03, 2021 @11:16PM (#25627882)
It's not C, it's GLSL shader language, which is used in the browser through WebGL.
Re:Graphtoy by coldtea on Monday January 04, 2021 @05:04AM (#25629423)
>it looks like the code is in C? how is it rendering in the browser?

Plus, C could be compiled into WASM with emscripten, and be hooked to render on a Canvas or WebGL or something.

Re:Graphtoy by dmix on Sunday January 03, 2021 @10:10PM (#25627580)
Watching this reminds me of trying to use the 'golden ratio' and other mathy formulas in CSS typography and column grids to get "perfect" alignments from scratch. For ex from film: arranging the body to the min(d1, d2) alignment to the head sphere.

But obviously this is on a whole other level of knowledge and complexity.

Re:Graphtoy by tconley on Sunday January 03, 2021 @08:54PM (#25627188)
maybe i should have paid more attention in math class
Re:Graphtoy by Edmond on Sunday January 03, 2021 @09:00PM (#25627216)
not quite the same but if you're into math as art, try desmos:

https://www.desmos.com/calculator/ccoiiocfbw

Re:Graphtoy by rantwasp on Sunday January 03, 2021 @11:07PM (#25627841)