Strange behaviour in color of the images????

BlitzMax Forums/BlitzMax Beginners Area/Strange behaviour in color of the images????

orgos(Posted 2005) [#1]
Im goin crazy.

I create an image 800x600 in photoshop, when i export
this image in PNG format, the image on the screen
program in BMax change the colors. I mean the image is
blue tones when I see it in photoshop and ACDsee and
on BMax the images look like green tones.

I used 1.10 version, on a Pentium 3, 800mhz, 4mb of
Video, Windows 2000, directx 9. Mi desktop screen
depth is 16 bits.

The PNG image was created by two ways SAVES AS, and
SAVES FOR WEB, and the same problema apear.

Making other test, I save the image in BMP format 16
and 32 bits and the image is not visualize. In 24 bits
option the image apear but with the green tones.

Then when I try with PCX format, appear an error:
"Unhandle Exceptio: Attemp to access field or method
of Null object".

I post this Topic because the images work fine in
Blitz3d.

Here the code source un Blitz3d:

Graphics 800,600,16
SetBuffer BackBuffer()
a = LoadImage("images/background.bmp")

Repeat
DrawImage a, 0, 0
Flip
Until KeyHit(1)
End


Here the code in BMax:
Graphics 800,600,16
a = LoadImage("images/background.bmp")

Repeat
DrawImage a, 0, 0
Flip
Until (KeyHit(KEY_ESCAPE))
End



P.D. Sorry about mi english.


Gabriel(Posted 2005) [#2]
It seems unlikely, but you could try inserting a SetColor 255,255,255 before the DrawImage. DrawImage in BlitzMax is affected by the current color, and in B3D, it is not.


orgos(Posted 2005) [#3]
Nothing

I put the SetColor 255,255,255, out and in the main Loop, and the images do the same.

In blitz3d the image look perfect, width the same colors depth, but in BMax no. :(


Perturbatio(Posted 2005) [#4]
posting the image would be a good idea.

Then when I try with PCX format, appear an error:
"Unhandle Exceptio: Attemp to access field or method
of Null object".

unsurprising since BMax doesn't support PCX.


orgos(Posted 2005) [#5]
How i can post the image??

But the problem is on BMax, because B3d show the image as it is.


Who was John Galt?(Posted 2005) [#6]
Dodgy OpenGL drivers?


Perturbatio(Posted 2005) [#7]
How i can post the image??

upload it to a webserver and use the forum codes to link to it.


orgos(Posted 2005) [#8]
Default drivers.

I don't define any driver, look the BMax source code above.


Perturbatio(Posted 2005) [#9]
he's talking about your graphics card drivers (which is the cause of most graphical problems in BMax)


orgos(Posted 2005) [#10]
My card drives is 4mb of video, a ******, i test the same program on two diferente machines with the same amount on video memory (4mb), the graphic card is ON-BOARD, and the drivers are instaler in right form.


Gabriel(Posted 2005) [#11]
My card drives is 4mb of video, a ******, i test the same program on two diferente machines with the same amount on video memory (4mb), the graphic card is ON-BOARD, and the drivers are instaler in right form.



Change Graphics 800,600 to 640,480 or even 320,200 and see if that makes any difference. It's possible you're using more videoram than you have.


Mr. Write Errors Man(Posted 2005) [#12]
I think I experienced distorted colors with PNGs in BlitzPlus. If I recall correctly, saving the PNGs as 24bit image (instead of 32bit) "fixed" it.

It occured with Geforce 4, so lack of memory was not the cause.


orgos(Posted 2005) [#13]
I change the resolution to 640x480 and nothing occur, the same altered image. I don't think that this is video ram problem, because se same image diplay good in B3d.

The PNGs images are saved in 8 bits (256 colors), the PNG image saved as 24 bits in B3d show fine, but in BMax, grrr the same problem.

I upload to site both images, the image called good.jpg is that i show in B3d, and the other "wrong.jpg" in BMax, both images has capture by PRINTSCREEN Key, and then was saved in JPG format.

good == http://www.box.net/public/pepilla2/files/224561.html

worng == http://www.box.net/public/pepilla2/files/224560.html


Also i upload the orignals images saved as 8, 24 and 32 bits in photoshop.

image8.png == http://www.box.net/public/pepilla2/files/224568.html

image24.png == http://www.box.net/public/pepilla2/files/224570.html

image16.bmp == http://www.box.net/public/pepilla2/files/224572.html

image24.bmp == http://www.box.net/public/pepilla2/files/224569.html

image32.bmp == http://www.box.net/public/pepilla2/files/224571.html


ImaginaryHuman(Posted 2005) [#14]
Anything to do with the alpha channel messing things up?


Dreamora(Posted 2005) [#15]
If you have a 4mb card: Do you use 16bit? Blitz3D does dithering there which might "interpolate" the errors with the missing colors. BM does not dither so it will look wrong.

check out your picture in 16bit in Photoshop to see if it looks still the same.


tonyg(Posted 2005) [#16]
I get the same problems with the same images with 9800 pro (128mb). It seems to be something to do with the gradient colours.
B3D 1.90 with depth=16 shows it OK while BMax doesn't.
Change Bmax to 32 colour depth and it looks better.
Not sure what's happening though.


Gabriel(Posted 2005) [#17]
If it only happens in 16 bit color, it's probably pixel format confusion. 16 bit color can be represented in a number of ways, but most often either 5-6-5-0, 5-5-5-1 or 4-4-4-4. Somewhere along the line, I'm guessing that the formats are being confused, which would explain why blue color information is being displayed as green instead.

EDIT: I can't say if this is a bug with Blitz or if the 4MB ( presumably ancient ) videocard is simply not capable of rendering 5:6:5 ( which is probably what BMax is trying to use. ) I know some old cards only support 5:5:5 pixel format for 16 bit color. That wouldn't explain TonyG's Radeon tho.


FlameDuck(Posted 2005) [#18]
If you have a 4mb card: Do you use 16bit?
Yes he does, that's what "Graphics 800,600,16" means. A 16 bit 800 x 600 display.

It works perfectly here, although there is some rather serious banding issues due to the 16-bit display, it is however much less severe than in your screenshot.

I'm going to go with awful gfx-card and/or drivers.


ImaginaryHuman(Posted 2005) [#19]
I was going to say also that it initially looks like the kind of effect you might get by displaying it in 16-bit and the OpenGL or graphics driver trying to convert the color resolution from 24bit to 16bit. It looks like you don't have dithering switched on, otherwise you might end up with a possibly more pleasant gradient. It does look pretty bad even for a 16 bit approximation.


orgos(Posted 2005) [#20]
The problem not is the gradient look bad in 16 or 24 bits, the problem is the color altered.

So BMax do not support the 5,5,5 format?? that is no backguard compatibility for old cards??

Why BMax no use the same tecnology to display images that B3d. I mean use the same maner to show and read the images. I supose that is a compatibility BUG.

I think that a good game no need necesary a big VIDEO CARD. With 4mb of VIDEO many good games run.

So, in case that BMax can change the way to read and show the images, what can I do? because the problem is not only with PNG files, the BMP files show in bad way too.

:(


Who was John Galt?(Posted 2005) [#21]
Try using Direct3D(Direct X) for your graphics. You'll have to search the forums to find out how to do this - I haven't tried.


orgos(Posted 2005) [#22]
Some one can test the image on other SO, Mac or Linux??


FlameDuck(Posted 2005) [#23]
The problem not is the gradient look bad in 16 or 24 bits, the problem is the color altered.
Really? It doesn't look like it on those images posted above.

I was going to say also that it initially looks like the kind of effect you might get by displaying it in 16-bit and the OpenGL or graphics driver trying to convert the color resolution from 24bit to 16bit.
Or rather, it looks like the kind of effect you might get when BlitzMAX has to downsample the huge image, to fit within the limitations of your obsolete hardwares texture unit and memory.

Why BMax no use the same tecnology to display images that B3d.
Because in BlitzMAX, all images are actually textures, not DirectDraw textures. This allows for hardware accelerated blending, lighting and transformation, on hardware produced with the last decade.

that is no backguard compatibility for old cards??
Yes. Just not for obsolete ones. BlitzMAX requires at least an OpenGL 1.1 or (on Windows) a DirectX7 capable card, with working (and preferably Microsoft certified) drivers.

I think that a good game no need necesary a big VIDEO CARD. With 4mb of VIDEO many good games run.
Name one.


orgos(Posted 2005) [#24]

I think that a good game no need necesary a big VIDEO CARD. With 4mb of VIDEO many good games run.

Name one.



Diablo, Diablo 2 (use polygons), Starcraft, Ricochet, Wik and the Fable of Souls, Gets and Guns..... and other much tiny games that can make people have fun.

All the game that i cite, are good games.


I test the same images on B3d with nSprites and the images look well, nSprites use polygons and set the images as texture. nSprite can blend, lighting and trasnform the images too.



Or rather, it looks like the kind of effect you might get when BlitzMAX has to downsample the huge image, to fit within the limitations of your obsolete hardwares texture unit and memory.



This appear that BMax is to sophisticated and no look back or "tooo back".


My graphic card drivers are the original drivers distributed by the mother board divers CD. And work well.


I note some strange thing, all the examples in BMax run well, and the images look well.
Some idea???


FlameDuck(Posted 2005) [#25]
Diablo, Diablo 2 (use polygons), Starcraft, Ricochet, Wik and the Fable of Souls, Gets and Guns..... and other much tiny games that can make people have fun.
Well I'll take your word for it since a) I've only heard about 3 of those, only actually own one (StarCraft) and b) even if I did have the rest, I wouldn't have a 4MB card to test them on. Incidently Diablo II requires 8MB of video memory for hardware accelerated 3D, according to Blizzard.

I note some strange thing, all the examples in BMax run well, and the images look well.
Strange indeed.


orgos(Posted 2005) [#26]
Well I'll take your word for it since a) I've only heard about 3 of those, only actually own one (StarCraft) and b) even if I did have the rest, I wouldn't have a 4MB card to test them on. Incidently Diablo II requires 8MB of video memory for hardware accelerated 3D, according to Blizzard.


Blizzard can say that, but Diablo II run on mi two machine, and run well. I have 4mb of Video but 512 of RAM.

Is very SAD for me, i no want to program my game in B3d with nSprite, and i no want change for other game engine or game maker.

BMax is very good, but this problem is very sad to me.


Gabriel(Posted 2005) [#27]
My graphic card drivers are the original drivers distributed by the mother board divers CD. And work well.


If you refuse to update your drivers, you can hardly start blaming other people for your problems. When you've done everything possible on your computer, which includes using the latest drivers available, then it's a different matter.

I still think it's probably that your card is so old that it doesn't support 5:6:5 pixel format, but updated drivers still might fix that.


orgos(Posted 2005) [#28]
I'm Back :D

Well I test the same program with the same image on the same machine but with Windows XP, and the image look good.

Before i download the lastest drivers for my graphic card and the images look bad. (Intel (R) 82815). Acording to Open GL it hardware are supporter.

Another test that i make. I create an image with 800x600 or 480x300 or any size, then I fill with #2C3239 color, save in any format BMP or PNG and the images look bad, with the filler color in green.

Some idea??


Mr. Write Errors Man(Posted 2005) [#29]
Older games run fast on older computers because they are pure 2D. BlitzMax is based on 3D. In my yet limited experience BlitzMax is slower than BlitzPlus on my two (a bit old) home computers.


orgos(Posted 2005) [#30]
Yes i know it.

And what?

I don't want use BlitzPlus, in case i prefer use Blitz3d with nPrite, in other case I prefer user other soft like pureBasic for 2d, but I want make some games with BMax because the features.


ImaginaryHuman(Posted 2005) [#31]
It may be, perhaps, that some older games have a seperate software renderer to support older hardware using more primitive techniques. Perhaps that's why that game runs on your system.

In BlitzMax, using OpenGL, you are only a very short distance from drawing everything in 3D. If you applied rotation around any of the axes for any DrawImage or any shape, you would see it rotate in perspective. OpenGL is doing a lot more calculations in order to present it to you as a 3D-capable object, even if it is only facing you head-on. Also OpenGL does a lot of other work too, conversion to/from floating point, coloring, matrix transformations, texturing, etc... a lot more work than a custom-written software routine using the old-school method. It does need better hardware to be comfortably fast, but once you DO have that better hardware, at some point there is a tradeoff where the OpenGL method is faster than the old-school method.

I was disappointed too when I found out that on my iBook, it has only a software OpenGL driver which is very slow because the iBook is only a 300Mhz G3 processor which is used for the graphics. Doing anything other than something *extremely* simple graphics-wise is slow on there. When I switch to my iMac with a 1GHz G4 and an accelerated graphics card, it can be up to 100 times faster. This is the way computers are heading nowadays, they will only continue to get faster and faster graphics cards.