- Home /
fading alpha renderer.a vs shader performance
Hey guys,
Just a quick performance question i was interested in. Whenever i've had to fade objects in and out i've always done a modification of the renderer property by assigning a new Color to it over time in a while loop (coroutine). What i was wondering is if it has a big performance hit if done to several objects on screen? I've done some testing on iPad 2/3 and some Android devices and it seems fine.
Would it be better if i had a shader handle the alpha value for me? And just pass in a new value to the shader over time?
The shader is handing the alpha value. That's what you're doing when you change renderer.material.color.
Answer by rutter · Mar 27, 2012 at 11:07 PM
It's possible that you could make those operations faster, but I don't anticipate this would be considered a "low-hanging fruit" when it comes to optimizing performance. There are probably other issues you can improve more easily.
Gotcha, thanks. Would it still be a negligible optimisation for mobile devices?
$$anonymous$$obile in general does have less juice to go around, but in my experience setting color params is still pretty quick. If you're more or less familiar with shaders, it might be worth checking out, but otherwise I probably spend some time testing whether it's a problem (say, remove the color calls and check how your performance changes).
Your answer
Follow this Question
Related Questions
How to set alpha for object "hidden" by another? 0 Answers
Cutout Shader getting Opaque when turning alpha off and on again 1 Answer
Shader alpha channel goes unused, whats wrong here? 2 Answers
Shader alpha depth problem? 1 Answer
Why is only the last Material in the Materials array on a Mesh Renderer used? 2 Answers