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: HDR Texture Format Issues

  1. #1
    Junior Member Regular Contributor
    Join Date
    Mar 2012
    Posts
    114

    HDR Texture Format Issues

    Hello,

    I added HDR rendering to my game, but I cannot find a HDR texture format that works across all systems and doesn't produce artifacts. This format:

    Code :
    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB16F, m_width, m_height, 0, GL_RGB, GL_FLOAT, NULL);

    Gives me really strange black pixelated box artifacts that surround various areas of the screen. It also doesn't downsample properly when determining the scene luminance, so everything gets very bright.

    I was able to get rid of these artifacts on my system by changing the format to:

    Code :
    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB16, m_width, m_height, 0, GL_RGB, GL_FLOAT, NULL);

    From what I have read, that isn't even an HDR format, since GL_RGB16 clamps values to [0, 1]. But for some reason it works on my machine.

    Neither of these formats run on the other machines I have tested besides my own.

    What could be causing the artifacts? What format should I use?

    Thanks for any help you can offer.

  2. #2
    Super Moderator OpenGL Guru
    Join Date
    Feb 2000
    Location
    Montreal, Canada
    Posts
    4,421
    Maybe you are exceeding the limit of RGBA16F. Try RGB32F.
    ------------------------------
    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);

  3. #3
    Junior Member Regular Contributor
    Join Date
    Mar 2012
    Posts
    114
    I tried that one too, but it still gave me the artifacts.

  4. #4
    Super Moderator OpenGL Guru
    Join Date
    Feb 2000
    Location
    Montreal, Canada
    Posts
    4,421
    Either you are still exceeding the limits of 32 bit float or you have a problem in your shader, perhaps you are generating a NaN somehow. No way to know.
    ------------------------------
    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);

  5. #5
    Junior Member Regular Contributor
    Join Date
    Mar 2012
    Posts
    114
    I figured out why it wasn't working on other people's machines (GLSL extension issue), but it still only works with the formats that do not have and F on them (I still get artifacts). It can't be lack of precision or a shader error, since it works with the same precision and same shaders with the "not F" versions (which they shouldn't, from what I have read, so I would rather get the F versions to work as well).

Posting Permissions

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