libertyernie / brawltools

BrawlBox and BrawlLib
http://forums.kc-mm.com/index.php?topic=67847.0
142 stars 31 forks source link

Update warnings for non-float Import Settings #161

Open Ebola16 opened 6 years ago

Ebola16 commented 6 years ago

Background: The model attached below has too many nodes and can crash at the result screen when being used. I reduced the nodes by altering the WeightPrecision but this caused the model's face to look bad. Setting "ForceFloatUVs" to False prevented the face from becoming deformed with the lower node count. After replacing the materials and shaders with the ones from the original model, the materials became corrupt.

Steps to reproduce:

  1. Download and extract BW.zip
  2. Open FitSZerosuit00 in Brawlbox
  3. Replace ModelData[0]'s FitSZerosuit00 with FitSZerosuit00.dae
  4. Set "WeightPrecision" to 0.005 since the model has too many Nodes and can crash at the results screen
  5. Set "ForceFloatNormals" or "ForceFloatUVs" to False
  6. Press "Okay"
  7. Replace Shader0 with the included shader
  8. Replace Material #0 with the included material
  9. Set "HasTextureMatrix" to True for the "Edge" material reference of Material #0
  10. Observe the messed up textures in Dolphin or a real Wii. Brawlbox will properly display the textures.

Also, right-clicking the MDL0 reveals that "Add New Shader" is grayed-out. I've never seen that before but it seems like a problem.

This is possibly related to #95 but this scenario is independent of metal material generation.

Correct model except for the deformed face due to decreased nodes: http://forums.kc-mm.com/Gallery/BrawlView.php?Number=211417 Texture corruptions after following steps to reproduce: captureg

Perhaps warnings should be added to:

BlackJaxDev commented 6 years ago

This isn't a fault of Brawlbox; for some reason texture matrices are just not compatible at all with non-float UVs. Like, the game's code literally can't handle it. Unfortunately I don't think Brawlbox has any kind of warning about this, it really should.

This is mainly why the option to force float on import was added as a feature, and why original Brawl models tend to just always use float. Brawlbox displaying them properly when this edge case happens is technically incorrect.

Also, you can't add more shaders than there are materials, so be sure to check that. For example, if you have 3 materials, you can only have up to 3 shaders. There's no real reason to have more shaders than materials, the unused ones wouldn't be saved anyway as they have to be linked to one or more materials.

If your model has too many nodes, you might want to optimize the skinning weights for each vertex. For example, if you can use exactly a weight of 0.5 to one bone and 0.5 to another bone for a lot of vertices, those weights can all be merged into one "node". Using the weight blend button tends to be the culprit of creating an ungodly number of nodes because it uses very specific bone weight values like 0.27563, which is probably not going to be remappable with any other influences like the example above.

Ebola16 commented 6 years ago

Thank you for the detailed explanation. I'm fine with Wont Fix for Brawlbox's incorrect display of non-float UV's as long as warnings are added somewhere in Brawlbox, or the removal of non-float options if they don't have any practical use. Perhaps warnings should be added to descriptions of ForceFloat* options in "Import Settings" and the "(Re)generate Metal Materials" popup message? I can try adding the warnings myself if requested.