PVR Data Format Documentation?

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
Kion
DCEmu Newbie
DCEmu Newbie
Posts: 5
https://www.artistsworkshop.eu/meble-kuchenne-na-wymiar-warszawa-gdzie-zamowic/
Joined: Sat Oct 26, 2013 5:30 am
Has thanked: 0
Been thanked: 0

PVR Data Format Documentation?

Post by Kion »

I finally managed to get maps from PSO: https://www.youtube.com/watch?v=pB8NQOXzbyA

I'm turning my focus to textures right now. I know there are a lot of tools that can export PVR textures, but it would be nice to know how to write the textures with software. Does anyone know any resources for the actual implementation of how to decode .PVR files? There are resources like the PuyoTools wiki but it only goes as far as which data formats are implemented, and not detailed as to how they're implemented.

I managed to get twittled in my PVM when I played around with them before, but I'm having a really hard finding details and any of the other formats. Most specifically how Vector Quantization works atm.
maslevin
DC Developer
DC Developer
Posts: 13
Joined: Thu Apr 02, 2015 11:26 pm
Has thanked: 15 times
Been thanked: 6 times

Re: PVR Data Format Documentation?

Post by maslevin »

I actually wrote some KOS code that tries to use the file header from the PVR file to create a correct texture header automatically, and let you use official game textures easily. This code was based on the PuyoTools docs, as well as a few other sources and some original research. The PVR format was originally designed to be used only on the DC, so you basically don't need to do any real "decoding" to them to render them on the DC you just need to supply the right texture header to tell the hardware what kind of texture it is. If you want to decode them for your purpose in texturing your extracted models, you'd need to replicate the logic the PVR uses.

So in regards to VQ (and other DC texture formats) you can look up how they're supposed to work from other threads here, or better yet I might suggest looking at a DC emulator because those already convert PVR textures to a host format that might map better to what you are trying to accomplish.

I tested out all the images from a few games and in practice many of them have invalid file headers, or headers which don't match their content. The level of header data quality varied game by game, and it appears that later tools did a better job of encoding this information than earlier games. Apparently the official SDK had the option of loading texture with manual parameters so the data which should have been encoded in a header to allow for automatic loading is not guaranteed to be present. I haven't looked at PSO, but you might have to manually figure out what texture format is being used in which context.
Kion
DCEmu Newbie
DCEmu Newbie
Posts: 5
Joined: Sat Oct 26, 2013 5:30 am
Has thanked: 0
Been thanked: 0

Re: PVR Data Format Documentation?

Post by Kion »

I'd like to be able to render them directly on a computer via script so I can't really use any native calls or anything like that. The image below is a twittled format that I was able to get one pixel at a time and render myself. I'm trying to find any information on any of the other pvr data formats.
Image
User avatar
SWAT
Insane DCEmu
Insane DCEmu
Posts: 191
Joined: Sat Jan 31, 2004 2:34 pm
Location: Russia/Novosibirsk
Has thanked: 1 time
Been thanked: 0
Contact:

Re: PVR Data Format Documentation?

Post by SWAT »

Image
maslevin
DC Developer
DC Developer
Posts: 13
Joined: Thu Apr 02, 2015 11:26 pm
Has thanked: 15 times
Been thanked: 6 times

Re: PVR Data Format Documentation?

Post by maslevin »

To clarify what I'm suggesting; I'm not recommending you try to use dreamcast emulator source directly, I'm recommending you look at the transformation from a (possibly compressed) PVR texture to a regular uncompressed RGB texture from a dreamcast emulator and port that code to javascript (because it looks like your code is all running in node.js, correct?) and then you'd be able to bind whatever you're rendering with to those uncompressed textures.

However, what might be easiest if you don't want to dig that deep into the file format is to use Puyotools to convert the PVR files to PNGs or JPGs and load those converted files in your code. That way you could leverage their work without having to replicate it yourself. Check out the github here, if you haven't already.

https://github.com/nickworonekin/puyotools
MetalliC
DCEmu Crazy Poster
DCEmu Crazy Poster
Posts: 28
Joined: Wed Apr 23, 2014 3:04 pm
Has thanked: 0
Been thanked: 0

Re: PVR Data Format Documentation?

Post by MetalliC »

I'd suggest good choice to look at original Katana SDK's PVRTool sources
[link removed -BlueCrab]
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5659
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has thanked: 9 times
Been thanked: 69 times
Contact:

Re: PVR Data Format Documentation?

Post by BlueCrab »

Uh... If that's actually Sega's tool's source code, that's almost certainly not legal to distribute.

Thus, doing so is against the rules of the forum, so I've removed the link.
MetalliC
DCEmu Crazy Poster
DCEmu Crazy Poster
Posts: 28
Joined: Wed Apr 23, 2014 3:04 pm
Has thanked: 0
Been thanked: 0

Re: PVR Data Format Documentation?

Post by MetalliC »

well, if you say so its Sega's tool ofc.
but actual about window says this, and there no Sega copyrights in source code.
Attachments
pvrt.png
Dreamcast
DCEmu Freak
DCEmu Freak
Posts: 81
Joined: Fri Jul 27, 2007 2:23 am
Has thanked: 2 times
Been thanked: 4 times

Re: PVR Data Format Documentation?

Post by Dreamcast »

The copyright is inferred. "Copyright © 1999", then below that it gives a "written by" and an e-mail address. Since the e-mail address is SEGA's, it's safe to conclude the copyright is SEGA's since the program's author is most likely a SEGA employee.
MetalliC
DCEmu Crazy Poster
DCEmu Crazy Poster
Posts: 28
Joined: Wed Apr 23, 2014 3:04 pm
Has thanked: 0
Been thanked: 0

Re: PVR Data Format Documentation?

Post by MetalliC »

I'd suggest its not that simple. it includes 3rd-party libs like paintlib,
and "VQDLL" made by Videologic/ImgTec's employee (former now) , fwiv one of main creators of PowerVR GPUs.
so I think that's why this tool have no Sega copyrights, have sources included, and in overall looks like not official, but free tool made by someone from SOE.

in any way, Sega have no rights on most PVR2-related things, because this IP belong to it's creators - Videologic/ImgTec, and/or NEC which owned them that time (if you look at Kamui lib headers you'll see there just NEC, no any Sega). so in this case Sega was no more than like customer in restaurant ;)
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5659
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has thanked: 9 times
Been thanked: 69 times
Contact:

Re: PVR Data Format Documentation?

Post by BlueCrab »

That's certainly not a personal email in that dialog box. EDTS = European Developer Technical Support.

It is an official Sega tool. It is Sega's copyrighted work. Just because it uses 3rd party code doesn't make it any less of Sega's copyrighted intellectual property.

It's pretty clear to me what it is, and it is not something that is legal to distribute without express written permission from Sega or a license that allows redistribution of the source (which I'm relatively sure they will not give, being that I'm pretty sure that code wasn't ever supposed to leave Sega).
Kion
DCEmu Newbie
DCEmu Newbie
Posts: 5
Joined: Sat Oct 26, 2013 5:30 am
Has thanked: 0
Been thanked: 0

Re: PVR Data Format Documentation?

Post by Kion »

There's PVR source code included in the Katana SDK? I thought it was mostly header files.
MetalliC
DCEmu Crazy Poster
DCEmu Crazy Poster
Posts: 28
Joined: Wed Apr 23, 2014 3:04 pm
Has thanked: 0
Been thanked: 0

Re: PVR Data Format Documentation?

Post by MetalliC »

BlueCrab wrote:That's certainly not a personal email in that dialog box. EDTS = European Developer Technical Support.
email in dialog box ;) ? do you realize how it sounds ?
so then I worked in software development company, and used my corporate email as contact address somewhere in "about" window, this automatically gives to company some rights for this my piece if IP ? this is bullsht.
BlueCrab wrote: ... being that I'm pretty sure that code wasn't ever supposed to leave Sega).
lol, but in real world they included that code in Katana SDK r11 (Utl\Gfx\Conv\PVRTool), which was available for dozens or hundreds of developers.

in any way, all this is pretty "fun" to hear from people who involved in homebrew programming for Dreamcast, and in process constantly shitting on SEGA copyrights :D
(because you can't create anything selfbootable without including so called "IP.BIN" with numerous mentions of Sega Enterprises in text and graphical forms, and that's obvious not legal without Sega permission)
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5659
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has thanked: 9 times
Been thanked: 69 times
Contact:

Re: PVR Data Format Documentation?

Post by BlueCrab »

MetalliC wrote:
BlueCrab wrote:That's certainly not a personal email in that dialog box. EDTS = European Developer Technical Support.
email in dialog box ;) ? do you realize how it sounds ?
so then I worked in software development company, and used my corporate email as contact address somewhere in "about" window, this automatically gives to company some rights for this my piece if IP ? this is bullsht.
My point is that it is not even a single person's email address at Sega. It was the email address for contacting the developer technical support for all of Europe. It's not like the email address was something like john.smith@soe.sega.co.uk or something -- it's the email address to contact the entire support team for developer relations.
BlueCrab wrote: ... being that I'm pretty sure that code wasn't ever supposed to leave Sega).
lol, but in real world they included that code in Katana SDK r11 (Utl\Gfx\Conv\PVRTool), which was available for dozens or hundreds of developers.
Ok, fine. Regardless, you're not supposed to have that code without a proper license for the SDK, which I'm sure you do not have. None of us have proper licenses for the SDK, so none of us should have it. Even if you do have it, it's not your right to redistribute it without permission from the Copyright holder(s).

If it's included in the SDK, that's pretty much a given that it's Sega's intellectual property unless it is otherwise marked. Otherwise, it wouldn't be legal for Sega to redistribute it in the SDK. :wink:
in any way, all this is pretty "fun" to hear from people who involved in homebrew programming for Dreamcast, and in process constantly shitting on SEGA copyrights :D
(because you can't create anything selfbootable without including so called "IP.BIN" with numerous mentions of Sega Enterprises in text and graphical forms, and that's obvious not legal without Sega permission)
Actually, by various precedents, using the IP.BIN is allowable under Copyright law (at least in the US). The case Sega v. Accolade from the early 1990s is the main part of the precedent for why using the IP.BIN (or at least the parts of the IP.BIN that are specifically checked by the system) is legal and not in violation of US Copyright law -- it is permissible fair use. There is a reason that there is a replacement IP.BIN that only includes the parts directly checked by the system and why many people have used it for a long time. :wink:

Now... We've veered WAY off the topic of this thread. I'd suggest that if you have any further concerns on the matter that we continue this discussion by PM.
User avatar
RyoDC
Mental DCEmu
Mental DCEmu
Posts: 366
Joined: Wed Mar 30, 2011 12:13 pm
Has thanked: 2 times
Been thanked: 0

Re: PVR Data Format Documentation?

Post by RyoDC »

Aren't copyrights expired after 15 years?
How do I try to build a Dreamcast toolchain:
Image
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5659
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has thanked: 9 times
Been thanked: 69 times
Contact:

Re: PVR Data Format Documentation?

Post by BlueCrab »

RyoDC wrote:Aren't copyrights expired after 15 years?
No. In most places in the world, Copyright is much longer than 15 years. You're thinking of patents, which generally are much shorter terms (12-15 years is common).

In the US, Copyright on anything produced after 1978 is either:
1. For works created for-hire (i.e, corporate copyrights, as this would be): 95 years after publication or 120 years after creation
2. Life of the author, plus 70 years (for works created not as work-for-hire)
User avatar
RyoDC
Mental DCEmu
Mental DCEmu
Posts: 366
Joined: Wed Mar 30, 2011 12:13 pm
Has thanked: 2 times
Been thanked: 0

Re: PVR Data Format Documentation?

Post by RyoDC »

Thank you.

One more question.
Isn't then creating a homebrew software and KallistiOS project in particular a copyright infringement?

It is impossible to create something like KOS without technical documentation and specifications, and I think those documents are too never supposed to leave SEGA's office.
So this work was created on stolen documents, am I getting it right?
How do I try to build a Dreamcast toolchain:
Image
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5659
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has thanked: 9 times
Been thanked: 69 times
Contact:

Re: PVR Data Format Documentation?

Post by BlueCrab »

RyoDC wrote:Thank you.

One more question.
Isn't then creating a homebrew software and KallistiOS project in particular a copyright infringement?

It is impossible to create something like KOS without technical documentation and specifications, and I think those documents are too never supposed to leave SEGA's office.
So this work was created on stolen documents, am I getting it right?
No, KOS was created without using such documentation. Many people have worked very hard on reverse engineering the system in a safe/legal manner. The only places where I am aware that any "official" documentation has been used are for things where that documentation was publicly available (i.e, the modem data pump is a common part that the documentation is publicly available from its manufacturer, same goes for the BBA's guts).

Even if someone had used official documentation, that wouldn't be copyright infringement unless that documentation had specific code that was directly copied (and I would doubt that the documentation would have any code segments like that anyway). It'd be a different situation in it's entirety (something like trade secret violations or something of the like)...
Post Reply