Learn to Write Unity Compute Shaders

Learn to Write Unity Compute Shaders. How to use StructuredBuffers to share data between a ComputeShader and an instancing Surface Shader.

You will Learn

  • Introduction
    7 lectures • 33min
    Contacting H3D
  • 00:01
  • Welcome to the course
  • Your first compute shader
    Reviewing your first compute shader
    Multiple Kernels
    Challenge: Use a compute shader to draw a single square in the middle of a Quad
    What have you learned?
    4 questions
  • First Steps
    6 lectures • 49min
    Passing data to the shader
    The joy of buffers
    Orbiting stars
    Using noise in the shader
    Mesh deformation
    Challenge: Draw a polygon filled with noise.
    What have you learned?
    5 questions
  • Post Processing
    8 lectures • 1hr 10min
    Setting up the rendering pipeline
    A simple blur effect
  • Night vision lenses
    A HUD overlay – part 1
    A HUD overlay – part 2
    A star glow effect: vertex-fragment shaders – part 1
    A star glow effect: vertex-fragment shaders – part 2
    Challenge: Create a sepia effect to the renderer output
    What have you learned?
    6 questions
  • Particle Effects and Flocking
    6 lectures • 50min
    Setting up a buffer-based particle effect
    Adding a mesh to each particle
  • A simple flocking example
    Using instanced meshes in the flock
    Using a skinned mesh in the flock
    Challenge: Swish that tail
    What have you learned?
    5 questions
  • Physics on the GPU
    7 lectures • 57min
    Starting simple, bouncing balls
    A bit of theory
    Initializing the data
    GPU Physics Compute Shader – part 1
    GPU Physics Compute Shader – part 2
    Voxelization of a mesh
    Challenge: tumbling chess pieces
    What have you learned?
    5 questions
  • Grass
    6 lectures • 43min
    Using Blender to create a single grass clump
    Using instancing to cover a surface with grass
    Bending blades of grass
    Grass on an uneven surface
    Trampling the grass
    Challenge: Use noise to bend grass clumps
    What have you learned?
    5 questions
  • Fluids
    6 lectures • 44min
    Navier-Stokes: the famous basis for fluids simulations
    StableFluids – part 2
    Smoothed Particle Hydrodynamics
    Position Based Dynamics
    Challenge: Smoke using StableFluids
    What have you learned?
    6 questions
  • Conclusion

By learning to create Compute Shaders, you will put yourself at the cutting edge of Unity development. Unlike a traditional shader, you can use a Compute Shader to handle any data manipulation problem, where having dozens (or even hundreds) of threads running simultaneously causing a bottleneck in your game to run many, many times faster. In this course you will start from small steps, learning the basics of compute shaders. First, we look at passing data from the CPU to the GPU using buffers. Then we’ll look at using these buffers in our calculations. Once you have this initial grounding, you learn how to use these techniques to create blisteringly-fast post-processing filters. You can use Compute Shaders to handle particle effects and flocking calculations. In the course, you’ll create a flock of thousands of birds where each bird flaps its wings in sync with its speed through the air. Divide and conquer is the way, with Compute Shaders. By using hundreds of threads running simultaneously, we develop a GPU Physics engine that can handle thousands of tumbling chess pieces. Compute Shaders are ideal for handling the orientation of grass blades as an avatar moves through grass. The challenging subject of fluids (both 2D and 3D) are covered in the course and you’ll see how much this computationally-intensive field benefits from Compute Shaders.

The resources for the course are presented as a code-along version and a complete version and include over 30 different examples. Unity Compute Shaders provides the ideal platform to learn how to handle complex problems in your games. Flocking calculations using the 3 key rules of Separation, Cohesion, and Alignment are covered in detail. The physics calculations to handle fast collision detection and the forces involved are included (both theoretically and practically). Smoothed Particle Hydrodynamics is a technique for calculating fluid simulations. We’ll take you through it from the foundation level.

If you’re working with Unity, you need to understand how to use Compute Shaders to ensure your game has the best performance. After all, why let the GPU sit idle while the CPU is working overtime? You’ll see massive performance improvements if you switch some tasks to the GPU and handle them with a Compute Shader.

This course uses Unity 2019.4 and is Windows and Mac compatible.

Student feedback

This course is simply amazing. I always wanted to learn those topics and finally got some incredible resources. Thank you a lot. Btw I loved the didactic. The default scenes and challenges are really helping me to stick with the course without getting frustrated. The topics covered are very difficult but you made it in a way where we can really get step by step and at the same time seeing incredible things on screen!”
“This course is an intensive, well explained, understanding on how compute shaders work, impressive results and explanations
Amazing course – followed up Penny De Byls CG Shader course with this one and they dovetail excellently. Nicholas does a great job with some interesting projects and great concepts – loved the section on fluid simulation.”
“I have just started the Compute Shaders course from Holistic 3D. Loving the course, and I am finding it super easy to understand! Been looking for a decent tutorial for ages, and this is definitely the one I have been looking for!”
Great tutorial, knowledge is condensed and easy to acquire. I always wanted to learn programming shaders and GPU computing, so this course is something that fits my needs perfectly!”
“This course excels at filling in the blanks from my self-taught knowledge and understanding of compute shaders. The explanations are concise yet full, all the while aiding the connection of the basics to form a solid foundation!”

What others are saying about Nik’s courses:

  • Very rich content and impressive didactics. Very good to learn from someone who has mastered the subject and knows how to teach.
  • Nik’s style of teaching made me understand everything very intuitively and I’m so comfortable with shaders now.
  • I like Nik’s courses, I understand in the way he explains. Great content.

Who this course is for:

  • Developers wanting to add compute shaders to their skill set
  • Developers who wish to use the GPU to avoid processing bottle necks on games
  • Developers curious to know modern techniques for flocking, gpu physics, grass, ray tracing and fluids
Share Post

Leave a Comment