Skip to content

kosakasakas/of-DeferredRendering

 
 

Repository files navigation

Deferred Rendering + SSAO in openFrameworks

A basic and work in progress deferred rendering system + SSAO for openFrameworks. It's currently in a very verbose and unoptimized state, but I've decided to post a version of it in this form as it should be a lot clearer and hopefully serve as a clear example of how to get started with deferred rendering in OF.

Tested with OF 0073 on OS X 10.7+10.8. This uses OpenGl 2.1 + GLSL 1.20 in order to stay as compatible as possible with the way OF works with rendering.

A GBuffer class and shader (gbuffer.frag/.vert) show how to generate a GBuffer containing view-space normals, linear depth, and albedo (full colour)

mainScene.frag shows how to use the GBuffer textures to perform deferred shading in view-space.

ssao.frag does a simple SSAO pass using the GBuffer position, depth, and normal data + a random jitter texture. The SSAO implemented in this example uses the basic method outlined in this great article by Nathaniel Meyer: http://devmaster.net/posts/3095/shader-effects-screen-space-ambient-occlusion.

Very much WIP - a few things left to do:

  • fix the allowing of light to go through objects through use of stencils
  • material indexing / storing lookup values for material properties in a 3D texture .. or maybe just storing specular value in gbuffer?

Screenshots from http://www.flickr.com/photos/85184046@N07/

About

OpenGL 2.1/GLSL 1.20 deferred rendering implementation in openFrameworks

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 80.4%
  • GLSL 19.4%
  • Makefile 0.2%