Unity shader stories - 3 colour gradient

Описание к видео Unity shader stories - 3 colour gradient

When two colours just don't cut it, we present here a 3-colour gradient shader for Unity. Not only can you set the three colours, but the location of the middle colours is moveable!

Like with the 2-colour gradient we can use the UV coordinates of the quad to process the gradient. However, we cannot assign colours to vertices, instead we utilize the fragment shader to create our logic.

After implementing the basic logic with an if/else statement for the two parts of the gradient we show how this could be modified to remove the branching element to show the sort of techniques used in GPU shaders optimisations.

Full code is available on GitHub: https://github.com/Firnox/ShaderStori...

Contents:
0:00 Introduction and setup
00:48 Shader code
04:26 Optimisation

Комментарии

Информация по комментариям в разработке