Hacker News new | past | comments | ask | show | jobs | submit login

What do you mean? This is GLSL… a light abstraction on top of it anyway, but not a different shading language or breaking compatibility. The goal is just to write the GLSL shaders in JavaScript.



WebGPU uses WGSL, completely different shading language, Rust inspired.

Naturally ThreeJS has to now take care how to provide shaders that work across both backends.


GLSL is pretty bad though. Terrible typing system, terrible inference, terrible archaic requirements. Awful annotations.

Metal and HLSL are more modern. Mostly because Metal started as such and HLSL was updated. Both C++ inspired or even using clang. WGSL has a rust-like syntax but Metal-like semantics and structure.


We are all aware of the differences, that wasn't the point.


> The goal is just to write the GLSL shaders in JavaScript.

I bet the main goal is generating both GLSL and WGSL shaders depending on the 3D backend. Usually shader language transpilation is done through native libraries like SPIRVCross (C++), Tint (C++) or Naga (Rust), but those are too heavy for being included in a three.js webpage and offline compilation probably doesn't quite fit three.js' spirit (or requirements if they need to stamp out a different shader variation based on runtime parameters).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: