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

Thread: Texture sampler values in Metal shader are reduced?

  1. #1
    Intern Contributor
    Join Date
    Nov 2010
    Posts
    61

    Texture sampler values in Metal shader are reduced?

    I'm trying to port an OpenGL project to Metal, and I'm seeing a discrepancy in the texture values I get from the sampler. The Metal values are a little more than half the value of the OpenGL values.


    Here's an image from the OpenGL version (ignore the green, I'm just dealing with the fonts right now):
    https://i.stack.imgur.com/Jsksr.png


    And here's the Metal version:
    https://i.stack.imgur.com/Hvj8T.png


    This is just returning the straight value from the texture sampler in the fragment shader, there's no lighting or anything.

    Here is the actual texture image shown by the texture mapper, and in Photoshop. The values coming straight out of the sampler are reduced when compared to the OpenGL version, which is what makes me think it has to do with the textureLoader maybe?

    https://imgur.com/jPz00v7




    I don't have a lot of experience with Metal yet, or with OpenGL textures really, so I am not sure what could cause such a change. I tried fiddling around with the linear/nearest settings on the sampler, but I don't think that is the problem.
    Anyone know what else could cause this?


    Thanks!

  2. #2
    Intern Contributor
    Join Date
    Nov 2010
    Posts
    61
    Okay, answered my own question. MTKTextureLoader has an option "SRGB" which affects the loading of textures, whether or not gamma compression/decompression is applied. I guess it is true by default and I had to set it to false in order to get my textures to appear correctly.

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
  •