Search Unity

Beginner's resources for building compute shaders

Discussion in 'Shaders' started by HeliosJack, Jan 14, 2021.

  1. HeliosJack

    HeliosJack

    Joined:
    Aug 15, 2013
    Posts:
    41
    I have a simulation coded with c# jobs that I'm considering porting to a compute shader, but I don't know how to write compute shaders. I have the parallelism problems down, I just need a starting point for how compute shaders are authored.

    but maybe before I go down that route, it makes sense to ask a few questions related to whether or not it would actually be worth doing:

    1. I'm planning on passing this information over to rendering shaders to visualize the data, in the form of an array of floats. can you pass information directly from compute shaders to rendering shaders like that or does it have to be copied to some cpu buffer and then back to the gpu?
    2. Would it be reasonable to copy back an arbitrarily large array of floats back to the cpu for use in game simulation, or will I eventually hit diminishing returns where it would be faster to do it on the cpu because of the time it takes to copy the array?

    and then, yeah, can anyone point me to any good resources to get started
     
    FGPArthurVII likes this.