Facepunch / garrysmod-issues

Garry's Mod issue tracker
138 stars 56 forks source link

Studiomdl destroys lod 0 when $lods are used #4832

Open TiberiumFusion opened 3 years ago

TiberiumFusion commented 3 years ago

Details

When I compile a certain model with $bodygroups and $lods, studiomdl fucks up the vertices on lod 0 (and only on lod 0) when at least 3 lods are present. When only 2 lods are present, the issue does not occur.

Demo 1:

Relevant qc: https://pastebin.com/WJCrufsJ Compile result: Demo 1

Demo 2:

Relevant qc: https://pastebin.com/RENbxB3z Compile result: Demo 2

Other notes

I am not particularly interested in sharing the model source files if this issue can be diagnosed without them.

Tested Versions

Issue occurs with the studiomdl included with: • x86-64 2021.02.10 • Vanilla 2021.02.05 • Vanilla 2020.08.18 • Vanilla 2020.01.21 • Vanilla 2019.09.03

These versions of studiomdl all produce the exact same result as shown in Demo 1 and Demo 2. See my next comment for additional testing with different results.

TiberiumFusion commented 3 years ago

Additional tests

While testing various studiomdl versions, I encountered different (but still mangled) results.

Demo 3

Tested studiomdl versions: • Vanilla 2019.07.02 • Vanilla 2019.04.30 • Vanilla 2019.02.19 • Vanilla 2018.12.15 • Vanilla 2017.12.19 • Vanilla 2016.12.20 • Vanilla 2015.12.17 • Vanilla 2015.03.09

Relevant qc: https://pastebin.com/gbnYK6GH Compile result: Demo 3

Key notes

Other notes

These tests indicate that between 2019.07.02 and 2019.09.03, studiomdl changed in some way that altered the behavior of this issue. The 2019.07.02 and earlier versions of studiomdl seem to have more tolerance for the amount of mesh data they can process before the issue occurs.

TiberiumFusion commented 3 years ago

Notes on other games' studiomdls

I can already hear rubat typing "this is how Studiomdl has always worked since HL2" so I've taken the liberty of preemptively testing that claim.

Studiomdls that destroy the model

Studiomdls that get the model correct

robotboy655 commented 3 years ago

I will need the model sources (if you can create something that replicates the issue, that's obviously fine too) that compile to the problematic mesh if this is to be debugged further. You can send it to me to my email in readme.md of this repo.

It was caused by CS6324 on 22.08.2019. A rollback is not really an option as both versions are bad.

TiberiumFusion commented 3 years ago

@robotboy655 I have emailed you the relevant source files.

robotboy655 commented 3 years ago

Well I found a fix, but I don't know what side effects will occur if I push it.

Maybe related issue: https://github.com/Facepunch/garrysmod-requests/issues/1637

robotboy655 commented 3 years ago

Added -vpfix command line option to our studiomdl.exe for you to try on the Dev beta. I have restored the default behavior to how it is in HL2/L4D2/In GMod before, as it is clearly better, but I was unable to find the proper fix for this and I have tried a bunch of things including copying over CS:GO's studiomdl almost entirely, (CS:GO studiomdl.exe appears to not suffer from this)

TiberiumFusion commented 3 years ago

@robotboy655 You say "I was unable to find the proper fix", so then what exactly does this new -vpfix option do? If it is not a "proper fix", then what are the caveats?

robotboy655 commented 3 years ago

I don't know what sideeffects it may have on the model, that's why its behind a command line option.

TiberiumFusion commented 3 years ago

@robotboy655 When I compile the demo I sent you with your mysterious -vpfix option, the model looks just fine in hlmv, as I am sure you have already done yourself. I have not tested the model in gmod itself, however, and I certainly do not know the proper means and extent to test it for these "side effects".

I get correct models from SFM's studiomdl, and gmod seems to handle those v49 mdls without any issues. Since SFM's studiomdl doesn't require a mystery argument with unknown side effects, I don't have any reason to go back to gmod's studiomdl and use your blackbox -vpfix option.

robotboy655 commented 3 years ago

The point is for you to use it on a bunch of models and see if it creates any issues (that being fucked up meshes), but suit yourself.

TiberiumFusion commented 3 years ago

@robotboy655 Ok, I'll add that to my list for the week and get the report on your desk by Friday.

Actually, wait, no, I don't recall being hired by Facepunch to fix your bugs in your game when I bought gmod. I must admit, though, I am surprised you got this far into the ticket before saying "ehhhh good enough" and expecting a user to do the rest of your work for you.

If the point really is for me to do the boring part of your job for you, then just put a check in the mail and I'll get right on with it. I'll cut you a sweet deal at $15/hour.