Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 29

Thread: Deferred Shading Performance Problems

  1. #11
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    2,882
    Quote Originally Posted by cireneikual View Post
    I have a lot of light overlap, so I will try the tile based method. I assume that the lights are supposed to be passed to the shaders using fixed size arrays or the built in forward rendering lighting stuff.
    Uniform arrays, UBOs, textures, ...whatever works.

  2. #12
    Junior Member Regular Contributor
    Join Date
    Mar 2012
    Posts
    114
    I am nearly done coding the tiling version, but I ran into a problem: I decide which lights are assigned to which tiles by rendering the light volumes to an FBO with the same resolution as the tile grid dimensions, but if a volume is completely encompassed by a tile, it will disappear (too low resolution). Is there some way I can render to the FBO such that it will render to fragments as long as geometry is touching them?

  3. #13
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    2,882
    Quote Originally Posted by cireneikual View Post
    Is there some way I can render to the FBO such that it will render to fragments as long as geometry is touching them?
    Maybe in the vtx shader push the corners away from the center toward the next pixel boundary? Just tweak the clip-space position you'd output before you're done.

  4. #14
    Junior Member Regular Contributor
    Join Date
    Mar 2012
    Posts
    114
    Alright, I got the tiled deferred shading to work, but it actually runs significantly slower than the normal deferred shading. Using timer queries, I found that the problem wasn't on the GPU side, but the CPU was taking a lot of time to set up the lights after the light grid has been generated. Is glLightfv particularly slow? I have to call it hundreds of times each frame in order to set up the lights for each grid cell.

  5. #15
    Advanced Member Frequent Contributor
    Join Date
    Dec 2007
    Location
    Hungary
    Posts
    941
    Quote Originally Posted by cireneikual View Post
    Alright, I got the tiled deferred shading to work, but it actually runs significantly slower than the normal deferred shading. Using timer queries, I found that the problem wasn't on the GPU side, but the CPU was taking a lot of time to set up the lights after the light grid has been generated. Is glLightfv particularly slow? I have to call it hundreds of times each frame in order to set up the lights for each grid cell.
    What? You use glLightfv? For deferred rendering?
    Disclaimer: This is my personal profile. Whatever I write here is my personal opinion and none of my statements or speculations are anyhow related to my employer and as such should not be treated as accurate or valid and in no case should those be considered to represent the opinions of my employer.
    Technical Blog: http://www.rastergrid.com/blog/

  6. #16
    Junior Member Regular Contributor
    Join Date
    Mar 2012
    Posts
    114
    Yes, since I am using tile-based deferred shading: http://visual-computing.intel-resear...red_rendering/
    It groups lights together based on tiles in order to reduce g-buffer look-ups.

  7. #17
    Advanced Member Frequent Contributor
    Join Date
    Dec 2007
    Location
    Hungary
    Posts
    941
    Quote Originally Posted by cireneikual View Post
    Yes, since I am using tile-based deferred shading: http://visual-computing.intel-resear...red_rendering/
    It groups lights together based on tiles in order to reduce g-buffer look-ups.
    But why do you use glLightfv? Why don't use use uniform buffers or at least uniforms?
    Disclaimer: This is my personal profile. Whatever I write here is my personal opinion and none of my statements or speculations are anyhow related to my employer and as such should not be treated as accurate or valid and in no case should those be considered to represent the opinions of my employer.
    Technical Blog: http://www.rastergrid.com/blog/

  8. #18
    Junior Member Regular Contributor
    Join Date
    Mar 2012
    Posts
    114
    It was the easiest to implement. Why not use it? Is it slow?

  9. #19
    Advanced Member Frequent Contributor
    Join Date
    Dec 2007
    Location
    Hungary
    Posts
    941
    Quote Originally Posted by cireneikual View Post
    It was the easiest to implement.
    I can barely believe that it is in any way easier to implement than using uniforms.
    Quote Originally Posted by cireneikual View Post
    Why not use it?
    Maybe because it's deprecated, or because it's not really general purpose, or because you are bound to 8 lights per draw call?
    Quote Originally Posted by cireneikual View Post
    Is it slow?
    I would bet it is, though I don't know, I didn't call that function since the advent of programmable shaders.

    Though, after this, I have doubts whether you actually implemented deferred rendering as that requires shaders and I (fortunately) haven't met anybody yet who used glLightfv with shaders.
    Disclaimer: This is my personal profile. Whatever I write here is my personal opinion and none of my statements or speculations are anyhow related to my employer and as such should not be treated as accurate or valid and in no case should those be considered to represent the opinions of my employer.
    Technical Blog: http://www.rastergrid.com/blog/

  10. #20
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    2,882
    Quote Originally Posted by aqnuep View Post
    ...I (fortunately) haven't met anybody yet who used glLightfv with shaders.
    I betcha you have and have just forgotten

    Remember GLSL pre-1.2 and gl_LightSource[0].diffuse, etc. (and similar Cg syntax in the arb profiles?) -- training wheels that let you implement fixed function pipeline and variants in shaders?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •