Search Unity

Replace RenderTexture by Buffer for a computeShader

Discussion in 'Shaders' started by Louis_cortes, Dec 2, 2019.

  1. Louis_cortes

    Louis_cortes

    Joined:
    Jan 11, 2018
    Posts:
    9
    Hello,

    I m doing some compute shaders that using Texture2D and RWTexture2D that are iterate by a csharp script that alternate a SetTexture and a Dispatch each frame on a set of two texture or more..

    This works pretty well for making comprotement that's increment theirself, but I a get the problem when a want to pass value highter than 1. in the texture.

    That why I try to pass to proper buffer, but after searching I while I still don't get how to set a texture like buffer for them.

    I ask hear,if someone know how to simply do that.
     
  2. Olmi

    Olmi

    Joined:
    Nov 29, 2012
    Posts:
    1,553
    Float textures can store higher values too, they shouldn't be clamped to 0-1 range unless I've somehow forgotten something... Just use some signed float format to get the negative values too.
    If you decide to use Compute Buffers, they are one dimensional. so you have to index your 2D data to the 1D buffer. You can find easily those math things from web.