Deferred Lighting
2 posters
Blokworld :: Development :: Information
Page 1 of 1
Deferred Lighting
Hello !
I see that you have implemented deferred lighting.
Wich kind of problem have you resolved with this technique ?
First pass : I see that you are rendering your landscape first without light data.
Second pass : Then you seems to render only the light data on the landscape (Without texture colors)
Third pass : Then you have the one red picture with what seems to be the effect of the second pass to the first one.
The result is the First image blending with the second by the Red image value.
Do you generate your "red" map from pixel distance from camera ?
It makes you render your landscape to 3 differentes texture, and then use them in a 4 step to generate to final image. It this metods not killing performance ?
I see that you have implemented deferred lighting.
Wich kind of problem have you resolved with this technique ?
First pass : I see that you are rendering your landscape first without light data.
Second pass : Then you seems to render only the light data on the landscape (Without texture colors)
Third pass : Then you have the one red picture with what seems to be the effect of the second pass to the first one.
The result is the First image blending with the second by the Red image value.
Do you generate your "red" map from pixel distance from camera ?
It makes you render your landscape to 3 differentes texture, and then use them in a 4 step to generate to final image. It this metods not killing performance ?
S33m3- Posts : 54
Join date : 2011-03-23
Re: Deferred Lighting
Hehe,
To take your last point first; I thought exactly the same as you, that it would kill performance. But, i continue to be amazed at what modern graphics hardware can do. On my rig it currently runs at around 250fps with everything at max. Also, there is a lot of of stuff still in the shaders that needs tidied up or removed.
The passes i carry out are actually....
Draw all blocks, including transparent (not liquid).
Draw all models
These render into 3 buffers, a plain texture colour, a lighting buffer, and the first channel of a 2 channel linear depth buffer.
I plan to put dynamic lights after doing this rendering.
Then the tex and light are combined to produce a render to screen.
Then i draw the liquid front faces, but only to the 2nd channel of the linear depth buffer. I use an alpha blended add here.
Then i draw the liquid back faces, again, to the 2nd channel of the linear depth buffer. I use an alpha blended subtract here.
The linear depth buffer now allows me to calculate the water fog as well as the non-water fog per pixel.
If the player's head is in the water then i draw a sky sphere, blending in each pixel according to the linear depth buffer, followed by the stars, planets and clouds. The latter 3 don't use the linear depth buffer for blending.
I then do a full screen pass for water fog, blending in a fixed colour and using the linear depth buffer.
I then draw the liquid faces with transparency.
Then, if the players head is NOT in the water i draw the skysphere etc as detailed above.
Whew, that's a lot But it runs fast. I think the thing that took me the longest time was coming to terms with what seemed like a huge number of steps to generate the scene.
Oh, and the problem i wanted to solve is still only partially solved. This was to get proper dynamic lighting. I feel that without moving or changing lights the underground areas may feel a bit 'flat'.
I say partially, because the main issue i was experimenting with is that of lights shining through walls. Currently i think that the only way this can work is if the lights cast shadows, but to cast shadows they need to be aware of the nearby geometry, i think that this may be slow.
Oh, the whole fog thing was a chance to leverage the Multi Render Target thing to solve another little bug bear, that of underwater fog not quite working properly.
To take your last point first; I thought exactly the same as you, that it would kill performance. But, i continue to be amazed at what modern graphics hardware can do. On my rig it currently runs at around 250fps with everything at max. Also, there is a lot of of stuff still in the shaders that needs tidied up or removed.
The passes i carry out are actually....
Draw all blocks, including transparent (not liquid).
Draw all models
These render into 3 buffers, a plain texture colour, a lighting buffer, and the first channel of a 2 channel linear depth buffer.
I plan to put dynamic lights after doing this rendering.
Then the tex and light are combined to produce a render to screen.
Then i draw the liquid front faces, but only to the 2nd channel of the linear depth buffer. I use an alpha blended add here.
Then i draw the liquid back faces, again, to the 2nd channel of the linear depth buffer. I use an alpha blended subtract here.
The linear depth buffer now allows me to calculate the water fog as well as the non-water fog per pixel.
If the player's head is in the water then i draw a sky sphere, blending in each pixel according to the linear depth buffer, followed by the stars, planets and clouds. The latter 3 don't use the linear depth buffer for blending.
I then do a full screen pass for water fog, blending in a fixed colour and using the linear depth buffer.
I then draw the liquid faces with transparency.
Then, if the players head is NOT in the water i draw the skysphere etc as detailed above.
Whew, that's a lot But it runs fast. I think the thing that took me the longest time was coming to terms with what seemed like a huge number of steps to generate the scene.
Oh, and the problem i wanted to solve is still only partially solved. This was to get proper dynamic lighting. I feel that without moving or changing lights the underground areas may feel a bit 'flat'.
I say partially, because the main issue i was experimenting with is that of lights shining through walls. Currently i think that the only way this can work is if the lights cast shadows, but to cast shadows they need to be aware of the nearby geometry, i think that this may be slow.
Oh, the whole fog thing was a chance to leverage the Multi Render Target thing to solve another little bug bear, that of underwater fog not quite working properly.
Slaihne- Posts : 264
Join date : 2011-03-17
Age : 56
Re: Deferred Lighting
Just ran a few tests using GPU PerfStudio (a freebie from ATI)...
My full screen fog passes each take around 0.2 ms and my combining of the light and colour buffers also takes around 0.2 ms. To clear the buffers at the start of the frame takes around 0.02 ms each.
I'm gobsmacked
My full screen fog passes each take around 0.2 ms and my combining of the light and colour buffers also takes around 0.2 ms. To clear the buffers at the start of the frame takes around 0.02 ms each.
I'm gobsmacked
Slaihne- Posts : 264
Join date : 2011-03-17
Age : 56
Re: Deferred Lighting
With the performance i'm seeing, i've decided to make the change to a proper deferred renderer. I'm probably going to keep a forward renderer also for the slower machines out there.
Slaihne- Posts : 264
Join date : 2011-03-17
Age : 56
Re: Deferred Lighting
If I resume well the "weakness" of the deferred rendering is that you need to render your scene multiple times.
So it means that you Draw multiplying your draw call by a X factors isn't it ?
How many draw call do you send per frame with your deferred rendering turned on ?
So it means that you Draw multiplying your draw call by a X factors isn't it ?
How many draw call do you send per frame with your deferred rendering turned on ?
S33m3- Posts : 54
Join date : 2011-03-23
Re: Deferred Lighting
I don't do any more draw calls than before. I'm using multiple render targets, so a single draw call draws to many targets simultaneously.
Slaihne- Posts : 264
Join date : 2011-03-17
Age : 56
Blokworld :: Development :: Information
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|
Fri Jul 01, 2016 7:25 am by croxxx
» Source?
Thu Jul 12, 2012 9:55 am by raistlinthewiz
» Version Available (Take 2)
Sat Jun 09, 2012 3:23 am by kamild1996
» Terrain Rendering Bug
Thu May 17, 2012 8:07 am by sackboy789
» Mystery Block!
Thu Mar 29, 2012 4:42 am by Corvin73
» Your procedural tree/plant seeding technique?
Sat Mar 24, 2012 3:10 am by Slaihne
» Voxeliq project
Wed Mar 07, 2012 4:25 am by raistlinthewiz
» What is a Tech-Test?
Wed Jan 18, 2012 12:32 pm by joeydmars
» Images
Fri Jan 06, 2012 6:02 am by croxxx