Results 1 to 8 of 8

Thread: Blurfilter on 3d texture

  1. #1
    Junior Member Newbie
    Join Date
    Feb 2009
    Posts
    17

    Blurfilter on 3d texture

    Hi everybody


    I have build a small application to render volume graphic with a
    raycasting algorithm. The volume is transferred via a texture 3d to the
    gpu and in the fragment-shader the rays are casted into this
    volume. No problem so far.

    So now i want to blur the volumedata with a gauss filter kernel before
    i use it. At the moment i do this job on the cpu but i wonder if i can
    accomplish the task on the gpu. For 2D images i see no problem. You
    can create two fbos and two fragment-shaders for each direction (x,y)
    and ping-pong between them. Is it possible to something similar with
    3D textures? And can i expect a speedup?

  2. #2
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,574

    Re: Blurfilter on 3d texture

    Kinda the same for 3D :
    Code :
    for each Z value  {
     fixed Z: do the X 1D blur
     fixed Z: do the Y 1D blur
    }
    for each X value  {
     fixed X: do the Z 1D blur 
    }
    As for 2D blur, you should faster results on GPU.

  3. #3
    Junior Member Newbie
    Join Date
    Feb 2009
    Posts
    17

    Re: Blurfilter on 3d texture

    Thats clear, but my problem is how i save the result? Can i render directly to a texture 3d?

  4. #4
    Senior Member Frequent Contributor
    Join Date
    Mar 2009
    Location
    Karachi, Pakistan
    Posts
    810

    Re: Blurfilter on 3d texture

    Terse reply:
    Two ways
    1) using a FBO to render directly to a 3D texture
    2) glTexSubImage3D and varying the z offset
    Regards,
    Mobeen

  5. #5
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,574

    Re: Blurfilter on 3d texture

    Yes, same as 2D, but using 'level' along Z to select a given XY slice.
    http://www.opengl.org/wiki/Framebuff...Layered_Images

  6. #6
    Junior Member Newbie
    Join Date
    Feb 2009
    Posts
    17

    Re: Blurfilter on 3d texture

    Still don't get it sorry. Let me try again.

    I see that you can bind a texture3d to a framebuffer-object. But the fragment-shader can only create 2-dimensional images, right? So in order to do the gauss-blur on my 3d-volume, i have to cut it into slices, render each slice on a quad and do the blur with 3 passes in x,y and z-direction. The cutting can be done by using a fbo and glFramebufferTexture3D but i have to draw each slice manually on a quad.

    Is this the right way to do it? If the answer is yes it seems to me that cuda is much more simple for this task.

  7. #7
    Senior Member OpenGL Lord
    Join Date
    Mar 2015
    Posts
    6,671

    Re: Blurfilter on 3d texture

    I see that you can bind a texture3d to a framebuffer-object.
    No, you can't; you can bind 2D slices to the framebuffer.

    Layered rendering is simply a way to select which 2D slice you render to through a geometry shader. That is, your geometry shader can output multiple primitives, each of which will be written to a different 2D slice of a 3D texture.

  8. #8
    Junior Member Newbie
    Join Date
    Feb 2009
    Posts
    17

    Re: Blurfilter on 3d texture

    Hm ok. So i bind 2D slices to the framebuffer, the geometry shader emits the quads and with gl_Layer i tell the fragment shader to which slice he should render.

Similar Threads

  1. Replies: 1
    Last Post: 12-26-2014, 04:57 PM
  2. Replies: 1
    Last Post: 03-10-2014, 12:51 PM
  3. Replies: 2
    Last Post: 09-27-2004, 05:25 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean