문제

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