Quantcast
Channel: Questions in topic: "compute shader"
Viewing all articles
Browse latest Browse all 287

getting texture from shader into c# script. Also: best way to get values from GPU to CPU?

$
0
0
Dear unity community as I am pretty new to unity I would be happy for some guidance into the right direction. I use a shader to modify an image sequence in runtime. This shader is applied as a texture to a material. Now I need to access the color values of this texture in a c# script. my first practical question would be: How do I get the texture from my shader into my c# script? From what I know I could use .GetPixel from there. Since I am aware of the fact that getting these values from the gpu to the cpu is always a bottleneck, I was wondering whether there is a best practice to do this? I was thinking about passing the texture to a compute shader and fill a RWStructuredBuffer there and somehow getting the data back from there? Would that be faster?

Viewing all articles
Browse latest Browse all 287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>