phoboslab / wipeout

WipEout (PSX) Model Viewer in WebGL/Three.js
527 stars 54 forks source link

Finally decoded CLASS.PRM ! #25

Open aybe opened 8 years ago

aybe commented 8 years ago

It's been a while I was looking for it :dancer: !!!

2015-11-11 19_35_48-unity personal 64bit - modelscene unity - wxx-rebirth - pc mac linux standa

2015-11-11 19_36_23-unity personal 64bit - modelscene unity - wxx-rebirth - pc mac linux standa

Will post details once it's a bit more refined but basically I found that there are command lists that should be ignored and that there are new Gouraud-shaded polygons (tri/quad).

aybe commented 8 years ago

Hi !

I think I'm on something, 0x15 seems to be a parallel light source (see PDF), hex-edited the game and it seems coherent:

// 0x15 struct
polygonHeader
directionalVector = vec4I16
bgrxColor = uint32

see where I've assigned 1 color component only on each light:

2015-11-11 23_38_52-greenshot

cheers :dancers:

aybe commented 8 years ago

100% confirmed these are the light sources as said in the SDK.

2015-11-12 00_13_03-hexedit pro - dsdsds 2015-11-12 00_13_36-hexedit pro - dsdsds 2015-11-12 00_14_07-hexedit pro - dsdsds

Looking on finding out more about 0x16 now ...

aybe commented 8 years ago

Okay I think we've solved the CLASS.PRM case !

case PrmPolygonType.AmbientLight: // 0x16
                    var ambientLight = new AmbientLight
                    {
                        Header = header,
                        Unknown1 = reader.ReadUInt32BEs(4),
                        Color = reader.ReadUInt32BE(),
                        Unknown2 = reader.ReadUInt32BE()
                    };

Basically the PSX SDK is of great help, main difference lies in how things are laid out.

Would have loved to implement correct coloring but looking at current code base I don't have much clue without breaking current logic ... would be great if you had some idea about it.

By the way, I have a question for you !

On PRM files there are many objects and some depends on others, some are totally independent. Do you have any suggestion/idea on what system/pattern I could sketch in order to be able to have separate objects, knowing the structure of PRMs ? In short I'm asking you what approach you'd use to be able to use these objects separately, knowing the possible dependencies between them ?

Thank you, and have a good night !!

aybe commented 8 years ago

Hi,

Implemented it here and it's mostly that, shader should be modified though:

2015-11-12 23_08_46-unity personal 64bit - modelscene unity - wxx-rebirth - pc mac linux standa

Btw, colors are RGB in lights, so one should ignore A component.

Cheers!