WIP Deferred Shading

Hi, I’ve been toying around with deferred shading in JME lately and got some early results :slight_smile:


The test scene has over 1100 000 triangles (256 spheres) and 324 pointlights! Hemispherical ambientlight, directional light and rim light. All surfaces has diffuse texture, normal and specular maps.

The test also uses FXAA Filter (due to no AA when doing deferred shading) and a bloom filter just because it’s pretty :slight_smile:

Next stop is probably Spotlights, shadows… and uhm some kind of game to use all this stuff in :stuck_out_tongue:


Earlier smaller scene with no magic ambient light…



A short youtube demo :slight_smile:



You have killed me! Mamaaaa!!!

That’s awesome!!!

I hope it will be in JME core!

wow, excellent @kwando

Cool, good job.

nice work

Well color me impressed. I was thinking of trying to do deferred shading myself, but looks like someone’s a few steps ahead of me :stuck_out_tongue:

That is amaizing. So many lights and vertices…


cryengine and unreal will suck!

Very pretty. Would be cool to see a video of flying around that stuff. :slight_smile:

Very Nice!!

@kwando : … Speechless :o

Holy mahony!

thats sweet :slight_smile:

@pspeed said:
Very pretty. Would be cool to see a video of flying around that stuff. :)

Here you go :P

I switched from my macbook pro to my desktop computer instead and succeded to crank the numbers some more.. :P


Just a quick demo :)

1764 spheres and whopping 1849 small pointlights!
@2560x1440, +30 fps

Impressive!!! realy realy nice stuff :slight_smile:

:open_mouth: :open_mouth:

When we will be able to play with it? 8)


So how did you do it?

Did you change some core classes? or did you use the post processing filter? or both :stuck_out_tongue:

Do you have a position buffer or do you use only the depth buffer?

1 Like


For the moment it’s just a SceneProcessor and 3 materials :slight_smile:

Geometry and light volumes (also geometry) is added to the same rootNode.

The SceneProcessor forces the technique to GBuffer and then renders the scene, then render the opaque bucket with forced DefferedLight technique to another framebuffer.

GBuffer saves:

  • depth (32 bits)
  • normal (24 bits)
  • specular (8 bits)
  • diffuse/albedo (24 bits)

    The final step is done in a new MainViewport where I just render a fullscreen quad and after this I let FilterPostProcessor FXAA and bloom filter do it’s magic.

    Ideally I would make some changes to the core classes… it would be nice to use the same light classes for deferred and forward rendering (which I still gonna need for transparent stuff). I’m also wanna extend the renderManager with some methods.

    There is still much to do, my current code is just slammed together and I’m sure there is plenty of room for improvements. :slight_smile:

I’m awesomazed. Speechless, even. drops to the floor I rather doubt that my junky 1.8 ghz dual core processor would survive it XD

@geniusgames said:
I'm awesomazed. Speechless, even. *drops to the floor* I rather doubt that my junky 1.8 ghz dual core processor would survive it XD

Its not so much about the CPU than the GPU.