Another PNG issue

Member
Posts: 79
Joined: 2002.08
Post: #1
Has anybody else seen this strange problem I have with PNG textures sometimes? I some cases when I use a PNG file as a texture, it shows up really dark in OpenGL. Not all black, but very dark. I open the texture in PhotoShop and it looks normal. I then save it again as a new PNG file, without any changes, run it in OpenGL and this time it shows up like it's supposed to!

Any idea why a PNG texture would show up too dark in OpenGL but be fine after it was saved as a new PNG file? I can't recall I have seen this happen with any other picture formats. Just the PNG files. And it doesn't seem to happen with all the PNG files either, only some.

From my own experiences and from what I have read here from others about PNG problems I'm getting nervous about using them. It's a shame since other than that I kind of like using PNG files.

KenD
Quote this message in a reply
Member
Posts: 110
Joined: 2002.04
Post: #2
Quote:Originally posted by KenD
Has anybody else seen this strange problem I have with PNG textures sometimes? I some cases when I use a PNG file as a texture, it shows up really dark in OpenGL. Not all black, but very dark. I open the texture in PhotoShop and it looks normal. I then save it again as a new PNG file, without any changes, run it in OpenGL and this time it shows up like it's supposed to!

Any idea why a PNG texture would show up too dark in OpenGL but be fine after it was saved as a new PNG file? I can't recall I have seen this happen with any other picture formats. Just the PNG files. And it doesn't seem to happen with all the PNG files either, only some.

From my own experiences and from what I have read here from others about PNG problems I'm getting nervous about using them. It's a shame since other than that I kind of like using PNG files.

KenD


PNG have internally saved GAMMA level with them.
If you PNG loading code is set wrong you get dark or lighter colors.

I will guess that in your cass the problem is with PhotoShop....
Since I have never seen this happen randomly.

- Mac Lead ZeniMax Online Studios
- Owner Plaid World Studios
- Resume: http://www.chrisdillman.com
Quote this message in a reply
Hog
Member
Posts: 151
Joined: 2002.09
Post: #3
it's probably some photoshop issue that can somehow be fixed somewhere in photoshop's preferences. i've often experienced that most images exported are darker than they appeared in photoshop, even RAW files (and what could you possibly do wrong with those)

as with PNGs from my experience PNG files saved on a mac usually show up as plain black or white on windows machines.
Quote this message in a reply
Founder
Posts: 1,139
Joined: 2002.04
Post: #4
I HIGHLY recommend you use the free SUPERPNG filter to save your PNG files. It has been Carbonized and can be found on versiontracker. (Along with a JPG2000 filter)

Go to Photoshops Prefs, and look for Color Settings. Read your manual on their proper settings. Also, check the CHANNELS window to see if anything is there that shouldn't be.

Also when saving PNG, don't save any META data or other junk. SuperPNG lets you set compression and not save the other stuff. (unless you want to)

Good luck and tell us if you solved the issue.

BTW... We have a small Mac OS X utility (with code) here for saving PNG (very good compression) but it sorely needs a GUI & batch processing feature. Any takers?

Carlos A. Camacho,
Founder
iDevGames
Quote this message in a reply
Member
Posts: 79
Joined: 2002.08
Post: #5
Thanks for the reminder Camacho! I downloaded SuperPNG a while ago but didn't install it right away and forgot about it. I have to take a look at it and see how it works.

KenD
Quote this message in a reply
Member
Posts: 79
Joined: 2002.08
Post: #6
Well, it looks like the gamma theory is correct. Opening the file in SuperPNG, it says that it has a gamma of 3.6 and when I select the default of 1.8 it comes up really dark like it did in OpenGL. Choosing to convert RGB values makes it show up correct. Saving the picture as a new PNG with SuperPNG makes it look ok in OpenGL, same as PhotoShop's PNG plug-in did.

I wonder why it had a gamma of 3.6? The original picture came from the Windows world but I don't remember if it was as a PNG or something else. Maybe that's where the odd gamma came from.

Anyway, I know the reason and what to do about it so now I feel better. :-)
Thanks for the help!

KenD
Quote this message in a reply
Post Reply