From BlenderWiki

Jump to: navigation, search
Note: This is an archived version of the Blender Developer Wiki. The current and active wiki is available on wiki.blender.org.

Name

Daniel Stokes

Email / IRC / WWW

My email is kupomail@gmail.com. My irc nickname is Kupoman, and I tend to lurk in #gameblender, #blender, and #blendercoders.

Synopsis

Improve the Blender Game Engine's rendering, with an emphasize on inferred rendering.
Currently the Blender Game Engine uses a very common technique known as forward rendering. When using forward rendering, each material analyzes each light to determine lighting information. A more modern technique known as deferred rendering creates a buffer with geometry data (commonly called a g-buffer) and uses that to draw lighting directly into screen space. This allows for many more lights as there is a much lower cost per light than forward rendering. Unfortunately what deferred rendering gains in speed, it sacrifices in flexibility. Any information not stored in the g-buffer gets lost, making it more difficult to integrate into an existing material pipeline. Inferred rendering differs from differed rendering in that it creates a light buffer for materials to read lighting data from, this allows the scene to be rendered in much the same way as forward rendering (except the materials now look at the light buffer instead of gaining information from each light and making lighting calculations). This difference allows inferred rendering to be much more flexible, and easier to integrate into blender.

Benefits to Blender

Updating the Blender Game Engine with some modern rendering techniques will allow users of the Blender Game Engine to more readily create impressive content. By introducing inferred rendering into the BGE's renderer, users will be able to create scenes with more complex and interesting dynamic lighting than is possible with the forward rendering that the BGE currently uses.


Deliverables

I plan to deliver a more modernized real time renderer with some of the following improvements to the current renderer:
  • Anti Aliasing
  • Inferred Rendering Mode
  • Fixes to multiple lighting bugs (These bugs will be easier to deal with in a more flexible lighting scheme)
  • Possibly HDR rendering (if time permits).


Project Details

To get my feet wet in the renderer code I plan to change the renderer to render the scene into a framebuffer, and from there applying some kind of multisampling (most likely MSAA)to give the engine anti-aliasing. This should get me started on multiple render targets from which I can start in on inferred rendering.
This project will give the user the option of switching to to an inferred mode in the same way a user can currently switch to multitexture or GLSL modes. To implement the inferred lighting I plan to mostly follow this paper on the topic: http://graphics.cs.uiuc.edu/~kircher/inferred/inferred_lighting_paper.pdf .
I plan to stray from the paper initially in order to get simple inferred lighting established as soon as possible. These changes include not implementing the Discontinuity Sensitive Filtering (DSF). This means I will have to leave the lighting of alpha polygons to forward rendering, and the G-Buffer(s) and L-Buffer will be at the same resolution as the final output buffer. I hope to have all the current lamp types properly supported in the this new rendering mode, as well as the ability to dynamically add new lamps properly into the scene.


Project Schedule

The steps I plan to take to improve the BGE Renderer:
  1. Get more familiar with the rendering code by setting up a render buffer with anti-aliasing.
  2. Create a simple light buffer that simply treats all lamps as point lamps.
  3. Modify the UI to allow switching to an inferred mode.
  4. Modify the shaders to make use of the light buffer when in inferred mode to light non alpha polygons.
  5. Set up a geometry pass that gathers normal information and stores it in a G-Buffer.
  6. Modify the light pass to incorporate the normal information from the G-Buffer to create the light buffer.
  7. Add support for spot, hemi, sun, and area lamps.
  8. Add an option for ambient lighting.
I should be able to at least start getting things ready while I am still in classes. My Spring Quarter ends June 10th, and I do not plan to be taking any classes during Summer Quarter. Since I don't currently have any plans for summer employment, I will be able to devote as much time as is necessary to this project. The exception will be one week of vacation with my family somewhere in the middle of the summer.
As far as timelines go, I am uncertain as to how long most of this will take. If I were to make a guess, I would say it could take a week for each item in the above list with the exception of adding the UI option to switch to inferred mode (which should take nearly no time to do). Assuming 12 weeks of summer, the above list outlines about 7 weeks, and there will be 1 week of vacation. This leaves 4 weeks to unexpected delays or the possibility to explore other improvements.
One possible additional improvement that can be worked on if enough time remainss is High Dynamic Range rendering (HDR). I have not given that topic as much research, but, with the knowledge of the BGE's rendering that I would gain from implementing inferred rendering, I believe I could add this in if I have at least two to three weeks to spare after finishing my main goals.
Another possibility would be to look into implementing the Discontinuity Sensitive Filtering (DSF) mentioned in the previously linked to paper in the Project Details section. This will allow all polygons to be rendered with inferred rendering rather than leaving alpha polygons to forward rendering. To compensate for the initial cost of the DSF, the G-Buffer and light buffer can be reduced in size. This could be squeezed in if only two weeks remained, or if HDR rendering is looking to be a bigger project than I am currently predicting.

Bio

I am a Computer Science student at Eastern Washington University, and live in Spokane, Washington, USA. I have used Blender and its game engine for about three years now, and I wish to see it become more competitive with other engines out there. I have been building Blender regularly for a while on 64 bit Windows, but I have also made builds for Windows 32 bit, Mac OSX, and Linux 64 bit. This past winter I have begun trying my hand at more serious development beyond the occasional UI tweak to suit my needs by attempting to get the cloth modifier working in the game engine. While I have not yet finished this project (I got the cloth modifier working in the game engine along with a mostly functioning new Verlet solver, but objects replicated with a collision modifier are requiring me to step back and think things through), it has taught me a lot about how Blender works and where to find things in the code base.