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 8 of 8

Thread: multi pass

  1. #1
    Intern Newbie
    Join Date
    Feb 2005
    Location
    burton-on-trent [england]
    Posts
    35

    multi pass

    just one word really, HOW?

    i'v seen these magical words in many places, but no real description of what they mean in code terms.

    can i set up a few frag shaders and automatically run through them.
    or do i render with one, flush, render with the next, flush...


  2. #2
    Junior Member Regular Contributor
    Join Date
    Aug 2004
    Location
    Palo Alto, CA
    Posts
    111

    Re: multi pass

    You can only use one program object for the entire pass. Cannot pipeline shaders in one pass.

  3. #3
    Senior Member OpenGL Pro sqrt[-1]'s Avatar
    Join Date
    Jun 2002
    Location
    Australia
    Posts
    1,006

    Re: multi pass

    multi-pass does what the name suggests :- Multiple passes. You can perform effects that cannot be done in one pass by multi-passing. For example:

    1st pass) Render diffuse lighting of the object
    2nd pass) Render specular lighting of the object (with additive blending)

    For each of these passes you will have to bind a different shader but you do not have to do a "flush" between passes.

    It has been suggested that future drivers/hardware may be able to break up complex shaders into multiple passes - but no driver will currently do this. If you want to multi pass you will have to do it manually.

  4. #4
    Intern Newbie
    Join Date
    Dec 2004
    Location
    Mars
    Posts
    40

    Re: multi pass

    my graphics card is 3dlabs wildcat realizm 200. could i also do multipass?

  5. #5
    Advanced Member Frequent Contributor yooyo's Avatar
    Join Date
    Apr 2003
    Location
    Belgrade, Serbia
    Posts
    883

    Re: multi pass

    Originally posted by guyinhell:
    my graphics card is 3dlabs wildcat realizm 200. could i also do multipass?
    Yes.. you can do multipass even on old TNT board.
    Multipass means, that you render screen in several passes and in each pass you add to image something new.
    Multipass is good when you want to speedup things. For example imagine that you render geometry with very complex and expensive shader and after that you overdraw it by simple shaded wall. It's a waste of GPU time. So.. in first pass render scene to depth buffer only (no shaders, no textures). This is very fast pass. In second pass render scene again but disable depth write and turn on shaders and textures. During rasterization, hw will discard fragments that fail z-test and complex shader will not be executed if faces are depth occluded.

    yooyo

  6. #6
    Intern Newbie
    Join Date
    Dec 2004
    Location
    Mars
    Posts
    40

    Re: multi pass

    hi yooyo:

    it seems that i understood multi pass wrongly. if i do a image convolution with a 7x7 kernel, i must read the texture 48 times. siince the exture reads are limited, maybe i use a shader to read 24 neighboring pixels and another shader to read the other 24 neighboring pixel. is it also kinda multi pass? is it possible?

  7. #7
    Member Regular Contributor
    Join Date
    Mar 2002
    Location
    France
    Posts
    363

    Re: multi pass

    Originally posted by guyinhell:
    hi yooyo:

    it seems that i understood multi pass wrongly. if i do a image convolution with a 7x7 kernel, i must read the texture 48 times. siince the exture reads are limited, maybe i use a shader to read 24 neighboring pixels and another shader to read the other 24 neighboring pixel. is it also kinda multi pass? is it possible?
    up

  8. #8
    Super Moderator OpenGL Guru
    Join Date
    Feb 2000
    Location
    Montreal, Canada
    Posts
    4,421

    Re: multi pass

    I imagine that multi pass means rendering the same geometry at the same location more than once.

    But these are just words (multipass). Do whatever you find necessary.

    If you will multipass, just remember that invarience is important. We want fragments to be in the same X and Y positions and have the same Z as previous passes, otherwise you get what resembles z fighting and missed pixels.

    With GLSL, invarience is acheived with

    gl_Position = ftransform();
    ------------------------------
    Sig: http://glhlib.sourceforge.net
    an open source GLU replacement library. Much more modern than GLU.
    float matrix[16], inverse_matrix[16];
    glhLoadIdentityf2(matrix);
    glhTranslatef2(matrix, 0.0, 0.0, 5.0);
    glhRotateAboutXf2(matrix, angleInRadians);
    glhScalef2(matrix, 1.0, 1.0, -1.0);
    glhQuickInvertMatrixf2(matrix, inverse_matrix);
    glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
    glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);

Posting Permissions

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