PVR questions

If you have any questions on programming, this is the place to ask them, whether you're a newbie or an experienced programmer. Discussion on programming in general is also welcome. We will help you with programming homework, but we will not do your work for you! Any porting requests must be made in Developmental Ideas.
Post Reply
Strapping Scherzo
DC Developer
DC Developer
Posts: 2285
https://www.artistsworkshop.eu/meble-kuchenne-na-wymiar-warszawa-gdzie-zamowic/
Joined: Fri Feb 21, 2003 7:37 am
Location: Chicago, IL
Has thanked: 0
Been thanked: 1 time
Contact:

PVR questions

Post by Strapping Scherzo »

I can't seem to find the article where I read this... the PVR system is nothing more than a tile/poly accelerator and does not automatically do depth perspective like GL does. Is this true? If is it, I would be able to use it for 2D stuff very easily, right? Also, are there any good tutorials or source that show a good example of using pvr? The kos examples don't seem like they cover everything. Thanks.
Image
BlackAura
DC Developer
DC Developer
Posts: 9951
Joined: Sun Dec 30, 2001 9:02 am
Has thanked: 0
Been thanked: 1 time

Post by BlackAura »

In order...

Yes, that's right. The PVR just does polygon rendering, although it does handle depth for sorting, depth testing, occulsion testing, and perspective correction for textures.

Yes, you can use it for 2D. Just draw polygons with 2D coordinates, and you could use the Z coordinate to control the order the graphics are drawn if you want.

No, there aren't really any good tutorials yet. To be honest, the PVR system isn't very well documented. The KOS examples are probably about as good as you're going to get.
Strapping Scherzo
DC Developer
DC Developer
Posts: 2285
Joined: Fri Feb 21, 2003 7:37 am
Location: Chicago, IL
Has thanked: 0
Been thanked: 1 time
Contact:

Post by Strapping Scherzo »

Thanks for the info.
Now, I notice that each pvr vertex has a z coordinate. So, let's say that I'm drawing a textured quad or something... what happens if I give a different z coord for each of the 4 vertices? How will that render when other polygons are rendered as well? Will pvr clip the polygons whose faces intersect sort of like there really was a non-depth-perspective 3D space? Or will it behave kinda weird? I suppose I can just compile a test and find out first hand but I was hoping you could anwser this without doing that. This question is just out of curiosity. My current project is all 2D anyways and polygons will always be "parallel" to the screen.

Thanks.
Image
Ex-Cyber
DCEmu User with No Life
DCEmu User with No Life
Posts: 3641
Joined: Sat Feb 16, 2002 1:55 pm
Has thanked: 0
Been thanked: 0

Post by Ex-Cyber »

Best low-level info PVR info around that I've seen is at Marcus Comstedt's site, though it's not in tutorial form. It's still quite informative if you intend to do any bit-banging or just want some insight into how the hardware looks at things.
"You know, I have a great, wonderful, really original method of teaching antitrust law, and it kept 80 percent of the students awake. They learned things. It was fabulous." -- Justice Stephen Breyer
BlackAura
DC Developer
DC Developer
Posts: 9951
Joined: Sun Dec 30, 2001 9:02 am
Has thanked: 0
Been thanked: 1 time

Post by BlackAura »

If you give vertices different Z values, it'll show what's closest to the camera.

On a PC graphics card, it uses a Z buffer. Whenever it draws a polygon, it writes the depth value to the Z buffer. Then, when another polygon is drawn, each pixel is only drawn if it's in front of the pixel that's already there. Unless, of course, you start mucking around with the depth compare settings...

A DC's graphics system is like that, but without the Z buffer. It sorts the polygons into the right order (back to front) and then only renders the one that's closest to the screen. It then does some other mystical voodoo (well, maths) to make it look like there actually is a Z buffer, even though there isn't one.

Basically, it does the same as it would in 3D, but it doesn't do any kind of perspective correction, or any other transformations for you.
Rand Linden
bleemcast! Creator
bleemcast! Creator
Posts: 882
Joined: Wed Oct 17, 2001 7:44 pm
Location: Los Angeles, CA
Has thanked: 0
Been thanked: 0
Contact:

Post by Rand Linden »

The PVR does infact do depth sorting on a per-pixel basis.

And it does perspective correction.

Rand.
nymus
DC Developer
DC Developer
Posts: 968
Joined: Tue Feb 11, 2003 4:12 pm
Location: In a Dream
Has thanked: 5 times
Been thanked: 6 times

Post by nymus »

perspective correction of textures right?

If I submit a square with one length having half the z-value, it won't taper off into the distance will it?
behold the mind
inspired by Dreamcast
ragnarok2040
DC Developer
DC Developer
Posts: 462
Joined: Wed Oct 17, 2001 7:44 pm
Has thanked: 0
Been thanked: 0

Post by ragnarok2040 »

Mmmm, 3d math equations :L... sorry I just love math..
User avatar
Ender
DCEmu Super Poster
DCEmu Super Poster
Posts: 1314
Joined: Mon Dec 10, 2001 4:01 pm
Location: Canada, first igloo on your left.
Has thanked: 0
Been thanked: 0
Contact:

Post by Ender »

ragnarok2040 wrote:Mmmm, 3d math equations :L... sorry I just love math..
I used to love math, and then I realized how bad I was at the messy stuff (Like dealing with Schrodinger's equation).

But computer math isn't too bad.
Rand Linden
bleemcast! Creator
bleemcast! Creator
Posts: 882
Joined: Wed Oct 17, 2001 7:44 pm
Location: Los Angeles, CA
Has thanked: 0
Been thanked: 0
Contact:

Post by Rand Linden »

Non-perspective correction results in the weird "warping" that you see on PS1 titles -- and don't see on N64 and most later hardware.

If you send polygons with appropriate 3D coordinates, they'll draw correctly -- and, infact, will auto-mipmap if you set it up that way.

All of which is best done by a full 3D transform pipeline to generate the correct values for all your coordinates.

Also, IIRC, you need to send 1/Z not Z.

Rand.
Alexvrb
DCEmu Ultra Poster
DCEmu Ultra Poster
Posts: 1754
Joined: Wed Jul 17, 2002 11:25 am
Has thanked: 0
Been thanked: 0

Post by Alexvrb »

Yeah, the lack of perspective correction on PSX was more annoying than anything else, as far as graphics go.
If you have twenty monkeys,
banging randomly on typewriters,
they will in twenty minutes produce the complete source code to World of Warcraft.
Post Reply