Jump to content
Search In
  • More options...
Find results that contain...
Find results in...




Leadwerks 4 is one of the best purchases I've ever made. I've spent thousands of hours on it and most of that time has been spent dinking around with shaders. I'm not great at modeling and animation. I'm ok with scripts. What seems to draw me the most is shaders. I love shaders. I guess in some way here I just want a place to show off my accomplishments, but I also want to feel like I benefit other people, so my philosophy here is that it's cool to be one guy who can write shaders, but it's cooler to be one guy who can help several other guys write shaders. So I had this idea that I would attempt to make one shader a week for a year - fifty-two of them - and then post them in the community. So that's what this blog will be. And who knows maybe I'll keep going.

In the process of writing these I've scoured the internet and tried to keep track of any sources for those who might want to investigate some principle further. Many of these sources are tutorials and such. I numbered the shaders roughly with the intent to order them from basic to more complex principles. I commented sections in the shaders to help make them a bit easier to read and understand, and I tried to keep the language consistent from one shader to the next so that it can easily be seen how different parts are used in various effects. Apart from a few post-effect shaders, I start with a "noobalyzed" version of the Leadwerks "diffuse + normal + specular" shader as a base and start every shader from there - with all that I still consider myself a noob as far as coders go - hence "noob shaders."

So if you're also a shader noob then follow this blog, grab the shaders, read the information from the links, tweak the numbers, dink around, and eventually it will start to click together. At the least you'll have a nice little stash of shaders.

Ok so let me start with a few preliminaries. I want to bunch them up together and get them out of the way. First off, the base shader which I consider the "bare bones" shader. It is a "noobalyzed" version of the Leadwerks "diffuse + normal + specular" shader.




Here's a few quick effects I picked up from various places. It's not very useful, perhaps, but it's a good start on manipulating variables to create effects.


01_quick effects.zip

And here are a few post-effect shaders. The contrast, desaturation, and gamma correct are all found in the quick effects shader. You can see that all these shaders look extremely similar. The effects are the only difference. In some sense all that matters is what you set in your output line (out vec4 fragData0). Simplistically speaking, that's the way shaders are. They're all pretty much the same. It's the stuff you add that makes them interesting.

Edit: forgot to add shader 2. Texture scroll:


02_texture scroll.zip


Possibly the worst contrast ever. But hey maybe you want that:




Desaturate dulls the colors toward grey:




Saturation intensifies the colors:




Gamma correct is the way the light "is supposed to look":


06_gamma correct.zip


Color bleed is the idea that colors ought to bleach out a bit in direct light:


07_color bleed.zip


Sobel because why not:


08_sobel filter.zip


Next: Fresnel and Blinn-Phong...

  • Like 6
  • Thanks 1

1 Comment

Recommended Comments

This looks very exciting.
Every finished game should have some sort of combination of post effect shaders, because these add just something to the game.
Really looking forward for 52 shaders !

  • Like 1
Link to comment
Add a comment...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.


×   Your previous content has been restored.   Clear editor


  • Create New...