質問

I'm diving into CG shaders. I'm baking a vertex shader that needs one random constant (computed just once at start time). I know that in Unity it's pretty easy to pass a value from a script to the shader, but I'd like to know if there is any way to have the shader create this random constant for me. Searching for this didn't help me that much so far. So thanks for any help!

Steak

役に立ちましたか?

解決

not really. You can use some other parameter (like time, or x location for the model) and run frac() or something to get a cgheesy random value, but no direct way in the shader (that's remotely efficient).

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top