Search Unity

Fun with compute shaders - asteroids entirely on gpu

Discussion in 'Shaders' started by hrgchris, Aug 26, 2018.

  1. hrgchris

    hrgchris

    Joined:
    Oct 26, 2016
    Posts:
    19
    Hey

    If anybody is looking for some example code in compute, I recently put online the 2nd in my 'making asteroids entirely on comptue shaders' series. Whilst a bit silly, it has some fun examples of advanced use of compute shaders, including procedural rendering and indirect dispatch:

    https://shaderfun.com/2018/08/09/shaderoids-1/

    Enjoy :)
     
    Cherubim79, Namey5, bgolus and 2 others like this.
  2. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Love it!

    Doing sound from GPU code made me laugh too, you're a nutter, but I just have to follow your work now.
     
  3. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,352
    Bah, that's not doing sound from the GPU, this is doing sound from the GPU!
    https://www.shadertoy.com/view/XtlSD7

    That uses the GPU to write out the waveform data into a texture, which is read back to the CPU and passed to the sound device. There are no audio files used. It'd be closer to how the original arcade did the audio too if you have to write it out by hand, though in that case the sounds were hand-wired into the cabinet.
     
    hippocoder likes this.