Deferred Rendering Question

Started by
8 comments, last by Quat 12 years, 5 months ago
Right now I have 3 gbuffers:

RGBA16 (view space normal, view space depth)
RGBA8 (albedo, alpha)
RGBA8 (specPower, static ambient occlusion, future use, future use)

I am using DX11 (I think I can mix gbuffer format sizes 16-bit and 8-bit) on this platform -- so far no runtime errors.

For my light accumulation buffers I have:

R16 SSAO
RGBA8 Diffuse
RGBA8 Specular

When I go to combine the terms of the lighting equation I feel like I am missing some data:

1. I have no "ambient color" gbuffer. So I cannot have per object ambient materials. In order to not have another Ambient g-buffer, I am content to use something like GlobalAmbientLightColor*Albedo.

2. I have no "specular color" gbuffer (just a scalar specular strength). So I cannot have per object colored specular materials. I can however change the specular light color to get colored specular (which I want).

My question is if these limitations I am finding are common in deferred renderer and if I am taking the right approach or am I missing something? I understand I can use more g-buffers to get the data I want, but I am trying to stay under 3 g-buffers for performance.
-----Quat
Advertisement
It's very common to only use on a monochrome specular albedo. However (as far as I know) it is not common to have seperate specular + diffuse lighting buffers. Most implementations will have a single accumulation buffer that is first filled with ambient lighting during the G-Buffer pass, and then filled with the diffuse + specular contribution from each light source.

It's very common to only use on a monochrome specular albedo. However (as far as I know) it is not common to have seperate specular + diffuse lighting buffers. Most implementations will have a single accumulation buffer that is first filled with ambient lighting during the G-Buffer pass, and then filled with the diffuse + specular contribution from each light source.


If you decide to have color specular, then don't you need two accumulation buffers so you can accumulate diffuse and specular light separately? Otherwise how do you implement:

albedo*diffuse + specAlbedo*specular;

in the full screen pass after building albedo buffers and light accumulation buffers?
-----Quat

[quote name='MJP' timestamp='1319564621' post='4876843']
It's very common to only use on a monochrome specular albedo. However (as far as I know) it is not common to have seperate specular + diffuse lighting buffers. Most implementations will have a single accumulation buffer that is first filled with ambient lighting during the G-Buffer pass, and then filled with the diffuse + specular contribution from each light source.


If you decide to have color specular, then don't you need two accumulation buffers so you can accumulate diffuse and specular light separately? Otherwise how do you implement:

albedo*diffuse + specAlbedo*specular;

in the full screen pass after building albedo buffers and light accumulation buffers?
[/quote]

You do albedo * diffuse + specAlbedo * specular for each light source.

You do albedo * diffuse + specAlbedo * specular for each light source.
[/quote]

I see. I was drawing the lights and only accumulating "diffuse" and "specular" and then doing an addition fullscreen pass to implement the lighting equation. But you are saying to do the lighting equation as I draw the lights; this seems more efficient.
-----Quat

It's very common to only use on a monochrome specular albedo. However (as far as I know) it is not common to have seperate specular + diffuse lighting buffers. Most implementations will have a single accumulation buffer that is first filled with ambient lighting during the G-Buffer pass, and then filled with the diffuse + specular contribution from each light source.


I just started implementing the changes to use one accumulation buffer. However, one benefit I now see of having separate diffuse and specular accumulation buffers is with a bloom effect. I can just bloom the specular buffer. If I use one accumulation buffer, I would have to rerender out the shiny parts of the scene to another buffer.
-----Quat
You could also just store the luminance of specular in the alpha channel, and then do rgb * a in when doing the bloom. Although I'm not sure why you would only want to bloom the specular....

You could also just store the luminance of specular in the alpha channel, and then do rgb * a in when doing the bloom. Although I'm not sure why you would only want to bloom the specular....


I saw something about storing luminance in a killzone presentation, and I am going that route. Is the luminance just a measure of the pixel brightness so I can decide if it is bright or not for bloom?

I want to bloom specular because normally specular corresponds to the "bright" spots of the scene. Maybe though using luminance is better? Is there any reference tutorials on this?
-----Quat

[quote name='MJP' timestamp='1321314185' post='4883976']
You could also just store the luminance of specular in the alpha channel, and then do rgb * a in when doing the bloom. Although I'm not sure why you would only want to bloom the specular....


I saw something about storing luminance in a killzone presentation, and I am going that route. Is the luminance just a measure of the pixel brightness so I can decide if it is bright or not for bloom?

I want to bloom specular because normally specular corresponds to the "bright" spots of the scene. Maybe though using luminance is better? Is there any reference tutorials on this?
[/quote]

Yeah luminance is an approximation of the brightness of a pixel. It's usually computed with a dot product:

float CalcLuminance(float3 color)
{
return max(dot(color, float3(0.299f, 0.587f, 0.114f)), 0.0001f);
}


The killzone guys stored luminance in alpha (normalized to the [0, 2] range) because they did not use HDR. If you use HDR then there's no need to store a separate brightness, or to estimate brightness based on specular. This is what most modern games do. However if you're not using HDR, then storing luminance or some other sort of "glow" value in the alpha channel is an acceptable way to handle bloom.

The killzone guys stored luminance in alpha (normalized to the [0, 2] range) because they did not use HDR. If you use HDR then there's no need to store a separate brightness, or to estimate brightness based on specular. This is what most modern games do. However if you're not using HDR, then storing luminance or some other sort of "glow" value in the alpha channel is an acceptable way to handle bloom.


I just looked at your XNA HDR sample, and I see how to do bloom with HDR now. I do a threshold pass to find the "bright" spots and then blur that and add it in for the bloom. I like this much better than doing the "glow channel" estimation. Thanks.
-----Quat

This topic is closed to new replies.

Advertisement