3 ms·
Faking Shaders III: Tixyland
- CppPro 2y agoHow do you fake a shader? What does that mean?
- __m 2y agoYou simulate them running in the browser instead of a GPU
- ImHereToVote 2y agoYou mean the CPU right? Browsers can send commands to the GPU too.
- deleted 2y ago[deleted]
- calibas 2y agoIt's an HTML canvas, but you can give it input similar to a shading language?
- Lerc 2y agoSuggestion 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.
- Lerc 2y agoMaybe 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#Zy5kaW09NjQ7bGV0IG1haW49KHt0LHgseX0sbyk9PiB7CmNvbnN0IHttaW4sbWF4LHJvdW5kfT1NYXRoCmxldCBjbGFtcD1hPT5taW4obWF4KGEsMCksMSkKbGV0IHNzPSh2LGE9MCxiPTEsdz12KnYqdioodioodio2LTE1KSsxMCkpPT4oMS4wLXcpKmErKHcqYik7IApsZXQgdT0yKngtMSx2PTEtMip5LHo9c3FydCh1KnUrdip2KQpsZXQgbT0oMioqKCgyKnkpKzYpKQpsZXQgVj0gIAogICAgcm91bmQoeikqKHYqcm91bmQoeSkKICsgIGNsYW1wKCAoeCptXnYqbSkgL20vMiApICogcm91bmQoMSAtIHkpKQogKyAoMSAtIGNsYW1wKHJvdW5kKHopKSkgKiAoMSAtIHNzKHopICsgc3MoeCAqICgxIC0geSkgKiAtMS4wMDkpKTsKCm8ucj1jbGFtcCgtVikKby5nPTAKby5iPWNsYW1wKFYpCn0= https://garten.salat.dev/fake-shaders3.html#Zy5kaW09NjQ7bGV0...
- eddyflux 2y agowow that's cool