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

Introduction


havenphillip

165 views

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.

base.thumb.jpg.e3669f2ca0ffc66695425862fae62865.jpg

00_base.zip

 

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.


base2.thumb.jpg.90d8707060530b1acf35e2cb572c5794.jpg

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:

1738601701_texturescroll.thumb.jpg.f69c6a44f828eed894541e47eeaf30c2.jpg

02_texture scroll.zip

 

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

contrast.thumb.jpg.5224dcf0726ff60a4bd18bf2b9238e63.jpg

03_contrast.zip

 

Desaturate dulls the colors toward grey:

desaturation.thumb.jpg.f9147351a2384d7d9252c30281851204.jpg

04_desaturation.zip

 

Saturation intensifies the colors:

saturation.thumb.jpg.8b538ff4ebe8048808469ca07f42ebb6.jpg

05_saturation.zip

 

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

905201354_gammacorrect.thumb.jpg.79bd2b5faa13259c9bfe3a53abd45400.jpg

06_gamma correct.zip

 

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

1558654557_colorbleed.thumb.jpg.c8a4af52bc907aaf6c69c50cef24c206.jpg

07_color bleed.zip

 

Sobel because why not:

sobel.thumb.jpg.9a0b8b50886b73eea95e0c49a31ec487.jpg

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
Guest
Add a comment...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...