Quantcast
Channel: Questions in topic: "shader programming"
Viewing all articles
Browse latest Browse all 169

Set a single float in a FloatArray on a shader

$
0
0
In shader code I have a float array: float _X[250]; Doing this in a script then works fine: material.SetFloatArray("_X", x); However, for each update I only want to change a single value of the array. I tried doing this: material.SetFloat("_X[" + i.ToString() + "]", x[i]); but that naturally didn't work. Is there any work around? It seems silly to have to transfer a full array every frame if only one value changes, but I can't see any other way at the moment. Thank you.

Viewing all articles
Browse latest Browse all 169

Trending Articles



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