How to do texture tiling?

Graphic based area of development (Graphics Processing Unit), including the Geometry Transform Engine (GTE), TIM, STR (MDEC), etc.
Post Reply
masmorra
Donator & Supporter
Donator & Supporter
Posts: 20
Joined: Oct 15, 2020

How to do texture tiling?

Post by masmorra » September 14th, 2024, 1:34 pm

There is a way to achieve texture tiling? I have a 256 texture and I want o make 32x32 repeat on the polygon, but I only got the other part of the texture:

my uv is:

Code: Select all

DVECTOR uvs[4] = {
	{ 0, 127 },
	{ 127, 127 },
	{ 127, 0 },
	{ 0, 0 },
};

Code: Select all

RECT texRect = {0, 0, 32>>3, 32>>3};
DR_TWIN* ptwin = (DR_TWIN*)db_nextpri;
setTexWindow(ptwin, &texRect);
addPrim(_orderingTable, ptwin);
ptwin++;
db_nextpri = (uint8_t*)ptwin;
GeometryType *pol4 = (GeometryType *)db_nextpri;
// Load the first 3 vertices of a quad to the GTE
gte_ldv3(
    &values[0],
    &values[1],
    &values[2]);
// Rotation, Translation and Perspective Triple
gte_rtpt();
...
...
...
pol4->tpage = getTPage(texture->mode, 0, texture->prect->x, texture->prect->y);

if (texture->mode & 0x8)
{
    // Set CLUT
    setClut(pol4, texture->crect->x, texture->crect->y);
}
// setUV3 1, 0, 2
pol4->u0 = uvs[0].vx;
pol4->v0 = uvs[0].vy;

pol4->u1 = uvs[1].vx;
pol4->v1 = uvs[1].vy;

pol4->u2 = uvs[2].vx;
pol4->v2 = uvs[2].vy;
The result is this:
texture-tiling.png
You do not have the required permissions to view the files attached to this post.

User avatar
Administrator
Verified
Admin / PSXDEV
Admin / PSXDEV
Posts: 2683
Joined: Dec 31, 2012
I am a: Shadow
PlayStation Model: H2000/5502

Post by Administrator » September 16th, 2024, 3:54 pm

If I'm not mistaken, the PSX can only natively support a texture size of 128 x 128. Larger textures need additional methods.
Development Console: SCPH-5502 with 8MB RAM, MM3 Modchip, PAL 60 Colour Modification (for NTSC), PSIO Switch Board, DB-9 breakout headers for both RGB and Serial output and an Xplorer with CAETLA 0.34.

PlayStation Development PC: Windows 98 SE, Pentium 3 at 400MHz, 128MB SDRAM, DTL-H2000, DTL-H2010, DTL-H201A, DTL-S2020 (with 4GB SCSI-2 HDD), 21" Sony G420, CD-R burner, 3.25" and 5.25" Floppy Diskette Drives, ZIP 100 Diskette Drive and an IBM Model M keyboard.

User avatar
nocash
Verified
PSX Aficionado
PSX Aficionado
Posts: 604
Joined: Nov 12, 2012
Contact:

Post by nocash » September 17th, 2024, 5:48 am

The limit is 256x256 (or perhaps something like 255x255 in practice), not 128x128.
Either way, 32x32 doesn't exceed those limits.
The GPU has MASK and OFFSET features for sizes like repeating 32x32 textures.
If your 32>>3 is meant to set the MASK, try replacing it by 31/8, or (255-31)/8.

masmorra
Donator & Supporter
Donator & Supporter
Posts: 20
Joined: Oct 15, 2020

Post by masmorra » September 18th, 2024, 8:27 am

nocash wrote: September 17th, 2024, 5:48 am The limit is 256x256 (or perhaps something like 255x255 in practice), not 128x128.
Either way, 32x32 doesn't exceed those limits.
The GPU has MASK and OFFSET features for sizes like repeating 32x32 textures.
If your 32>>3 is meant to set the MASK, try replacing it by 31/8, or (255-31)/8.
The tiling worked! I don't know why, but it works with RECT texRect = {0, 0, (texture->prect->w>>2), (texture->prect->h>>3)};
But the real problem I think was the ordering table position, when I set to the same position, it worked:

addPrim(_orderingTable + p, ptwin);
addPrim(_orderingTable + p, pol4);

Thanks for the help guys!

User avatar
Administrator
Verified
Admin / PSXDEV
Admin / PSXDEV
Posts: 2683
Joined: Dec 31, 2012
I am a: Shadow
PlayStation Model: H2000/5502

Post by Administrator » September 21st, 2024, 1:51 am

nocash wrote: September 17th, 2024, 5:48 am The limit is 256x256 (or perhaps something like 255x255 in practice), not 128x128.
Thanks for the correction and clarification :)
Development Console: SCPH-5502 with 8MB RAM, MM3 Modchip, PAL 60 Colour Modification (for NTSC), PSIO Switch Board, DB-9 breakout headers for both RGB and Serial output and an Xplorer with CAETLA 0.34.

PlayStation Development PC: Windows 98 SE, Pentium 3 at 400MHz, 128MB SDRAM, DTL-H2000, DTL-H2010, DTL-H201A, DTL-S2020 (with 4GB SCSI-2 HDD), 21" Sony G420, CD-R burner, 3.25" and 5.25" Floppy Diskette Drives, ZIP 100 Diskette Drive and an IBM Model M keyboard.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest