Skip to main content
deleted 276 characters in body
Source Link

So I implemented deferred Shading with a single full screen light pass (picture 2) (by passing the light-data as an array to the shader) and deferred shading with point light volumes (picture 1) (by rendering the back faces of spheres with the radius of the light). To "add" the color of two separate lights i used blending

glCullFace(GL_FRONT); glEnable(GL_BLEND); glBlendFunc(GL_ONE, GL_ONE); 

(while in the single light pass i just added the light values to the rgb color) light volumes Singe light pass Else both light calculations are the same. Yet i get those weird "lines" where one pixel is being lit by more than one light source, whereas the single pass results in a smooth transition. I guess the problem is the blending equation, but i can't find a solution. The resulting color of the light volume shader looks like this

//d is the normal/light direction equation //sp is the specular value //att is the attenuation //diff is the material color color = vec4(diff * light_color * (d + sp) * att, 0.0); 

The described values should be right.

EDIT:

I solved the problem by using an extra fbo for the point lights which's color texture then is passed to the deferred shader and added to the directional lights shading. This actually solved the banding, but is there a smarter way? FBOs cost a lot of bandwidth...

So I implemented deferred Shading with a single full screen light pass (picture 2) (by passing the light-data as an array to the shader) and deferred shading with point light volumes (picture 1) (by rendering the back faces of spheres with the radius of the light). To "add" the color of two separate lights i used blending

glCullFace(GL_FRONT); glEnable(GL_BLEND); glBlendFunc(GL_ONE, GL_ONE); 

(while in the single light pass i just added the light values to the rgb color) light volumes Singe light pass Else both light calculations are the same. Yet i get those weird "lines" where one pixel is being lit by more than one light source, whereas the single pass results in a smooth transition. I guess the problem is the blending equation, but i can't find a solution. The resulting color of the light volume shader looks like this

//d is the normal/light direction equation //sp is the specular value //att is the attenuation //diff is the material color color = vec4(diff * light_color * (d + sp) * att, 0.0); 

The described values should be right.

EDIT:

I solved the problem by using an extra fbo for the point lights which's color texture then is passed to the deferred shader and added to the directional lights shading. This actually solved the banding, but is there a smarter way? FBOs cost a lot of bandwidth...

So I implemented deferred Shading with a single full screen light pass (picture 2) (by passing the light-data as an array to the shader) and deferred shading with point light volumes (picture 1) (by rendering the back faces of spheres with the radius of the light). To "add" the color of two separate lights i used blending

glCullFace(GL_FRONT); glEnable(GL_BLEND); glBlendFunc(GL_ONE, GL_ONE); 

(while in the single light pass i just added the light values to the rgb color) light volumes Singe light pass Else both light calculations are the same. Yet i get those weird "lines" where one pixel is being lit by more than one light source, whereas the single pass results in a smooth transition. I guess the problem is the blending equation, but i can't find a solution. The resulting color of the light volume shader looks like this

//d is the normal/light direction equation //sp is the specular value //att is the attenuation //diff is the material color color = vec4(diff * light_color * (d + sp) * att, 0.0); 

The described values should be right.

added 274 characters in body
Source Link

So I implemented deferred Shading with a single full screen light pass (picture 2) (by passing the light-data as an array to the shader) and deferred shading with point light volumes (picture 1) (by rendering the back faces of spheres with the radius of the light). To "add" the color of two separate lights i used blending

glCullFace(GL_FRONT); glEnable(GL_BLEND); glBlendFunc(GL_ONE, GL_ONE); 

(while in the single light pass i just added the light values to the rgb color) light volumes Singe light pass Else both light calculations are the same. Yet i get those weird "lines" where one pixel is being lit by more than one light source, whereas the single pass results in a smooth transition. I guess the problem is the blending equation, but i can't find a solution. The resulting color of the light volume shader looks like this

//d is the normal/light direction equation //sp is the specular value //att is the attenuation //diff is the material color color = vec4(diff * light_color * (d + sp) * att, 0.0); 

The described values should be right.

EDIT:

I solved the problem by using an extra fbo for the point lights which's color texture then is passed to the deferred shader and added to the directional lights shading. This actually solved the banding, but is there a smarter way? FBOs cost a lot of bandwidth...

So I implemented deferred Shading with a single full screen light pass (picture 2) (by passing the light-data as an array to the shader) and deferred shading with point light volumes (picture 1) (by rendering the back faces of spheres with the radius of the light). To "add" the color of two separate lights i used blending

glCullFace(GL_FRONT); glEnable(GL_BLEND); glBlendFunc(GL_ONE, GL_ONE); 

(while in the single light pass i just added the light values to the rgb color) light volumes Singe light pass Else both light calculations are the same. Yet i get those weird "lines" where one pixel is being lit by more than one light source, whereas the single pass results in a smooth transition. I guess the problem is the blending equation, but i can't find a solution. The resulting color of the light volume shader looks like this

//d is the normal/light direction equation //sp is the specular value //att is the attenuation //diff is the material color color = vec4(diff * light_color * (d + sp) * att, 0.0); 

The described values should be right.

So I implemented deferred Shading with a single full screen light pass (picture 2) (by passing the light-data as an array to the shader) and deferred shading with point light volumes (picture 1) (by rendering the back faces of spheres with the radius of the light). To "add" the color of two separate lights i used blending

glCullFace(GL_FRONT); glEnable(GL_BLEND); glBlendFunc(GL_ONE, GL_ONE); 

(while in the single light pass i just added the light values to the rgb color) light volumes Singe light pass Else both light calculations are the same. Yet i get those weird "lines" where one pixel is being lit by more than one light source, whereas the single pass results in a smooth transition. I guess the problem is the blending equation, but i can't find a solution. The resulting color of the light volume shader looks like this

//d is the normal/light direction equation //sp is the specular value //att is the attenuation //diff is the material color color = vec4(diff * light_color * (d + sp) * att, 0.0); 

The described values should be right.

EDIT:

I solved the problem by using an extra fbo for the point lights which's color texture then is passed to the deferred shader and added to the directional lights shading. This actually solved the banding, but is there a smarter way? FBOs cost a lot of bandwidth...

Source Link

unsmooth blending with deferred shading and light volumes

So I implemented deferred Shading with a single full screen light pass (picture 2) (by passing the light-data as an array to the shader) and deferred shading with point light volumes (picture 1) (by rendering the back faces of spheres with the radius of the light). To "add" the color of two separate lights i used blending

glCullFace(GL_FRONT); glEnable(GL_BLEND); glBlendFunc(GL_ONE, GL_ONE); 

(while in the single light pass i just added the light values to the rgb color) light volumes Singe light pass Else both light calculations are the same. Yet i get those weird "lines" where one pixel is being lit by more than one light source, whereas the single pass results in a smooth transition. I guess the problem is the blending equation, but i can't find a solution. The resulting color of the light volume shader looks like this

//d is the normal/light direction equation //sp is the specular value //att is the attenuation //diff is the material color color = vec4(diff * light_color * (d + sp) * att, 0.0); 

The described values should be right.