SWBFGamers

Modding for the Original SWBF1 and SWBF2 => Released Assets => Topic started by: SleepKiller on August 04, 2017, 03:16:05 AM

Title: model-edit - v0.1.3
Post by: SleepKiller on August 04, 2017, 03:16:05 AM
This here is a tool for editing detail information in a .model files produced by modemunge. It'll work (or it should) on any PC SWBF1/SWBFII .model file.

For usage instructions, information on how it works and more see the readme on GitHub.
https://github.com/SleepKiller/model-edit#model-edit (https://github.com/SleepKiller/model-edit#model-edit)

For a copy of the tool see the release page on GitHub.
https://github.com/SleepKiller/model-edit/releases (https://github.com/SleepKiller/model-edit/releases)

To learn about the workings on the tool see the source code on GitHub.
https://github.com/SleepKiller/model-edit (https://github.com/SleepKiller/model-edit)

I made this over the course of this evening, it's not super advanced but it gets the job done. I wrote it in C# because  I wanted to play around with another language after writing swbf-unmunge in C++.

This also has to be the laziest release topic I've ever posted on this site.
Title: Re: model-edit - v0.1.0
Post by: Sereja on August 04, 2017, 03:36:42 AM
It say it can't work with Win32.
Title: Re: model-edit - v0.1.0
Post by: SleepKiller on August 04, 2017, 03:54:43 AM
Quote from: Sereja on August 04, 2017, 03:36:42 AM
It say it can't work with Win32.
See if installing the .NET Framework 4.5.2 (https://www.microsoft.com/en-nz/download/details.aspx?id=42643) runtime fixes it. I would have expected it to work out of the box when .NET is installed. Let me know if instaling it fixes it for you or not.
Title: Re: model-edit - v0.1.0
Post by: Sereja on August 04, 2017, 04:53:53 AM
Nope. This thing just can't be installed at my Windows version (I have Windows XP).
Title: Re: model-edit - v0.1.0
Post by: SleepKiller on August 04, 2017, 05:19:31 AM
Normally I would say "Tough luck. Upgrade your OS." but I certainly understand not everyone can (or has the money to) do that. And it is trivial thing for me to change here I have made the tool target .NET 4.0 which as I understand works on Windows XP SP3, you can make sure you have it here https://www.microsoft.com/en-nz/download/details.aspx?id=17851 (https://www.microsoft.com/en-nz/download/details.aspx?id=17851) and I have posted a new version of the tool targetting .NET 4.0 on GitHub.

Feel free to let me know if you're still having issues.
Title: Re: model-edit - v0.1.1
Post by: Giftheck on August 04, 2017, 06:40:24 AM
So at present this is useful for tricking the game into accepting higher-resolution models for all but unit models. Hopefully we can overcome that last hurdle sometime.
Title: Re: model-edit - v0.1.1
Post by: SleepKiller on August 04, 2017, 07:19:13 AM
Quote from: Gistech on August 04, 2017, 06:40:24 AM
So at present this is useful for tricking the game into accepting higher-resolution models for all but unit models. Hopefully we can overcome that last hurdle sometime.
Yes and no. The tests I posted had the detail tri count set to 8, being more conservative you can get detailed models ingame, fully animated, no flickering. With the higher (fake) tri counts the game still switched out to low res models, but was still rendering far more high res ones that it would even with stock models. (The algorithm controlling it seems to be weighted to render about 3-4 high res models on screen at once, I observed at least twice than that.) Given the fact that units are rarely so clustered ingame as they are on my blank test map you can probably get very good results going, especially if you were to say create some "low" resolution versions of your models for the game to switch out to. (You could probably even get away with them being quite detailed as well, although I'll leave that for someone else to test.)

It's all about the factor argument you can pass to the tool. Essentially it is (detail count / factor) so higher factor's will lie to the game more and more aggressively stop low res switching. By default it is set to a conservative factor four, but you'll almost certainly want to fiddle with it and see what gives best results for your sides.  Too high for player models and the animation system will give up, too low and you'll get ugly stock model (as in it would be as if you were just using stock models) levels of lowres switching. And set it to 1 and you'll see the model constantly flickering because that stops any edit from taking place.

(Set it to 0 and you'll cause division by zero and the computer will yell at you. But that is too much information.)

Edit: I've updated the readme with information on the process done by the tool and clearer instructions, check it out if that interests you.
Title: Re: model-edit - v0.1.1
Post by: Giftheck on August 10, 2017, 12:39:53 AM
I get it now. So, given my unit models tend to range between 1500-3000 tris, I should be able to get this to work with my mod just fine.
Title: Re: model-edit - v0.1.1
Post by: Giftheck on August 12, 2017, 05:24:39 AM
I'm just thinking if we can insert this into the munge process somewhere, so that it already does this when we munge our mods.
Title: Re: model-edit - v0.1.1
Post by: SleepKiller on August 12, 2017, 07:40:31 PM
Quote from: Gistech on August 12, 2017, 05:24:39 AM
I'm just thinking if we can insert this into the munge process somewhere, so that it already does this when we munge our mods.
I'm beginning to think you haven't been reading my posts very well :P

Yes (as explained in the readme) it was designed to make that a trivial thing to do, hence why it operates off directories instead of individual files.
Title: Re: model-edit - v0.1.1
Post by: Giftheck on August 13, 2017, 12:27:21 AM
I haven't followed everything, no. :P I'll re-read everything though when I get a bit more time. This will definitely come in very, very handy for Legacy Phase 2, as I have a few models that go over the 2,000 poly rule for units.
Title: Re: model-edit - v0.1.1
Post by: Giftheck on October 13, 2017, 07:53:27 AM
Can somebody tell me where to place this within my munge_side.bat file?
Title: Re: model-edit - v0.1.1
Post by: SleepKiller on October 13, 2017, 07:03:40 PM
Sure!

First (in order to smoothly and easily integrate it into the munge process) drop the tool into ToolsFL/Bin of your modtools, regardless of game or version.

In all of the below cases remember to replace <factor> with your desired factor.

[spoiler=SWBF1 munge_side.bat]Find this block and put it right after it.
Quote
odfmunge -sourcedir ..\..\..\Sides\%1 -platformdir ..\..\..\_source_pc\Sides\%1 -platform pc -inputfile !*.odf -outputdir munged\ -checkdate -continue
modelmunge -sourcedir ..\..\..\Sides\%1 -platformdir ..\..\..\_source_pc\Sides\%1 -platform pc -inputfile !*.msh -outputdir munged\ -checkdate -maxbones 16 -keep collision -continue -righthanded
texturemunge -sourcedir ..\..\..\Sides\%1 -platformdir ..\..\..\_source_pc\Sides\%1 -platform pc -inputfile !*.tga !*.pic -outputdir munged\ -checkdate -continue
configmunge -sourcedir ..\..\..\Sides\%1 -platformdir ..\..\..\_source_pc\Sides\%1 -platform pc -inputfile effects\*.fx -outputdir munged\ -checkdate -continue

It should now look like this.
Quote
odfmunge -sourcedir ..\..\..\Sides\%1 -platformdir ..\..\..\_source_pc\Sides\%1 -platform pc -inputfile !*.odf -outputdir munged\ -checkdate -continue
modelmunge -sourcedir ..\..\..\Sides\%1 -platformdir ..\..\..\_source_pc\Sides\%1 -platform pc -inputfile !*.msh -outputdir munged\ -checkdate -maxbones 16 -keep collision -continue -righthanded
texturemunge -sourcedir ..\..\..\Sides\%1 -platformdir ..\..\..\_source_pc\Sides\%1 -platform pc -inputfile !*.tga !*.pic -outputdir munged\ -checkdate -continue
configmunge -sourcedir ..\..\..\Sides\%1 -platformdir ..\..\..\_source_pc\Sides\%1 -platform pc -inputfile effects\*.fx -outputdir munged\ -checkdate -continue
model-edit munged\ <factor>
[/spoiler]

[spoiler=SWBF1 munge_world.bat]
Find this block and add the command below it.
Quoteodfmunge -sourcedir ..\..\..\Worlds\%1 -platformdir ..\..\..\_source_pc\Worlds\%1 -platform pc -inputfile !*.odf -outputdir munged\ -checkdate -continue
modelmunge -sourcedir ..\..\..\Worlds\%1 -platformdir ..\..\..\_source_pc\Worlds\%1 -platform pc -inputfile !*.msh -outputdir munged\ -checkdate -maxbones 16 -keep collision -continue -righthanded
texturemunge -sourcedir ..\..\..\Worlds\%1 -platformdir ..\..\..\_source_pc\Worlds\%1 -platform pc -inputfile !*.tga !*.pic -outputdir munged\ %~3 -format compressed -checkdate -continue
terrainmunge -sourcedir ..\..\..\Worlds\%1 -platformdir ..\..\..\_source_pc\Worlds\%1 -platform pc -inputfile !*.ter -outputdir munged\ -checkdate -continue
worldmunge -sourcedir ..\..\..\Worlds\%1 -platformdir ..\..\..\_source_pc\Worlds\%1 -platform pc -inputfile !*.wld -outputdir munged\ -checkdate -continue
pathmunge -sourcedir ..\..\..\Worlds\%1 -platformdir ..\..\..\_source_pc\Worlds\%1 -platform pc -inputfile !*.pth -outputdir munged\ -checkdate -continue
pathplanningmunge -sourcedir ..\..\..\Worlds\%1 -platformdir ..\..\..\_source_pc\Worlds\%1 -platform pc -inputfile !*.pln -outputdir munged\ -checkdate -continue

Once again it should now look like this.
Quoteodfmunge -sourcedir ..\..\..\Worlds\%1 -platformdir ..\..\..\_source_pc\Worlds\%1 -platform pc -inputfile !*.odf -outputdir munged\ -checkdate -continue
modelmunge -sourcedir ..\..\..\Worlds\%1 -platformdir ..\..\..\_source_pc\Worlds\%1 -platform pc -inputfile !*.msh -outputdir munged\ -checkdate -maxbones 16 -keep collision -continue -righthanded
texturemunge -sourcedir ..\..\..\Worlds\%1 -platformdir ..\..\..\_source_pc\Worlds\%1 -platform pc -inputfile !*.tga !*.pic -outputdir munged\ %~3 -format compressed -checkdate -continue
terrainmunge -sourcedir ..\..\..\Worlds\%1 -platformdir ..\..\..\_source_pc\Worlds\%1 -platform pc -inputfile !*.ter -outputdir munged\ -checkdate -continue
worldmunge -sourcedir ..\..\..\Worlds\%1 -platformdir ..\..\..\_source_pc\Worlds\%1 -platform pc -inputfile !*.wld -outputdir munged\ -checkdate -continue
pathmunge -sourcedir ..\..\..\Worlds\%1 -platformdir ..\..\..\_source_pc\Worlds\%1 -platform pc -inputfile !*.pth -outputdir munged\ -checkdate -continue
pathplanningmunge -sourcedir ..\..\..\Worlds\%1 -platformdir ..\..\..\_source_pc\Worlds\%1 -platform pc -inputfile !*.pln -outputdir munged\ -checkdate -continue
model-edit munged\ <factor>
[/spoiler]

[spoiler=SWBF2 munge_side.bat]Find this block of commands (if you struggle search the file for "_modelmunge").
Quoteodfmunge -inputfile $*.odf %MUNGE_ARGS% -sourcedir %SOURCE_DIR% -outputdir %MUNGE_DIR% 2>>%MUNGE_LOG%
configmunge -inputfile effects\*.fx %MUNGE_ARGS% -sourcedir %SOURCE_DIR% -outputdir %MUNGE_DIR% 2>>%MUNGE_LOG%
move /y configmunge.log configmunge_fx.log
configmunge -inputfile $*.combo %MUNGE_ARGS% -sourcedir %SOURCE_DIR% -outputdir %MUNGE_DIR% 2>>%MUNGE_LOG%
move /y configmunge.log configmunge_combo.log
configmunge -inputfile $*.hud %MUNGE_ARGS% -sourcedir %SOURCE_DIR% -outputdir %MUNGE_DIR% 2>>%MUNGE_LOG%
move /y configmunge.log configmunge_hud.log
%MUNGE_PLATFORM%_modelmunge -inputfile $*.msh %MUNGE_ARGS% -sourcedir %SOURCE_DIR% -outputdir %MUNGE_DIR% 2>>%MUNGE_LOG%
%MUNGE_PLATFORM%_texturemunge -inputfile $*.tga $*.pic %MUNGE_ARGS% -sourcedir %SOURCE_DIR% -outputdir %MUNGE_DIR% 2>>%MUNGE_LOG%

Add the command below it so it now looks like this.
Quoteodfmunge -inputfile $*.odf %MUNGE_ARGS% -sourcedir %SOURCE_DIR% -outputdir %MUNGE_DIR% 2>>%MUNGE_LOG%
configmunge -inputfile effects\*.fx %MUNGE_ARGS% -sourcedir %SOURCE_DIR% -outputdir %MUNGE_DIR% 2>>%MUNGE_LOG%
move /y configmunge.log configmunge_fx.log
configmunge -inputfile $*.combo %MUNGE_ARGS% -sourcedir %SOURCE_DIR% -outputdir %MUNGE_DIR% 2>>%MUNGE_LOG%
move /y configmunge.log configmunge_combo.log
configmunge -inputfile $*.hud %MUNGE_ARGS% -sourcedir %SOURCE_DIR% -outputdir %MUNGE_DIR% 2>>%MUNGE_LOG%
move /y configmunge.log configmunge_hud.log
%MUNGE_PLATFORM%_modelmunge -inputfile $*.msh %MUNGE_ARGS% -sourcedir %SOURCE_DIR% -outputdir %MUNGE_DIR% 2>>%MUNGE_LOG%
%MUNGE_PLATFORM%_texturemunge -inputfile $*.tga $*.pic %MUNGE_ARGS% -sourcedir %SOURCE_DIR% -outputdir %MUNGE_DIR% 2>>%MUNGE_LOG%
model-edit munged\ <factor>
[/spoiler]

[spoiler=SWBF2 munge_world.bat]Find this block of commands. (Search for "worldmunge" if you struggle.)
Quoteodfmunge -inputfile $*.odf %MUNGE_ARGS% -sourcedir %SOURCE_DIR% -outputdir %MUNGE_DIR% 2>>%MUNGE_LOG%
%MUNGE_PLATFORM%_modelmunge -inputfile $*.msh %MUNGE_ARGS% -sourcedir %SOURCE_DIR% -outputdir %MUNGE_DIR% 2>>%MUNGE_LOG%
%MUNGE_PLATFORM%_texturemunge -inputfile $*.tga $*.pic %MUNGE_ARGS% -sourcedir %SOURCE_DIR% -outputdir %MUNGE_DIR% 2>>%MUNGE_LOG%
terrainmunge -inputfile $*.ter %MUNGE_ARGS% -sourcedir %SOURCE_DIR% -outputdir %MUNGE_DIR% 2>>%MUNGE_LOG%
worldmunge -inputfile $*.lyr %MUNGE_ARGS% -sourcedir %SOURCE_DIR% -outputdir %MUNGE_DIR% 2>>%MUNGE_LOG%
worldmunge -inputfile $*.wld %MUNGE_ARGS% -sourcedir %SOURCE_DIR% -outputdir %MUNGE_DIR% 2>>%MUNGE_LOG%

Add the command below it so that it now looks like this.
Quoteodfmunge -inputfile $*.odf %MUNGE_ARGS% -sourcedir %SOURCE_DIR% -outputdir %MUNGE_DIR% 2>>%MUNGE_LOG%
%MUNGE_PLATFORM%_modelmunge -inputfile $*.msh %MUNGE_ARGS% -sourcedir %SOURCE_DIR% -outputdir %MUNGE_DIR% 2>>%MUNGE_LOG%
%MUNGE_PLATFORM%_texturemunge -inputfile $*.tga $*.pic %MUNGE_ARGS% -sourcedir %SOURCE_DIR% -outputdir %MUNGE_DIR% 2>>%MUNGE_LOG%
terrainmunge -inputfile $*.ter %MUNGE_ARGS% -sourcedir %SOURCE_DIR% -outputdir %MUNGE_DIR% 2>>%MUNGE_LOG%
worldmunge -inputfile $*.lyr %MUNGE_ARGS% -sourcedir %SOURCE_DIR% -outputdir %MUNGE_DIR% 2>>%MUNGE_LOG%
worldmunge -inputfile $*.wld %MUNGE_ARGS% -sourcedir %SOURCE_DIR% -outputdir %MUNGE_DIR% 2>>%MUNGE_LOG%
model-edit munged\ <factor>
[/spoiler]

Again in all cases remember to replace <factor>!
Title: Re: model-edit - v0.1.1
Post by: Giftheck on October 14, 2017, 12:19:04 AM
Much appreciated, thanks :)

EDIT: Note: seems to crash when dealing with "tat_inf_jawa_low1.msh". I created a separate "munge_sides.bat" to deal with the Jawa side file that doesn't load modelmunge in the interim. Factor 8 makes the units "slide" so it's a matter of finding the right setting. Hopefully someday we will find a way of tricking the animation system too.
Title: Re: model-edit - v0.1.1
Post by: Giftheck on January 28, 2018, 01:01:12 PM
I've had quite a major issue brought to my attention, but it seems the issue is selective.

http://www.swbfgamers.com/index.php?topic=12624.msg117779#msg117779

My first release of Legacy Phase 2 used model-edit, but while it worked as intended for me and several others, a few others have had a bizarre issue. I asked MikeTheBeast55 to test a heroes.lvl without the model-edit applied, and that works as intended.
Title: Re: model-edit - v0.1.3
Post by: SleepKiller on July 15, 2019, 08:32:14 AM
Just so any interested modders know I released an update to this that (probably) fixes a bug relating to shadows with it.
EhPortal 1.34 © 2024, WebDev