News for hackers. Stuff that matters.
Re:Faking Shaders III: Tixyland by CppPro on Monday November 18, 2024 @10:29AM (#42173249)
How do you fake a shader? What does that mean?
Re:Faking Shaders III: Tixyland by __m on Monday November 18, 2024 @10:32AM (#42173276)
You simulate them running in the browser instead of a GPU
Re:Faking Shaders III: Tixyland by ImHereToVote on Monday November 18, 2024 @10:57AM (#42173593)
You mean the CPU right? Browsers can send commands to the GPU too.
Re:Faking Shaders III: Tixyland by calibas on Monday November 18, 2024 @11:03AM (#42173674)
It's an HTML canvas, but you can give it input similar to a shading language?
Re:Faking Shaders III: Tixyland by Lerc on Monday November 18, 2024 @12:08PM (#42174431)
Suggestion

change the line

    `${lib};const {sin,cos,tan,random,PI,sqrt,hypot,atan,atan2} = Math; ${code}; return main;`
to

    `${lib};const {${Object.getOwnPropertyNames(Math)}} = Math; ${code}; return main;

To bring in all of Math into context without having to list them all individually.
Re:Faking Shaders III: Tixyland by Lerc on Monday November 18, 2024 @06:13PM (#42178208)
Maybe also adding smoothstep and clamp as traditional shader building blocks functions.

You can still define them in inline with not too many characters though so maybe it's ok.

https://garten.salat.dev/fake-shaders3.html#Zy5kaW09NjQ7bGV0...

Re:Faking Shaders III: Tixyland by eddyflux on Friday November 29, 2024 @03:48AM (#42272235)
wow that's cool