Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MelonDS permits non-normalized bone weights on models when hardware does not #2242

Open
BromBromBromley opened this issue Dec 21, 2024 · 7 comments

Comments

@BromBromBromley
Copy link

As the title states, something I ran into while testing a project I was working on is that a rigged NSBMD I had created is that while it would work OK on MelonDS, when I tried using it on hardware, it always appeared to softlock. I realized that some vertices didn't have a sum of 1.0 for their weights, and as a result, it didn't function properly on hardware. Upon making sure my weighting was normalized, it then worked, but regardless of the legality of my weights, MelonDS permitted it.

@Arisotura
Copy link
Member

It's weird because I'd expect this sort of calculation to be done in software. It'd be interesting to have more details as to why non-normalized bone weights are failing on hardware.

@BromBromBromley
Copy link
Author

BromBromBromley commented Dec 21, 2024

I'm a little uncertain on the best way to provide additional details with hardware. I did at least discover that with EveryFileExplorer, its NSBMD settings viewer can be used as a diagnostic at least in terms of seeing if something is malformed. It threw this exception here:

See the end of this message for details on invoking 
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at NDS.GPU.CommandContext.RestoreMatrix(UInt32 index)
   at NDS.GPU.CommandContext.RunDL(Byte[] DL)
   at NDS.NitroSystem.G3D.SBC.Execute()
   at NDS.UI.MDL0Viewer.Render()
   at NDS.UI.MDL0Viewer.MDL0Viewer_Load(Object sender, EventArgs e)
   at System.Windows.Forms.UserControl.OnLoad(EventArgs e)
   at System.Windows.Forms.UserControl.OnCreateControl()
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl()
   at System.Windows.Forms.Control.ControlCollection.Add(Control value)
   at NDS.UI.NSBMDViewer.treeView1_AfterSelect(Object sender, TreeViewEventArgs e)
   at System.Windows.Forms.TreeView.OnAfterSelect(TreeViewEventArgs e)
   at System.Windows.Forms.TreeView.TvnSelected(NMTREEVIEW* nmtv)
   at System.Windows.Forms.TreeView.WmNotify(Message& m)
   at System.Windows.Forms.TreeView.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

If you wanted to see the area the stacktrace was referring to, it can be found here

@Arisotura
Copy link
Member

would be interesting to have a test ROM along with malformed files and good ones, so I could test this, but I also offer no guarantee

however, that stack trace gives a bit of insight -- something about the matrix restore command? it's weird, because I thought I had fixed the matrix stack stuff to mirror hardware behavior, but maybe there are odd edge cases I wasn't aware of.

@BromBromBromley
Copy link
Author

BromBromBromley commented Dec 21, 2024

Would it be possible for me to send the problematic files through any sort of private message? My Discord handle is the same as my GitHub account name.

@Arisotura
Copy link
Member

you can contact me over Discord or IRC, or on the forums

https://melonds.kuribo64.net/board/

@Jaklyy
Copy link
Contributor

Jaklyy commented Dec 21, 2024

my instinct is it could be the gx hanging, or some quirk related to partially gx command submission.
i know those two things aren't handled properly in melonDS as of now

@BromBromBromley
Copy link
Author

I see! Thanks for the insight!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants