10
\$\begingroup\$

Could I kindly ask, to suggest me a repository of high quality OpenGL (OpenGL ES 2.0) vertex and fragment shaders, please?

I am looking for pixel based ligting shaders (such as phong) and simmilar. It would be nice to see more of them, to be able to choose between quality vs shader performance.

\$\endgroup\$

6 Answers 6

16
\$\begingroup\$

Shaders of any complexity aren't generally the kind of thing you can download and drop in to your project like interchangeable cogs. Typically the more interesting effects require a fair bit of coupling to the CPU-side rendering subsystem in order to achieve their results. The same is generally true of performance -- performance tradeoffs with respect to accuracy and quality over instruction count or pipelining tend to be rooted in application-specific requirements.

As a result there really isn't much in the way of the kind of repositories you are thinking of. The GPU Gems books offer a good collection of cookbook-style descriptions of techniques with both game and shaded code examples that you may want to take a look at, though. So do the Shader X books.

\$\endgroup\$
4
  • \$\begingroup\$ +1 for very valuable comment. Hi, Josh. Thanks for your response. Well, if a person is in the beginning of shader developement, it woud really help to see how some standard shaders are implemented: For example how Phong (which is very standard algorithm) is performed, pixel lighting shaders, etc.. I understand your point, and the sources you provided sound as a good material. I will take a look at them. So far, the best resources I have found are: OpenGL Shading Language book and the Lighthouse 3D site. \$\endgroup\$ May 14, 2011 at 17:07
  • 2
    \$\begingroup\$ I would therefore still welcome repositories of good quality shaders, illustrating development of interesting effects. The scripts can be used as a basement for combining them and creating new attractive effects. \$\endgroup\$ May 14, 2011 at 18:36
  • \$\begingroup\$ @Bunkai Satori I think Josh meant that as a reason that these sorts of repositories do not exist mostly. \$\endgroup\$ May 15, 2011 at 20:53
  • \$\begingroup\$ @The Communist Duck: Hi, thanks for your comment. I understand that. I am grateful for every response here, and for Josh's one too. However, what came to my mind is, that internet is so large, that maybe somebody other than Josh will remember of seeing some places to get inspired by particular shaders. I can imagine, that a company/indidvidual using shaders a lot, would collect them, and some of them might also publish them. Josh's answer is my candidate for the Accepted Answer anyway, so if no one contributes shortly, I will close this thread my marking his answer. \$\endgroup\$ May 16, 2011 at 13:13
13
\$\begingroup\$

Not much, but at least a couple of basic shaders to get started with can also be found between my open sorce engines files:

the .vsh files contain the vertex shaders and the .fsh files the fragment shaders, but I guess thats selfexplaining...

On current mobile hardware, you should do as much as possible within the vertex shader and the trick for great looking and fast games is to write many very specialized shaders doing always just exactly what is needed to make something look the way it is meant to. At least thats my experience with my iPhone 3GS, which features the same gpu as the iPhone 4 but has less pixels to do deliver data for. This is most probably already much better with tegra 2 and even better with apples A5 chip, but for now, this means that you should not try to port shaders for desktop gpus to mobile phones and expect a great performance :P This also means that fullscreen effects, especially on devices with a high resolution display tend to be slow.

Hope this also helps a bit :).

\$\endgroup\$
2
  • \$\begingroup\$ Hi, welcome to the GDSE. Nice answer! \$\endgroup\$
    – Notabene
    May 16, 2011 at 2:20
  • \$\begingroup\$ +1 for good answer. Hi Slin, and welcome to GDSE. Thank you for this good answer and for the example stuff. I am glad, you shared your experince with shaders programming for mobile platform. At this moment, I do all the development on PC, planning to port later. So your experience will be appreciated then. \$\endgroup\$ May 16, 2011 at 13:16
9
\$\begingroup\$

might snatch some of the arcane knowledge from here http://glslsandbox.com/

\$\endgroup\$
2
  • \$\begingroup\$ Hi UlanB. This collection looks great. Can you please tell me how i can download these shaders. I get a error saying "WebGL not supported" when i try to open any of the shader collection in chrome. Thank you. \$\endgroup\$
    – Vinodtiru
    Dec 6, 2011 at 22:46
  • \$\begingroup\$ Iam sorry, i can't really give you tech-support on webgl compatibility. Probably your Hardware that doesn't support webgl. Also Linux Chrome Builds don't support it yet. \$\endgroup\$
    – UlanB
    Dec 10, 2011 at 10:24
4
\$\begingroup\$

When I was looking how to implement fog under OpenGL ES 2.0, I have found link to OpenGL ES 2.0 backward compatible project implementing functionality, which is not in OpenGL ES 2.0, For example fog, per vertex, per fragment(pixel) shading. You can look directly into shaders source.

I have been implementing per fragment lighting too, modifying this example created by ClockworkCoders (not OpenGL ES 2.0).

You can also take a look on these great tutorials by lighthouse3D

\$\endgroup\$
1
  • \$\begingroup\$ +1 for good comment. Hi Martin, thanks for your links. yeah, I found Lighthouse3D, and it looks like quality resource. \$\endgroup\$ May 14, 2011 at 15:59
1
\$\begingroup\$

The AMD RenderMonkey package contains very advanced shaders for OpenGL ES 2.0 among the sample files.

Take a look especially at the Renderman shader sample in the GLES samples directory, which provides a more-or-less bare-bones OpenGL ES 2.0 shader that might serve as a good starting point. And might also give you a good idea as to why there aren't many cut-and-paste examples of good shaders out there. The basic problem: that shaders are tightly coupled with OpenGL ES server configuration, and the models that get rendered on them. Still. The Renderman shader is an excellent starting point, if you can pry it loose from the REnderMonkey tool.

\$\endgroup\$
1
\$\begingroup\$

Take a look at GPUImage (https://github.com/BradLarson/GPUImage), its probably the most complete collection of shaders I have found on the web so far. Since they are all designed to work with GPUImage, they all share the same structure, so if you adapt the same structure in your application/game you should be able to quickly import a number of different effects.

Cheers!

\$\endgroup\$

Not the answer you're looking for? Browse other questions tagged .