Author Topic: About PSX field background.  (Read 7819 times)

Akari

  • *
  • Posts: 766
    • View Profile
About PSX field background.
« on: 2006-11-13 13:24:22 »
Hello, I'm back with another questions =)
I start working with PSX backgrounds (at last  8-)) and not quite understand how it works.

In section 3 of field files there are 4 subsection.
First are strange one...
4000 0000 0A00
5000 0A00 0B00
6000 1500 0B00
7000 0000 0B00
8000 2B00 0B00

First two bytes seems signed value (probably coords), the next one is the sum of previous second value an third value.
What the hell is this subsection?

Second subsection is the first layer (back one).
10FF 4000 00 00 0078
20FF 4000 10 00 0078
30FF 4000 20 00 0078
40FF 4000 30 00 0078

First value here are X destination, the second are Y destination value.
Next are source X and Y.
But how decode 0x7800?
000000xx xx000000 X bytes of it are related to texture page and clut... but I cant understand how. Any guesses?

Third subsection are the strangest one. It contains something like this:
8800 8900 8A00 8B00 8C00 8D00 8E00 8C00 8D00
Can't get it at all.

Last subsection are top layer it 14 bytes long, but I dont actualy looked at it.

Can anyone give me some help?

Cyberman

  • *
  • Posts: 1572
    • View Profile
Re: About PSX field background.
« Reply #1 on: 2006-11-13 16:29:41 »
Hello, I'm back with another questions =)
I start working with PSX backgrounds (at last  8-)) and not quite understand how it works.
That makes 2 of us :D
In section 3 of field files there are 4 subsection.
First are strange one...
4000 0000 0A00
5000 0A00 0B00
6000 1500 0B00
7000 0000 0B00
8000 2B00 0B00
First two bytes seems signed value (probably coords), the next one is the sum of previous second value an third value.
What the hell is this subsection?
Glad you asked, I don't know BUT (see that but keep it in mind) it might be offsets for sprites relative to the center of the scene.
Second subsection is the first layer (back one).
10FF 4000 00 00 0078
20FF 4000 10 00 0078
30FF 4000 20 00 0078
40FF 4000 30 00 0078

First value here are X destination, the second are Y destination value.
Next are source X and Y.
But how decode 0x7800?
000000xx xx000000 X bytes of it are related to texture page and clut... but I cant understand how. Any guesses?
Right and these ARE SIGNED, remember that!  They are signed from the center of the scene (see section 1 as I think it relates to how the scene coordinates are abused).  So negative X and Y values are left and down from screen center.  Simple huh? :D
The Palettes are a pain, I never quite beat those however the palletes are loaded from the MIM file right? the best way to look at how the MIM is loaded and used (trust me it's weird) is to view the PS1's memory first the palettes are loaded to a location in PS1 VRAM then the tiles are loaded directly to VRAM.  They are in texture pages however.  I remember breaking them up into either 128x128 tile sets, vertically and horizontally.  The upper row and lower row etc.  The offsets are from texture pages.  You can have quite a few pages. The PS1's VRAM is 1024x512 pixels (WORD sized).  The tiles I believe were dumped beside the image (here it is look at this image). They filled from right to left.  Tles are 8x16 because a tile is 8 words across.  The screen is 320 pixels this allows for 11 x 2 or 22 texture pages from the FF7 screen it's really 10x2 or 20 the palettes are kept below the display leaving just about 20 256 pixel lines for palettes.
Let's assume the first texture page refers to the first clut, AND the first 256 tiles belong to the first texture page (which in the PS1 is 256x256), I recomend using those two thoughts to decipher it. I lost all my source code in a crash (grumble), so how I worked it out was twiddling the palettes.  I set the tile sections up and tweaked the sets based on my idea of the ordering of the palettes then examined the data.  There are several ways one can interpret how they are read. (mutter).
Third subsection are the strangest one. It contains something like this:
8800 8900 8A00 8B00 8C00 8D00 8E00 8C00 8D00
Can't get it at all.

Last subsection are top layer it 14 bytes long, but I dont actualy looked at it.

Can anyone give me some help?
Sprite and animated tile section the fouther one I couldn't get.
Basicly it's very similiar to the prior section save it includes information which layer and frame it belongs too.
You will notice they go over the same spots several times (animated sections).  Doors and things like that use them.

Cyb

Synergy Blades

  • Guest
Re: About PSX field background.
« Reply #2 on: 2006-11-13 16:41:09 »
Quote
You will notice they go over the same spots several times (animated sections).  Doors and things like that use them

Yep, check the BGOFF/ON/ROL(2) ops for these, since the parameter to them (background 'area') is coded into the sprite structure for the backgrounds where the anims are used.

halkun

  • Global moderator
  • *
  • Posts: 2097
  • NicoNico :)
    • View Profile
    • Q-Gears Homepage
Re: About PSX field background.
« Reply #3 on: 2006-11-13 17:38:13 »
To better see the textures, here's an image of VRAM with the palettes corrected.



The PSX VRAM is a matrix of texture caches, pictured here..


According to Gears....
Quote
All the blank rectangles are the texture cache boundaries. In order of volatility, the top two rows of cache space are overwritten from left to right, and then the bottom rows are overwritten. The textures on the bottom right are barely overwritten except for key places.


Akari

  • *
  • Posts: 766
    • View Profile
Re: About PSX field background.
« Reply #4 on: 2006-11-14 14:49:03 »
In section 3 of field files there are 4 subsection.
First are strange one...
4000 0000 0A00
5000 0A00 0B00
6000 1500 0B00
7000 0000 0B00
8000 2B00 0B00

First two bytes seems signed value (probably coords), the next one is the sum of previous second value an third value.
What the hell is this subsection?

Few news about this block.
This is rows of sprites. I don't know why are they here and what are they needed to. The same info can be found directly in 1st layer section.

1st is the Y position of row (the same as in the all sprites of this row in section 1st layer)
2nd is the number of first sprite in row.
3rd is the number of sprites in row.

blocks of rows separated by 0xFEF7 xxxx 0000
xxxx - is the clut number for this block of rows. This info too can be found in 1st layer sprite info.

And I still haven't fount texture page info.
For example this is how clut and texture page assosiated in MD1STIN... but in others files they are comleatly different.
+---+---+---+---+---+---+---+---+
| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 9 |
| 0 | 1 | 2 | 3 | 7 | 8 | A | B |
+---+---+---+---+---+---+---+---+
I'm clueles for now.

Right now I'm rewriting Tim and Mim class because Mim can has multiple blocks of data (like sprites in xenogears).

halkun

  • Global moderator
  • *
  • Posts: 2097
  • NicoNico :)
    • View Profile
    • Q-Gears Homepage
Re: About PSX field background.
« Reply #5 on: 2006-11-14 17:32:21 »
MIM is a Square extention, and not a Psy-Q lib format like TIM. Careful, that can get real unstandard really quick

That whole format sounds awful PSX GPU opcodeish. I'm taking a peek at my PSX doc now.

Take a look at the video section in my PSX doc (I'm at work, so I can't do a very good hypothisys)
« Last Edit: 2006-11-14 17:46:01 by halkun »

Akari

  • *
  • Posts: 766
    • View Profile
Re: About PSX field background.
« Reply #6 on: 2006-11-14 19:44:25 »
MIM is a Square extention, and not a Psy-Q lib format like TIM. Careful, that can get real unstandard really quick

That whole format sounds awful PSX GPU opcodeish. I'm taking a peek at my PSX doc now.

Take a look at the video section in my PSX doc (I'm at work, so I can't do a very good hypothisys)

Yeah, this is the first thing I did, but now it starts makes sense. I found this in PSX memory:
10FF 5000 3010 0078 0000 0003 8080 807D
it seems that they use 0x7D packet to set sprite. It fits quite well =)
but in description for field 0x3010 0078 I see "CULT ID + texture coordinates page y,x" But how the hell I must set texture page?
In the polygon packets there are field for that, but here are not... =(

Akari

  • *
  • Posts: 766
    • View Profile
Re: About PSX field background.
« Reply #7 on: 2006-11-16 13:26:59 »
Found small article about sprite in PSX
http://www.horningabout.com/jimb/psx/

Quote
That takes the parameters need to draw a sprite. r, g, and b are obviously the colors to draw with. code is one of :
0x74 - 8x8 sprite
0x7c - 16x16 sprite
x and y are the destination coordinates to draw to. u and v are the Texture coordinates within the current Texture Page (defined with GPU command 0xe1). And clut is the address of the color lookup table, where the high 10 bits (0xFFC0) are the Y and the low 6 (0x003F) are the x coordinate / 16.

So they or used some algoritm to set tex page or defined it in 1st block. I'm back to where I started.  :x

Cyberman

  • *
  • Posts: 1572
    • View Profile
Re: About PSX field background.
« Reply #8 on: 2006-11-16 15:26:05 »
I told you it wasn't easy Akari!

Anyhow I think it's embeded in the bit fields.

As I suggested before you examine your hex data carefully after you have you sections aligned correctly.  It also helps to TAG your tiles (in other words draw up a seperate window with the tiles in it and paste borders and numbers on each tile and do the same to the background image). Set your palettes and you should be in business. This is how I got very close to getting it right, however the thread that it was discused in a LOT is in Tech-related somewhere.

You may need to do a lot of bit shifting of your numbers as memory serves.

Cyb

Akari

  • *
  • Posts: 766
    • View Profile
Re: About PSX field background.
« Reply #9 on: 2006-11-17 07:18:56 »
Hurraaay ^__^

I think I'm close to solve this puzzle. The third section is texture page info for first layer. Not the animated sprite  :-P

Code: [Select]
8800 8900 8A00 8B00 8C00 8D00 8E00 8C00 8D00

Akari

  • *
  • Posts: 766
    • View Profile
Re: About PSX field background.
« Reply #10 on: 2006-11-17 15:43:28 »


Mwahaha =)

nope

  • *
  • Posts: 56
  • nope
    • View Profile
Re: About PSX field background.
« Reply #11 on: 2006-11-17 18:27:46 »
Are those background filtered? They don't look as pixelated as usual :-P

Akari

  • *
  • Posts: 766
    • View Profile
Re: About PSX field background.
« Reply #12 on: 2006-11-17 19:03:32 »
Are those background filtered? They don't look as pixelated as usual :-P

Nope. This is as the picture is.

Cyberman

  • *
  • Posts: 1572
    • View Profile
Re: About PSX field background.
« Reply #13 on: 2006-11-17 19:39:19 »
Are those background filtered? They don't look as pixelated as usual :-P
I apologize on behalf of Akari for not including the acuracy of a pixelated background ;)
Hurraaay ^__^

I think I'm close to solve this puzzle. The third section is texture page info for first layer. Not the animated sprite  :-P

Code: [Select]
8800 8900 8A00 8B00 8C00 8D00 8E00 8C00 8D00
Duh... Ok .. then what is the fourth section for? Argh... I wish I had my old code dangit!
Alas it's gone. Ok... hmmm next time you update the source I'll update the wiki for you.  I will work on integrating my code with the rest of the code sometime this weekend (yeah right).

Cyb

Akari

  • *
  • Posts: 766
    • View Profile
Re: About PSX field background.
« Reply #14 on: 2006-11-17 20:48:45 »
Ok .. then what is the fourth section for?

The section 4 is the second layer. The info about rows in it are stored in first section after 0xFF7F
The format of 4 section resembles one in section 2 but after info like in section 2 goes texture page info (2 bytes) and then goes some flags (4 bytes)... that's all.

Akari

  • *
  • Posts: 766
    • View Profile
Re: About PSX field background.
« Reply #15 on: 2006-11-27 11:38:08 »
Quote
Ok... hmmm next time you update the source I'll update the wiki for you.

I already update SVN  :wink:

Cyberman

  • *
  • Posts: 1572
    • View Profile
Re: About PSX field background.
« Reply #16 on: 2006-11-27 15:20:56 »
I started working on it Saturday and noticed it wasn't updated I'll look later today and start that. :D

Wiki updated

Cyb
« Last Edit: 2006-11-27 22:08:54 by Cyberman »