Hey all. I’ve been learning GLSL, and I want to know how to use it in real-world applications, specifically games.
Now I’ve noticed that top-notch games such as the new Legend of Zelda’s or Skyrim use some crazy screen-effects and other types of use for shaders.
My question is… how can I implement GLSL to provide the same type of effects and possibly invent new ones?
The only kinds of tutorials I’ve come across are ones that teach toon shading or simple light + texturing.
I do have the OpenGL SuperBible which covers shading, and explains a screen-blur effect; and this is the kind of thing I’m talking about. It uses PBO’s to store textures and uses the shader to blend different PBO’s to return a blurred-like result.
Also I’ve been trying to figure out how to do parallax occlusion shaders, where you need to send a bump-map of a texture to the shader, then based on the values of the map, it will reposition the vertex in question. However, the implementation I made of this did not quite turn out correct.
Other shading I’m looking to learn about includes: Bloom, Ripple effects/Splash Effects for simulating water, and other cool effects used in modern games.
If you can post any information or suggestions regarding the material described above, that would be greatly appreciated.
P.S. I’m also looking to tutorials. If you come across any good ones, let me know.
There are loads of post-processing effects implemented out there using GLSL and even articles explaining them. You should just do a google search and you should find hundreds. Besides that, read articles and presentations from ealier tech conferences. They always have some post-processing stuff there.
However, I feel you have to do a bit more research about shaders and OpenGL in general as I see you’ve misunderstood quite some stuff:
You cannot really use PBOs for post-processing effects (at least you shouldn’t) and I’m pretty sure the OpenGL SuperBible doesn’t do so either. PBOs (i.e. pixel buffer objects) are for texture uploads and downloads. The things you’ll going to need for post-processing effects is FBOs (i.e. framebuffer objects), textures and fragment shaders.
That’s also not true. Parallax occlusion mapping doesn’t change the position of the vertices, that’s displacement mapping. Parallax occlusion mapping (POM) just tries to simulate something like that by performing ray casts in the fragment shader. Also, POM is not a post-processing effect, it is a material effect that is more a lighting related thing. Also, I would suggest you to first try implementing simple bump mapping then parallax mapping (not the same as POM) and then move towards more complicated techniques.
Bloom is not that big of a deal, you just have to use some blurring filter and then combine the blurred image with the original one appropriately. Again, there are lots of material out there about it.
Ripple effects and water simulation is again something that is usually not done as post-processing.
Well… clearly I do not understand as much about GLSL as I thought. :eek:
Just to clarify what I mentioned about using PBO’s for blurring… This is not a pos-process. The shader is given several textures and then blends them. This does not result as a full screen effect, but rather something I can use to draw on top of geometry as a new texture.
Anyways, thanks for the reply. I suppose I’ll do more research, and start getting my facts straight.
By the way, would you reccomend the GLSL - Orange book?
Would that book provide a good foundation into GLSL, so I can start reaching the cool effects I described above?
What you’ve described is roughly the definition of a post-process effect. You have one or more input textures and perform some operations on them to generate another texture through an FBO.
I haven’t read the book, but I’m pretty sure that what they present is the separable gaussian blur. It’s the typical school example of post-processing.
I’ve been trying to learn this stuff too. One useful way to learn different techniques is http://glsl.heroku.com/ It has loads of shaders for generating full screen effects with no textures, just resolution and time uniforms. So I just find an interesting one and take it apart e.g. How can you draw a a list of points as lines using only the fragment shader.