Creating a multicoloured bokeh shader

Astronaut sprite with multicoloured bokeh shader

Learn how to make a multicoloured bokeh shader, using the GLSL programming language. This tutorial follows on from the last tutorial.

Tint uniforms

First add three new tint uniforms, which can be used to change the colours of the bokeh circles.

Create circles

Next remove this variable from the main function:

And replace it with:

These variables will be used for the different tint coloured circles.

Add circles under each circle variable like below.

Keep adding more until you are happy.

Output colour

Create a new function:

Then remove this code from the main function:

The new function will allow us to tint a group of circles different colours.

Finally you just need to call the new function at the end of the main function.

That’s it! You should now have different coloured bokeh circles.

Conclusion

Thank you for reading this tutorial. Let me know in the comments section if you enjoyed it, or have any questions!

Leave a comment