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

Thread: New blend equation or factor

  1. #1
    Junior Member Newbie
    Join Date
    Oct 2001
    Location
    Denmark
    Posts
    4

    New blend equation or factor

    I know that glBlendEquation only sets the equation for each rgba element, but wouldn't it be nice if there was an equation that allowed mixing elements, maybe by using the full source and destination color in each element. Maybe something like this:
    Code :
    CS = source color (RGBA)
    CD = destination color (RGBA)
    SF = source factor
    DF = destination factor
    final blended RGBA values are give by
    (CS*SF + CD*DF, CS*SF + CD*DF, CS*SF + CD*DF, CS*SF + CD*DF)
    This is probably not the best way to do it, but I hope you get the idea. I have no idea whether this is possible in todays hardware or not, but it seems to me that something like this would allow for much greater flexibility.
    What I really need is dot3 blending without having to do 12 passes or whatever. So actually my main request is just the ability to have the same blending operations as the combiner extension.

    Best regards
    John

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Mar 2001
    Posts
    3,576

    Re: New blend equation or factor

    With the advent of multitextured hardware and advanced texture environment modes (Dot3, Register Combiners, Fragment Shaders, etc), I'm not sure what good this extension would do. I'm not certain how much sense it makes to apply some kind of dot product fragment blending mode. With advanced texture environments, fragment blending can go back to what it should be use for: transparency.

  3. #3
    Junior Member Newbie
    Join Date
    Oct 2001
    Location
    Denmark
    Posts
    4

    Re: New blend equation or factor

    I you want to be able to do something more complex than just combining 2-4 textures, you need this functionality, consider the following two examples in a system with two texture units.
    (tex1 * tex2) + (tex3 dot3 tex4), this is simple and easy and can be accomplished, with standard ARB extensions (ARB_env_combine, ARB_env_dot3 and normal blending). If we change that equation ever so slightly it becomes much harder.
    (tex1 * tex2) dot3 (tex3 + tex4), this is impossible in OpenGL as it is, because we cannot specify a blend dotproduct. In order to do this, we have to render (tex1 * tex2) and store it in a texture, then render (tex3 + tex4) and store that in another texture and finally we combine these two textures in a third pass.
    These two examples may not be very meaningfull, but they do provide a good example. It may be possible to do this in a single pass on a Geforce3, but I don't have a Geforce3 and I try to use only ARB and EXT extensions.
    Alternatively a GL_ARB_render_texture would be nice, instead of WGL_ARB_render_texture which requires PBuffers and whatnot. Would it be difficult to just specify a normal RGBA texture as render target, instead of the framebuffer?

    Well that's it I hope that clarified my intentions a little.

    Cheers
    John

  4. #4
    Senior Member OpenGL Guru
    Join Date
    Mar 2001
    Posts
    3,576

    Re: New blend equation or factor

    The equation you propose is very doable in a GeForce3. A GeForce2 or 1 could do it if it had 4 texture units in it.

    And I think you can do it with ARB_CrossBar. If your hardware supports 4 multitextures, that is.

  5. #5
    Intern Contributor
    Join Date
    Feb 2001
    Posts
    89

    Re: New blend equation or factor

    Or just do the math in the code of your program, upload the two new textures to pre-existing handles, and then computer the dot product... The only time this would be problematic is if glTexSubImage2D is god-awful slow on that particular implementation of OpenGL, which is not likely if it supports dot3 blending.
    -pATCheS

Posting Permissions

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