Homebrew A few questions about BFRES format

Olivier78640

Member
Newcomer
Joined
Apr 30, 2016
Messages
16
Reaction score
9
Trophies
0
XP
113
Country
France
Hello everyone,
I recently started to write a program that reads BFRES files.
I am primarily using the Custom Mario Kart 8 Wiki for the specifications, but I don't know / understand a few things:

- How different are BotW files compared to MK8 files ?
The wiki only goes up to version v3.4.0.4 while BotW files are all v4.5.0.3...
Are there any major changes I should know about when reading these files ?

- How should I read the s10s ?
The FVTX sub-section of FMDL sub-files have different buffers with different types of data in them.
One of these types is "snorm_10_10_10_2", indicating that there are three 10 bit signed integers to read and 2 bits of padding always equal to 0b01...
But another source (https://github.com/Syroot/io_scene_bfres/blob/master/src/bfres_fmdl.py#L178) says that there are 3 8 bit values padded with 0b01s at each start...
None of the two meet the description of an actual piece of data found on a buffer: 0x3FC03852.
The buffer stride also does not make any sense because it is set at 20, indicating that the size of an element (our three s10 + padding) should be 20 bytes.

- Why are there multiple Texture coordinates for each vertex and so many FTEXes per FMAT ?
When reading a file, I encountered vertices that have more than one "_u0" buffer ("_u1").
I then looked at the FSHP section for these vertices to get to the FMAT being used and found 6 FTEXes referenced.
Why are there so many FTEXes ? Also, if there are 6 FTEXes referenced, shouldn't there be 6 UV coordinates per vertex ?

- What does "BC" in "GX2_SURFACE_FORMAT_T_BC1_UNORM" mean ?
There is a Texture format field in FTEX sub-files, and they are mapped to an enum called "GX2SurfaceFormat".
This enum tells how the texture data should be read.
There are a few different channels that are easy to understand like R for Red, G for Green, B for Blue, D for Depth and S for Stencil.
But there is no explanation on the "BC" channel...

If you have any information about the issues that I faced, please write a reply, as I do not know how to continue anymore (especially the "BC" part, I need to know to decode some textures in BotW)...

Thank you
 
2 other questions I forgot about:

- Why are some buffers in FVTX sub-sections sharing data with multiple attributes ?
Some attributes in FVTXes are using the same buffer as some other.
For example, I found a FVTX that uses the same buffer for it's Normals and Tangents, which are completely different !
Interestingly, they share the same buffer but the attribute is saying to read them differently (Three s10 for Normals and Four s8 for Tangents).
I also found another example where the Normals, Tangents and both Texture Coordinates are read from the same buffer...

- What is the "All" attribute ?
FVTXes in BotW contains sometimes an "All" attribute. This is not in the wiki and I have no idea what that could possibly mean.
It is probably not very important for what I want to do but I am still curious.
 

Site & Scene News

Popular threads in this forum