gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > Texture corruption

#62331 - thos_thom - Tue Nov 29, 2005 6:09 pm

I have been working on a 3d landscape engine which i have working now, with great help from the ++many tutorials that came with devkitpro. I have complex structures texture mapped and lighting (with proper normals and everything), loaded from a structure.

I'm about to dive into the collisions and some physics simulations but i cant help but notice that my textures seem to come out strange colours. Just slighty off what they should be, or in some cases completly wrong colours.

i'm using libnds and code from the nehe conversion tutorials for loading textures.

My textures are drawn as full color pngs then converted to pcx indexed using photoshop (some really old cut down version).

Could it be photoshop doing somthing strange? has anyone else seen this?

thanks
_________________
--------------
^thom(as)?
--------------

#62334 - rmco2003 - Tue Nov 29, 2005 6:53 pm

Corel Paint Shop Pro X can open and use both PNG and PCX formats, I'd reccomend giving that a try, I've had success with using it on some GBA demos I've made in the past.

#62338 - dovoto - Tue Nov 29, 2005 7:44 pm

Just how wrong is wrong?
_________________
www.drunkencoders.com

#62414 - duencil - Wed Nov 30, 2005 7:20 pm

A lot of the low contrast details get lost in the drop to 15 bit, something you cannot preview in photoshop. Might it just be that you're seeing? I use an external converter for my images, to do the drop to 15 bit before palettization, using the excellent freely available cximage library. That way I can preview the converted image, and retouch it when necessary.

#62424 - tepples - Wed Nov 30, 2005 8:59 pm

duencil wrote:
A lot of the low contrast details get lost in the drop to 15 bit, something you cannot preview in photoshop.

Posterize to 32 levels per channel and see what that doesn't do.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#62450 - duencil - Thu Dec 01, 2005 12:36 am

Now that's interesting. Any idea about the method photoshop uses for calculating posterized rgbs? iIt should help to keep the pcx loader consistant.

#62460 - tepples - Thu Dec 01, 2005 5:25 am

duencil wrote:
Now that's interesting. Any idea about the method photoshop uses for calculating posterized rgbs?

I don't use Photoshop, but GIMP seems to use the following formula:
Code:
round(pixelvalue * (posterlevels-1) / 255.0) * 255 / (posterlevels-1)


The integerized version of this formula is
Code:
((pixelvalue * (posterlevels-1) + 127) / 255 ) * 255 / (posterlevels-1)

_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.