In 2021 I want to really get good with shaders (100% knowledge of GLES 2.0, mastery of all common techniques), make simple examples of all of the kinds of shader effects which are common in games and useful to have easily accessible. I’ll be looking at adapting popular shader examples / tutorials too from people like Minions Art. And I we would all benefit if anyone more knowledgeable contributes to improve shader efficiency.
I’ve done projects like these before but this time I want to go all out and keep it a bit more organized. I’ll bring forward previous examples to this version too over time.
If there are shader effects you want to see examples of please post them in this thread and I’ll try to investigate adding examples for them.
https://www.pkeod.com/shaders/2/ this link will be updated as new versions go live incrementally
These examples will make use of global constants for render predicates. This helps to reduce drawcalls for situations where you want the same effect being applied in a somewhat consistent way to many objects such as with lighting.
I’ll be marking examples with or depending on if I think they are ready for production or not. Though they may be useful in production projects as is, you will most likely want to combine multiple shaders together to be able to have multiple effects. Hopefully this process can be made easier / more clear how to do in the future as well.
World Position Texture Swap
Swaps between two textures based on distance from a point in 3D space. Could be useful for combining with other distance shaders to show a hidden world or hidden enemies (such as fog of war). Or highlighting / replacing parts of objects based on a form of observation / change.
Has hard coded values currently.
I remember someone here making an editor script to compile shaders with another tool to better validate them. Anyone remember where?