Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: How to render to a subsection of a cubemap array?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Junior Member Newbie
    Join Date
    Oct 2017
    Posts
    6

    How to render to a subsection of a cubemap array?

    Say I have a cubemap array and a shading program to render depth maps.

    I want to iteratively render to a single cubemap in the cubemap array for each light.

    In other words I want to select a subsection of the cube mapo array to which the shading rpogram will output it's shading information.

  2. #2
    Senior Member OpenGL Lord
    Join Date
    May 2009
    Posts
    6,065
    What do you mean by "iteratively render"? If you're rendering an object, how do you know which cubemaps in the array you want to render to? Are you trying to render to only one layer-face at a time, or to several array layers at once? Is the light a uniform value, or is it something that changes within the rendering call?

    The general solution is "use layered rendering", but the specifics differ based on the answers to the above.

  3. #3
    Senior Member OpenGL Guru
    Join Date
    Jun 2013
    Posts
    3,003
    Quote Originally Posted by Makogan View Post
    In other words I want to select a subsection of the cube mapo array to which the shading rpogram will output it's shading information.
    You can either bind a single layer-face (i.e. one face of one cube map), or the entire cube map array. In the latter case the framebuffer will be layered and you'll need a geometry shader which sets gl_Layer to select the layer-face.

    If you bind individual layer-faces, you'll need six draw calls per layer. If you bind the entire array as a layered framebuffer, you can potentially draw everything in one draw call using instanced rendering. In the latter case, you can either have one instance per layer-face (i.e. one for each light and axis) with a trivial geometry shader setting gl_Layer from gl_InstanceID, or one instance per layer and a more complex geometry shader which transforms and outputs each primitive to all of the faces which it intersects.

Tags for this Thread

Posting Permissions

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