[HN Gopher] Show HN: Shadeup - A language that makes WebGPU easier
       ___________________________________________________________________
        
       Show HN: Shadeup - A language that makes WebGPU easier
        
       Author : jrmydev
       Score  : 94 points
       Date   : 2024-01-17 17:13 UTC (5 hours ago)
        
 (HTM) web link (shadeup.dev)
 (TXT) w3m dump (shadeup.dev)
        
       | MattRix wrote:
       | Not sure if this page is rendering only via WebGPU or something,
       | but on iOS this is just a blank page.
        
         | jrmydev wrote:
         | Yeah, unfortunately, the main background is running webgpu so
         | edge/chrome/opera desktop are the only browsers that can see
         | it.
         | 
         | Here's a screenshot of what it should look like:
         | https://i.imgur.com/CBHaftp.jpg
        
           | paranoidxprod wrote:
           | I just checked on Linux Firefox and iOS Firefox and both
           | loaded the background without issues.
        
             | jrmydev wrote:
             | Hmm, that's probably the static picture fallback you're
             | seeing.
             | 
             | Here's a video of what the particles look like when moving
             | if interested: https://www.loom.com/share/c2608492dce44ab4b
             | 84b8fe4c68c44cd?...
        
       | hyperthesis wrote:
       | I like https://github.com/evanw/lightgl.js
       | 
       | learnt from https://jamie-wong.com/2016/08/05/webgl-fluid-
       | simulation/#im...                 the elegant lightgl.js, which
       | is an abstraction layer on top of WebGL that makes it much nicer
       | to work with. Unlike THREE.js, it doesn't make any assumptions
       | about you wanting any concept of a camera or lighting or that
       | you're working in 3D at all.
        
       | stanleykm wrote:
       | This is really cool. As far as boilerplate goes WebGPU is really
       | not that bad (one just needs to look at Vulkan to see how fun it
       | can get) but really anything to lower the barrier to entry is
       | nice.
       | 
       | I am curious about the API overhead here. For example if I run
       | two separate passes using bare WebGPU I could use a single
       | command encoder. Would two function calls here result in two
       | command encoders?
       | 
       | Another question - from the example code this doesnt look
       | asynchronous, does it wait for everything to finish before
       | returning? I could also be misreading the code I dont know
       | typescript very well.
        
         | jrmydev wrote:
         | Thanks, and great question:
         | 
         | Shadeup will try to fit it all into one command encoder but may
         | need to split if the coder: 1. Manually flushes 2.
         | Reads/downloads a buffer on the CPU
         | 
         | Most calls are lazily evaluated, and a small dep graph is built
         | as you reference/draw things.
         | 
         | That being said, shadeup does make some perf sacrifices in the
         | name of simplicity. I'd say it's well suited to prototyping and
         | learning. Of course, once you have a working prototype of
         | something porting it to native wgsl should be easy
        
           | stanleykm wrote:
           | Oh nice thanks for the explanation.
        
           | burntcaramel wrote:
           | Have you thought about having an "eject" command? For
           | example, Create React App had an eject command to go from the
           | self-contained version to a full customisable Webpack app.
        
         | pjmlp wrote:
         | WebGPU main pain point is forcing everyone to rewrite their
         | shaders, no wonder most Web native game engines are going the
         | shading language abstraction route, when only Chrome does
         | WebGPU on desktop, and it isn't even an option on mobile years
         | to come.
         | 
         | Thus cross API WebGL / WebGPU shading middleware is needed.
        
           | adastra22 wrote:
           | wgpu is a nice implementation of webgpu for native rust
           | applications on desktop.
        
             | pjmlp wrote:
             | I don't see a point of that versus middleware engines, with
             | much better tooling.
             | 
             | WebGPU/WebGL are like JavaScript, something that we have to
             | put up with, because on the browser there is no other
             | alternative.
             | 
             | No need to constrain ourselves to the browser limitations
             | when there are other options.
        
               | FL33TW00D wrote:
               | A single code base for both native & web? Not having to
               | write Javascript on the web?
        
           | stanleykm wrote:
           | Reducing boilerplate isnt really trying to solve that
           | problem. Barrier to entry here can also be read as "making
           | shaders less scary for newbies"
        
       | zamadatix wrote:
       | The particles effect on this page is a great example of "old web"
       | feel in a page with "new web" looks in that it's just so fun and
       | impractical solely because it can be.
       | 
       | The "browse" button towards the bottom has a few editable
       | examples as well, including one for the effect seen on the main
       | page https://shadeup.dev/zv5twftezv2y
        
       | TheRoque wrote:
       | Shadeup is also pretty useful for unreal engine. Use of compute
       | shaders is very cryptic in UE5, and shadeup makes it more
       | accessible.
        
         | astlouis44 wrote:
         | My team has built out a WebGPU backend for Unreal Engine 5, for
         | anyone interested!
        
       | Cieric wrote:
       | This is interesting, I'm working on something similar but I'm
       | starting from an existing gpu language and working my way
       | backwards to add more support and allow for efficient cpu side
       | execution. It's more geared as a game engine language to support
       | both the game script (allowing easy parallelization) and the
       | rendering side of things (as it's already a gpu language). Mine
       | is currently more geared towards vulkan though.
       | 
       | Looking through the examples on your website does give me some
       | ideas though, I might try and adopt some of them myself.
        
         | jrmydev wrote:
         | Your project sounds interesting as well. Do you have a social
         | channel or GitHub for this project? Or is there something I can
         | follow to be updated when you release it?
         | 
         | I'd love to learn more about what you're working on as I've
         | been wanting to integrate shadeup with existing game engines
         | like unreal/unity but realizing it would be a massive
         | undertaking.
        
           | astlouis44 wrote:
           | My startup has been working on WebGPU support for Unreal
           | Engine 5 for the past several years, and we've already
           | achieved multiple demos that will be going live relatively
           | soon.
        
             | jrmydev wrote:
             | Drop a link! I'd be interested to check it out
        
           | Cieric wrote:
           | I will warn that it's mostly been rewritten at this point,
           | but most changes haven't made it to the repo due to being
           | held up by my current employer's legal team. Most of the code
           | is also poorly written due to it mostly being written during
           | half asleep/burned out state. With all the "don't judge me to
           | hard"'s out of the way, https://gitlab.com/Cieric/gellang
           | 
           | I don't currently have plans to integrate with an existing
           | game engine, just my own. I have however considered in the
           | past integrating with Godot, so that would be my first target
           | if I do ever attempt it.
           | 
           | I also was assuming no one would use my project
           | professionally so the idea was to be a superset of glsl so
           | any glsl code could be pasted into a script and be compiled
           | without any modifications. That would aid in debugging gpu
           | code in an actual debugger without needing to rewrite it.
           | 
           | Once all the paper work is finished additional updates should
           | start rolling out again since it would just be reviewing the
           | new changes not everything again. Hope your expectations are
           | in line, I'm not trying to under or over sell my project. I
           | was just wanted to fix my own gripes with the projects of the
           | time.
        
       | matmulbro wrote:
       | webgpu hype is pretty cringe,even if you want to run in a browser
       | (and most customers don't) most game engines can still bake
       | WebAssembly/WebGPU packages.
        
       ___________________________________________________________________
       (page generated 2024-01-17 23:00 UTC)