3 Color gradient Shader

Hi I am new to cocos creator. I am trying to put a color gradient on a sprite but unable to do so. After searching a lot, all I understand is I have to write a shader for it and I do not have experience in shader programming. Can you please guide me on how to implement it in cocos creator. Is there any build in functionality as I was able to find cc.Gradient and cc.GradientRange but there is no example of it. I just need to apply the gradient on my sprite.
Any example or links would be very helpful.

1 Like

I am also looking for the same. If someone more experienced in cocos creator were to help on this matter, it would be very helpful for many of us new comers.
Gradient is one of the most used feature in minimalist looking games.
@slackmoehrle, Please help us out on this.

@jare can you ask a team member to read this topic, please.

Guys any update on this? I hope you understand that a gradient is one of the most common feature in a game. Any link or tutorial will be helpful.

You should look into using a texture that you create from your gradient parameters.

When dealing with a true gradient shader, it’s not particularly easy because shaders work on a per vertex + per pixel level. So things like rotation and direction become very difficult to manager, if not ‘impossible’ since you would need a sine/cosine/tangent equation for every possible 360degree angle.

This is “theory” advice and the implementation will be up to you, take a look at this Q&A - https://stackoverflow.com/questions/61862262/webgl-shader-for-directional-linear-gradient