2
b2plane
1y

I cant believe threejs requires me to write a c++ code so i can use 3d webgl objects in javascript

Comments
  • 0
    It does? How will this be delivered to a browser?
  • 0
    @possum no idea theres a clusterfuck of stuff going on behind the scenes and surprisingly all of those 3d models even the heaviest ones are extremely performant and smooth. I dont get any lags or glitches. And all of it is ran via javascript because its compiled first in c++ using let me check.... The ".glsl" file extension (opengl shading language)
  • 8
    @b2plane unless I’m misunderstanding you’re not writing c++ you’re just writing a language that looks like it. GLSL is compiled to instructions the GPU can understand when it’s loaded by whatever graphics library you’re using
  • 2
    @SalsaGal you are correct! Shader languages all look like C/C++.
    See real time rendering https://en.m.wikipedia.org/wiki/...

    GLSL is used
    https://threejs.org/docs/...
  • 2
    @hjk101 Not all of them! I use WGSL which is similar in syntax to Rust :)
  • 1
    @SalsaGal sorry wanted to put almost all. Assembly is also still a thing (that is the difference between High level)
  • 0
    @hjk101 Using assembly for it would lose a lot of the portability though, I think the lowest you can go while still leaving it up to the libraries to AOT compile is SPIR-V
  • 1
    @SalsaGal WGSL is the shit. I love it.
    However since it's rather new still, the only complete Documentation is the full WGSL Spec sheet. It is well done tho 👌
    Use it for the shading in a video game, i'm working on.

    @b2plane i dont see, how writing a lil HLSL/GLSL is so bad, considering you already work with js.
  • 1
    @thebiochemic Oo in rust too? I’d love to check it out
  • 1
    If GLSL for you is C++ what is JS in that case? Java ? 😂
  • 1
    @SalsaGal yeah, written with bevy. I'm just toying around with ideas. However i like the results so far 👌
Add Comment