[PSXSDK] PSX shows TIM file less bright than it should be

Graphic based area of development (Graphics Processing Unit), including the Geometry Transform Engine (GTE), TIM, STR (MDEC), etc.
Post Reply
blasdg
What is PSXDEV?
What is PSXDEV?
Posts: 2
Joined: June 2nd, 2017, 3:13 am

[PSXSDK] PSX shows TIM file less bright than it should be

Post by blasdg » June 2nd, 2017, 5:50 am

Hello, so problem is psx show image colors instead of 255 255 255 shows 248 248 248, 192 192 192 stay the same,127 is 120,29 is 24...
Luminosity is set to 128(standard luminosity)
When i change luminosity from 128 to for example 255 then it show white but problem is everything is little brighter than it should be.

This is what i do:
1.Save image as s X1/A1 R5 G5 B5 BMP in gimp.
pluge2.bmp
2.Convert BMP/png to TIM(via bmp2tim,img2tim,timtool,it doesn't matter,i got the same result)(I tried 4bpp,8bpp,16bpp,again same result).
3.Set TIM position.
4.Set CLUT position(tried without making clut and it doesnt affect result).

Code

Code: Select all

void upload_sprite(GsImage *image,GsSprite *sprite,const char *path) {

	FILE *f = fopen(path,"rb");
	fseek(f,0,SEEK_END);
	int fsize = ftell(f);
	fseek(f,0,SEEK_SET);

	fread(data_buffer,sizeof(char),fsize,f);
	fclose(f);
	GsImageFromTim(image,data_buffer);
	GsUploadImage(image);

	GsSpriteFromImage(sprite,image,1);
}

Code: Select all

void Pluge() {

	GsImage image1,image2;
	GsSprite sprite1,sprite2;

	upload_sprite(&image1,&sprite1,"cdrom:\\pluge1.TIM;1");
	upload_sprite(&image2,&sprite2,"cdrom:\\pluge2.TIM;1");

	sprite1.x = 0; sprite1.y = 0;
	sprite1.w = 160; sprite1.h = 240;
	sprite1.r = sprite1.g = sprite1.b = 128;
	sprite1.attribute = COLORMODE(COLORMODE_16BPP);

	sprite2.x = 160; sprite2.y = 0;
	sprite2.w = 160; sprite2.h = 240;
	sprite2.r = sprite2.g = sprite2.b = 128;
	sprite2.attribute = COLORMODE(COLORMODE_16BPP);

	while(1) {
		if(display_is_old) {
		dbuf=!dbuf;
		GsSetDispEnvSimple(0, dbuf ? 0 : 256);
		GsSetDrawEnvSimple(0, dbuf ? 256 : 0, 320, 240);
		GsSortCls(0,0,0);

		GsSortSprite(&sprite1); 
		GsSortSprite(&sprite2);

		GsDrawList();
		while(GsIsDrawing());
		display_is_old = 0;
		}
	}
}
Here is TIM file
http://www.mediafire.com/file/085ta56sl ... utclut.tim
You do not have the required permissions to view the files attached to this post.

User avatar
Orion_
Legendary Programmer
Legendary Programmer
Posts: 228
Joined: August 13th, 2012, 2:48 am
I am a: Programmer
PlayStation Model: Net Yaroze
Location: France
Contact:

Re: [PSXSDK] PSX shows TIM file less bright than it should b

Post by Orion_ » June 2nd, 2017, 8:00 am

the psx works mainly in 16 bits mode
in 16bits mode you don't have 0-255 range
you have 0-31 range (5bits, because 5bits * 3 (r,g,b) + 1 bits (transparency) = 16bits )
if you want to know the value of your color in 16bits, just divide your 0-255 value by 8, truncate the floating number and multiply it again by 8 (255 / 8 = 31 -> 31 * 8 = 248)
you might want to try 24bits mode but it's not as flexible as 16bits, usually the 24 bits mode on PSX is used for video playback or just display a title screen, if you use sprites in 24bits mode you don't have the transparency for example

now, that said, on a real psx (not emulator) the maximum value (31) should show a bright white
it's only on emulators that the 31 value while convert back to 248 because PC works as 24bits, not 16bits
(and only on bad emulators because, good emulators should use a good conversion and make the 31 value like 255, usually we repeat the first 3 MSB of the value in the lower part of the 8 bits number: 5bits ABCDE -> 8bits ABCDEABC)
Retro game development on Playstation and other consoles http://orionsoft.free.fr/

blasdg
What is PSXDEV?
What is PSXDEV?
Posts: 2
Joined: June 2nd, 2017, 3:13 am

Re: [PSXSDK] PSX shows TIM file less bright than it should b

Post by blasdg » June 3rd, 2017, 7:07 am

Thanks for your explanation.
I changed in pcsxr texture quality to R5 G5 B5 A1 and now it works,thanks for your help.

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests