Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 5 of 5

Thread: How to Make Cool Effects with GLSL?

  1. #1
    Junior Member Newbie
    Join Date
    Jan 2012
    Posts
    15

    Question How to Make Cool Effects with GLSL?

    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.

    Thanks much,
    Nick.

  2. #2
    Advanced Member Frequent Contributor
    Join Date
    Dec 2007
    Location
    Hungary
    Posts
    947
    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:

    Quote Originally Posted by Nick_Miller View Post
    It uses PBO's to store textures and uses the shader to blend different PBO's to return a blurred-like result.
    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.

    Quote Originally Posted by Nick_Miller View Post
    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.
    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.

    Quote Originally Posted by Nick_Miller View Post
    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.
    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.
    Disclaimer: This is my personal profile. Whatever I write here is my personal opinion and none of my statements or speculations are anyhow related to my employer and as such should not be treated as accurate or valid and in no case should those be considered to represent the opinions of my employer.
    Technical Blog: http://www.rastergrid.com/blog/

  3. #3
    Junior Member Newbie
    Join Date
    Jan 2012
    Posts
    15
    Well... clearly I do not understand as much about GLSL as I thought.

    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?

    Thanks again.
    Nick.

  4. #4
    Advanced Member Frequent Contributor
    Join Date
    Dec 2007
    Location
    Hungary
    Posts
    947
    Quote Originally Posted by Nick_Miller View Post
    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.
    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.
    Disclaimer: This is my personal profile. Whatever I write here is my personal opinion and none of my statements or speculations are anyhow related to my employer and as such should not be treated as accurate or valid and in no case should those be considered to represent the opinions of my employer.
    Technical Blog: http://www.rastergrid.com/blog/

  5. #5
    Junior Member Regular Contributor
    Join Date
    Jun 2006
    Location
    Edinburgh - Scotland
    Posts
    147
    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.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •