Wednesday, April 7, 2010

Hybrid render

Unigine render has severely mutated. New render capability of light pre-pass rendering mode is added. Forward and light pre-pass rendering can work at same time. The rendering mode of the lights can be easily switched with the distance, allowing light LOD system of a kind. Light pre-pass rendering mode doesn't multiply the amount of rendered geometry and results in a moderate quality level (because using Phong shading with fixed specular power). At the same time, forward-rendered lights can have all the shading variations, such as Phong-Rim, Anisotropy and Fresnel-based specular component.

Forward rendering:

Light pre-pass rendering:


Forward rendering:

Light pre-pass rendering:


PS: These screenshots are powered by OpenGL 4.0 tessellation.

6 comments:

  1. Nice, I have similar approach in my engine. By the way, did you manage to handle MSAA in light pre-pass without severely degrading performance or quality? I tried, but had a very limited luck so far. In case you're interested my approach is as follows:
    1) render geometry to MS normal and depth buffers
    2) resolve normal and depth buffers
    3) use resolved buffers to build non-MS light buffer
    4) render geometry to MS color buffer using MS depth buffer and sampling from non-MS light buffer, with offsets calculated from difference between plain and centroid pixel position.
    5) resolve color buffer, apply post-processing, etc

    It works, and works fast, but there are still lots of artifacts. I suspect they are due to centroid sampling optimization (e.g. when 3 of 4 samples are covered interpolator returns value corresponding to pixel center).

    By the way, "massive lighting system" from Cryengine3 shouldn't have issues with MSAA, but it is more complicated, and besides, there must be a good reason why they didn't use it for small primary lights (or did they?)

    ReplyDelete
  2. Yeah, we have similar approach for light pre-pass rendering and we not don't use MS for light buffer. On step 4 we even don't use centroid offsets.

    ReplyDelete
  3. So, you just take aliasing from light pre-pass lighting as unavoidable evil, did I understand right?

    ReplyDelete
  4. So, that way all forward rendering shaders evolved by sampling additional light from the light buffer, right?
    Do you have some optimizarion for objects, that are not touched by the light prepass lighting at all?

    ReplyDelete