NHacker Next
  • new
  • past
  • show
  • ask
  • show
  • jobs
  • submit
Faking Shaders III: Tixyland (garten.salat.dev)
Lerc 5 days ago [-]
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.
Lerc 5 days ago [-]
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...

CppPro 5 days ago [-]
How do you fake a shader? What does that mean?
__m 5 days ago [-]
You simulate them running in the browser instead of a GPU
ImHereToVote 5 days ago [-]
You mean the CPU right? Browsers can send commands to the GPU too.
5 days ago [-]
calibas 5 days ago [-]
It's an HTML canvas, but you can give it input similar to a shading language?
Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact
Rendered at 16:33:28 GMT+0000 (Coordinated Universal Time) with Vercel.