Figuring out encoded vertex normal vector
Posted: Tue Sep 06, 2016 5:33 pm
I'm trying to figure out how the normal vector for vertices is encoded for a game, and I'm having a bit of trouble with it. It's with the PAC format from the game Black Desert (various format specifications can be found here: viewtopic.php?f=16&t=11849).
I'm rather new to 3D model formats, but as far as I know, this normal would usually be represented as a position in 3D space using 3 floats. But in this case, it's just 4 bytes. Here's a couple of examples (listing the unsigned bytes alongside the normal auto generated by 3DS Max for each vertex):
A simple box mesh:
https://abload.de/img/t0054_trade_box_0001_jrqyh.png
http://pastebin.com/raw/SQqR0deU
A much more complex mesh (a cape):
https://abload.de/img/phm_00_cloak_0073_cdgpd8.png
http://pastebin.com/raw/hR61SLfx
I've noticed the second byte is never lower than 128 in value. I've written code which outputs the bytes as ints of various bit sizes (with or without sign bit, and of different endian), but I don't get anything which makes sense.
Anyone got any clever idea how to approach this? Or does anyone have examples of documented 3D model formats with vertex normal vectors represented in unusual ways?
I'm rather new to 3D model formats, but as far as I know, this normal would usually be represented as a position in 3D space using 3 floats. But in this case, it's just 4 bytes. Here's a couple of examples (listing the unsigned bytes alongside the normal auto generated by 3DS Max for each vertex):
A simple box mesh:
https://abload.de/img/t0054_trade_box_0001_jrqyh.png
http://pastebin.com/raw/SQqR0deU
A much more complex mesh (a cape):
https://abload.de/img/phm_00_cloak_0073_cdgpd8.png
http://pastebin.com/raw/hR61SLfx
I've noticed the second byte is never lower than 128 in value. I've written code which outputs the bytes as ints of various bit sizes (with or without sign bit, and of different endian), but I don't get anything which makes sense.
Anyone got any clever idea how to approach this? Or does anyone have examples of documented 3D model formats with vertex normal vectors represented in unusual ways?