Game Development Community

Anyone ever seen this before?

by Vern Jensen · in Torque Game Builder · 08/21/2009 (5:15 pm) · 15 replies

I've just started beta testing for my game, and on one user's setup, he gets this:

www.actionsoft.com/files/images/imageGlitch.jpg


when he should be getting this:

www.actionsoft.com/files/images/shouldBeThis.jpg

Notice that the B&W glitch image is actually a very blown-up portion of the correct image. (Look at the top-left portion of the correct one.)

It only happens to things loaded from JPEG in the game -- never to PNGs. (You'll even notice from the glitch screenshot he took, the yellow arrow worked just fine. This is loaded from a PNG.) The odd thing is that many JPEGs apparently do work fine for him. Just 2 that don't... out of dozens.

I was thinking it might be related to the problem mentioned in this thread:

<url>http://www.garagegames.com/community/forums/viewthread/58205</url>

...yet I've been unable to get "image.alpha.jpg" to load successfully... it still loads the main JPEG without the alpha. (I'm testing this on a Mac.) Any ideas what the problem might be, and how to fix it?

-Vern

#1
08/21/2009 (6:02 pm)
Also, info about the user's computer:

Video card: Radeon X1600/X1650 Series
OS: WindowsXP, Home edition, Version 2002, Service Pack2
Computer:Pentium 4 CPU, 3GHz, 1 GB of RAM
Desktop
#2
08/21/2009 (9:34 pm)
"It only happens to things loaded from JPEG in the game -- never to PNGs"

Could be some type of bug with the decompression of the JPEGs on that graphics card... Just use PNGs!
#3
08/21/2009 (11:22 pm)
"Just use PNGs" is not an acceptable solution... my game's download size is already nearly 50 MB. It would increase quite a bit if I converted all JPEGs to PNGs. I'd like to go the other way instead -- convert many of my PNGs to JPEGS with an alpha mask. (Haven't figured out how to get the alpha mask to load yet though -- see my other thread.)

So the JPEG is decompressed in hardware, versus software?
#4
08/21/2009 (11:31 pm)
Well there are ways to compress PNGs and they tend to look better.. you say the issue doesn't occur with PNGs. Sometimes it's just easier to move around an issue and use a known alternative solution rather than try to wrestle with the problem head on.

As far as I know JPEG is never decompressed in hardware. Is this person using the latest drivers for their graphics card? Is it only this one person reporting the issue?
#5
08/22/2009 (7:08 pm)
All these graphic formats are decompressed with pure software, and the result has the same alignment of data, so I don't see why JPEG should fail because of the graphics card. There must be some other issue.

The wrong image above is 16x the upper left corner of the right one - try full clean and rebuild of the source, or try replacing the JPEG sources with the latest version from the creators.
#6
08/22/2009 (11:05 pm)
Some graphics cards and drivers handle image data in different ways. I'd be interested to know if this happens in both OpenGL and DirectX mode. If it doesn't happen when they run the game in DirectX mode, then you know it's the OpenGL driver... if it happens in both I would guess it could be a corrupt image file on that users machine and they should try a fresh installation..
#7
08/23/2009 (6:12 am)
Try making the width and height of the jpg that is doing that to numbers that are a power of 2, for example 1024 x 768 or 640 x 480 and see if it still happens. Just a wild guess.
#8
08/26/2009 (11:05 pm)
Have you tried to change the JPG Compression Settings?

I already in past had a problem similar to this when using Progressive JPEGs!

Please tell me if this works!
#9
08/27/2009 (2:31 pm)
Nope, the JPEGs I was using weren't progressive. I even tried re-saving them in another program to see if it was a particular format that was causing the problem... that didn't seem to be it.

Also, I load a number of JPEGs that seem to work ok... and the funny thing is, the ones that don't work ARE nice powers of two.
#10
08/27/2009 (5:42 pm)
Interesting. I know that the Mac build of TGE and TGB had issues with progressive JPG's, but I haven't been seeing problems without that option.

Could you send me one to test out?
#11
08/27/2009 (6:34 pm)
I once had a problem with several apps (none of which were Torque, unfortunately) being unable to open a JPEG image. Turns out that Photoshop will let you save a CMYK JPEG, but quite a few apps choke on that; the fix was to switch the image to RGB color in PS, then re-export a new JPEG.
#12
08/27/2009 (8:15 pm)
@Sherman - Interesting. Is there a way to tell if a given JPEG file is CMYK versus RGB? I have Photoshop Elements, but I don't see any way of determining the file's format. When I open it it Photoshop, however, Photoshop appends "(RGB") to the end of the file's name in the title bar of the window. But I don't know if that is the file's original format, or it just converts it to that when opening it.

@David - Two of the "problem files" are here. Again, this is on one user's computer -- it hasn't happened on my setup or the other tester's setups.

www.actionsoft.com/files/images/buyNowScreenBackground.jpg

And this:

www.actionsoft.com/files/images/starmap_background.jpg

ALSO, if anyone else reading this thread wants to try these images in your own copy of TGB (just add 'em as any normal ImageMap) let me know if any of you can duplicate the problem!
#13
08/30/2009 (12:47 pm)
TGB shows both images without a problem on my Vista machine (GeForce 6150SE gfx card). Is there any possibility that your user needs to update their drivers?
#14
08/30/2009 (1:34 pm)
@Robert: Very good suggestion, but of the four numbers you mention, only 1024 is a power of two. The others - 768, 640, and 480 - are not.

@Vern: Have you tried resizing your images so that both dimensions are a power of two?
#15
09/09/2009 (4:55 pm)
**Update**

I have gotten the images to work by forcing an alpha channel on them. That is, I add a pure-white image.alpha.jpg to the game, change managed/datablocks.cs to not have the image's expension (such as .png or .jpg) in the filename, so it'll load the image and alpha mask. And I save the alpha.jpg image in 8-bit JPEG. That seems to fix the problem.

The odd thing is that some JPEGs seem to work for this user, but he doesn't reply to me very often, so it's hard to be sure what the problem is. I don't think it has anything to do with a power of two. One image is 800x741, another 800x740, and both apparently work, along with others that are other sizes.