Shader libraries/repositories?

54e97bcc4e4a2fc8f5f05594afd1683a
0
Gnarlyman 101 May 24, 2012 at 22:43

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.

5 Replies

Please log in or register to post a reply.

6837d514b487de395be51432d9cdd078
0
TheNut 179 May 25, 2012 at 00:14

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.

54e97bcc4e4a2fc8f5f05594afd1683a
0
Gnarlyman 101 May 26, 2012 at 03:57

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.

54e97bcc4e4a2fc8f5f05594afd1683a
0
Gnarlyman 101 May 26, 2012 at 04:25

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.

6837d514b487de395be51432d9cdd078
0
TheNut 179 May 26, 2012 at 11:35

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.

46407cc1bdfbd2db4f6e8876d74f990a
0
Kenneth_Gorking 101 May 28, 2012 at 04:01