Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualSeraphLance

Posted 20 September 2013 - 05:08 PM

Not quite.

 

1.  Render your geometry to buffers.  (You appear to already do this)

2.  Load your buffers into textures and perform lighting equations.  You have a lot of control over how to do this, and people argue about some of the nuances.  For a first shot, I'd honestly just render a fullscreen quad and perform on that.  The result of this shader(s) will be an accumulation buffer of all the light on your rendered geometry.

3.  multiply the diffuse colors of your GBuffer and the light buffer together.

 

Here's a reference image ripped from google:

 

GBuffer9.png

 

Left Column:

Diffuse

Normal

Depth

Light Buffer

 

Right image is the diffuse and light buffer multiplied together.

 

EDIT:  It appears my shader above is a bit misleading.  I don't actually *use* the diffuse texture in that shader.  It actually gets compiled out entirely.  The lighting stage is a combination of the normals, height, and any material properties you happen to store.  The diffuse isn't used at all until the third stage.


#1SeraphLance

Posted 20 September 2013 - 05:05 PM

Not quite.

 

1.  Render your geometry to buffers.  (You appear to already do this)

2.  Load your buffers into textures and perform lighting equations.  You have a lot of control over how to do this, and people argue about some of the nuances.  For a first shot, I'd honestly just render a fullscreen quad and perform on that.  The result of this shader(s) will be an accumulation buffer of all the light on your rendered geometry.

3.  multiply the diffuse colors of your GBuffer and the light buffer together.

 

Here's a reference image ripped from google:

 

GBuffer9.png

 

Left Column:

Diffuse

Normal

Depth

Light Buffer

 

Right image is the diffuse and light buffer multiplied together.


PARTNERS