Search Unity

  1. The 2022.1 beta is now available for testing. To find out what's new, have a look at our 2022.1 beta blog post.
    Dismiss Notice

Tutorial to start with COMPUTE SHADERS!

Discussion in 'Shaders' started by amirivala, Oct 18, 2017.

  1. amirivala

    amirivala

    Joined:
    May 29, 2013
    Posts:
    56
    Hey all,
    I was looking for some good resources and tutorials for compute shaders but they were hard to find.
    Do you guys know any good book or any reference that I can learn more about compute shader.

    I would appreciate a lot your help.

    Thanks.
     
  2. arkogelul

    arkogelul

    Joined:
    Nov 14, 2016
    Posts:
    104
  3. Steve-Tack

    Steve-Tack

    Joined:
    Mar 12, 2013
    Posts:
    1,240
    BrainSlugs83 and ikv007s like this.
  4. Quatum1000

    Quatum1000

    Joined:
    Oct 5, 2014
    Posts:
    876
    deus0 and ikv007s like this.
  5. JonRurka

    JonRurka

    Joined:
    Nov 19, 2012
    Posts:
    34
  6. Zolden

    Zolden

    Joined:
    May 9, 2014
    Posts:
    124
    These are ok:

     
    deus0, Quatum1000, SparrowGS and 4 others like this.
  7. Val-B

    Val-B

    Joined:
    Mar 10, 2015
    Posts:
    13
    Hi!

    (I just found this on the third page of a google research: http://unitylist.com/r/d17/tuto-compute-shader )


    Well, for me, I red the attached word tutorials once I got the basics. They are quiet nicely explained, for I'm no shader pro at the moment.
    Mind that they come from an older Unity version tho.
     

    Attached Files:

  8. Zolden

    Zolden

    Joined:
    May 9, 2014
    Posts:
    124
    I wrote two tutorials about compute shaders. Each one has link to example project.

    Here's easy one, about drawing a Mandelbrot fractal in GPU.

    And here's complex one, about physics simulation on GPU.

    Gif from the example project of the second tutorial.
     
  9. Quatum1000

    Quatum1000

    Joined:
    Oct 5, 2014
    Posts:
    876
    A compute shader can draw pixel wise. That means, you can draw eg. an specified area out of a render texture into another texture.

    + The shader requires to be initialize with a simple call from c# before it can run the first time. (init address and variables)
    + You can compare the working behavior of a compute shader with for loop in c#.
    + It's possible to jump (after initializing) to a specified marker or address inside of the shader from c#. Means, you can call parts of a compute shader like a function in c#
    + The shader runs one time until you call it again. Means, it does not run permanently like a surf/frag shader and you have the complete control when it should run.

    That's the ruff basics about.
    Did I miss anything?
     
    Last edited: Jan 25, 2021
  10. mohamedsuhail

    mohamedsuhail

    Joined:
    Sep 24, 2015
    Posts:
    1
    Hi!

    Adding a recent reference that was helpful in my case,
    .

    Best
    Mo
     
    DanjelRicci and deus0 like this.
unityunity