Pergunta

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

Foi útil?

Solução

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).

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top