riidefi / RiiStudio

Editor for various 3D model formats
https://riidefi.github.io/RiiStudio/
92 stars 16 forks source link

Setting 'Scenegraph' to 'Pass 1' makes the file unreadable by other software #41

Closed GerasSB closed 1 year ago

GerasSB commented 1 year ago

Pass 1, which is for translucent objects, sets the Flag in mats.json to 5 instead of 4, as per BMD documentation. This behavior prevents the saved BMD from being readable by other software.

riidefi commented 1 year ago

Flags typically function as bitwise sets, such as 5=4+1 representing both 4 and 1. However, based on the observation that official files consistently unset the 1 flag, I'll adhere to this practice. It is important to clarify that this issue appears to be related to the software you are referencing, rather than an inherent problem with the flag system. For instance, 7=4+2+1 specifies a valid XLU-pass flag in RiiStudio, and the runtime library will accept it without issue.

GerasSB commented 1 year ago

When I say "unreadable other software", I'm specifically talking about noclip.website and, more importantly, Dolphin (and presumably consoles too).

Tested specifically with Double Dash.

riidefi commented 1 year ago

I tested this on Mario Kart Double Dash (US) and found it to be read both Dolphin and Console (Wii): image Luigi.zip Noclip rejecting the file is from an assert triggered by seeing an unexpected combination (here) https://github.com/magcius/noclip.website/blob/50f80ca96b38f172f0be9a26c98021374833eb3d/src/Common/JSYSTEM/J3D/J3DLoader.ts#L683-L688 I am not sure what changes rendered your file unreadable in Dolphin. It's possible there's another bug in RiiStudio--I can debug whatever crash if necessary. Notwithstanding, I will update RS's behavior to match N's in a bit.