I'm curious if there are libraries/repositories of shaders of all types that other developers have created and shared to the world. And if so, what the best sites are.
Generally it's scattered information, but the closest to a complete set would be the GPU Gems series. nVidia posted the articles online for free. I think you can download the CD for the older books, but I don't remember. You can also take a look at the WPF Shader library for a list of neat ideas and effects.
There's also the shader set I'm working on and posting here on devmaster. It's slowly coming along, but serves as a ground zero place to test and learn shaders via WebGL. Someday it will be a large collection of useful stuff. The next one on depth of field should be posted soon and I'll be working on gamma correction next since someone made a request for it.
Thanks TheNut, really helpful there. Btw, are you the one doing the current series of shader articles, the old film one and shadowmapping ones included? Those have been quite good.
Also, would the shader libraries you mentioned above be easily incorporated into Unity? That's what I'm really starting to get into, commit to, and I'm starting to learn the shader ropes within Unity. I'd like to know how easy it'd be to pop those shaders into Unity.
PS--btw, I'm especially looking for some toon shading. I've been studying Windwaker (Zelda) and am quite curious as to the shader technique they used and the complexity therein.
Yes, I'm the guy behind the shader series.
The shaders you find online will almost never be interoperable as-is. As you may know, shaders are only half the problem. The other half lies in the implementation of the API. Everybody has their own way of doing things and this affects how you integrate shaders into your engine. Some shaders may require multiple passes and special handling, such as with shadow mapping. Render the depth, render the blur, render the scene, etc. Other shaders may require specific information such as tangent, binormal, and normal data for computing tangent-space bump mapping. Skinning shaders will require bone data and bone matrices. So there's a lot of glue code that needs to be done, and that's where the bulk of shader development happens.
Toon shading, also called cel-shading, is a pretty neat result and quite simple to achieve the basics. If you read my shader series article on basics of lighting, you will have read about the Lambert equation for calculating diffuse lighting. Simply put, if you modulate that result to limit the shades of grey to something like 10 values (instead of the normal 256), you produce a coarse gradient that simulates toon lighting. When combined with vibrant textures or colours, it starts to take face. This is of course the basics and some additional work is required if you want to fine-tune it and add outlines. Keep in mind that textures play a large role in cel-shading as well. Take a close look at Windwalker and you will note the environment does not have any lighting. Those are pre-calculated textures designed to give that look. I believe only the characters and interactive objects are cel-shaded. So textures play a big role here. Taking a photograph of bark on a tree and dumping that into your cel-shaded game is not going to look good.