mdlc -optimize

Discussion area for user-created Allegiance models, textures, voicechats, music, and other ingame content.
Post Reply
Compellor
Posts: 994
Joined: Fri Jul 06, 2007 12:56 am
Location: Columbus, OH

Post by Compellor »

Okay, I get that I'm supposed to create a text mdl, what I'm not sure of is how. Do I just create a text file and rename it *.mdl? Does it need to be *text.mdl, like with bmps? Do I need to do something with mdlThing? The wiki doesn't address this at all.

Also, if I can view a .x file in mdledit, does that necessarily mean mdlc -optimize will work?

As to the content, the wiki says:
QUOTE

Code: Select all

use "effect";

frame = ModifiableNumber(initialFrame);

object = ImportXFile("name.x", frame);
Where "name.x" is the name of your model. As the .x format allows animation but .mdl does not, you must also specify which frame within the animation a "snapshot" of the model should be taken to be used as the un-animated model in the .mdl.[/quote]
So would the end result be the following?

Code: Select all

use "effect";

frame = ModifiableNumber(initialFrame);

object = ImportXFile("fig02.x", 1);
...or are some of those other words, like initialFrame, actually placeholders? Again, the wiki isn't clear.
Any job worth doing with a laser is worth doing with many, many lasers. -Khrima
Beyond a shadow of a doubt if you don't watch them like a hawk they will stack their collective balls off - MrChaos on Alleg players
Imago
Posts: 1440
Joined: Tue Sep 23, 2003 7:00 am
Location: Minneapolis, MN
Contact:

Post by Imago »

maybe this batch file i wrote to help build art will shed some light?

makegeo.bat

Code: Select all

@echo off

rem %1 base file name (no path or extention)
rem %2 mdl build action (see template if's below)
rem %3 frame number (mostly 1)
rem %4 set to 1 to skip progressive mesh and flatten convex hulls

If Not Exist %1_static.x copy %1.x %1_static.x
If not %2 == 4 xmunge -flatten %3 %1_static.x %1flat.x
if not "%4" == "1" goto makepm
:backfrompm
If %2 == 0 goto dolowtemplate
If %2 == 1 goto doregtemplate
If %2 == 2 goto dostatictemplate
If %2 == 3 goto donolodtemplate
If %2 == 4 goto dotextonly
:backfromtemplate
mdlc -optimize %1source %1
if not "%4" == "1" (goto extractpm) else (goto flatcvh)
:bounds
xmunge -bound %3 %1_bound.x %1
cvh -bound %1
:done
@echo finished %1
goto quit


:dolowtemplate
echo > %1source.mdl use "effect"; frame = ModifiableNumber(%3); object = LODGeo(ImportXFile("%1.x", frame),[ (64, ImportXFile("%1_static", frame)),(32, ImportXFile("%1_a", frame)),(8, ImportXFile("%1-low", frame)) ]);
goto :backfromtemplate

:doregtemplate
echo > %1source.mdl use "effect"; frame = ModifiableNumber(%3); object = LODGeo(ImportXFile("%1.x", frame),[ (64, ImportXFile("%1_static", frame)),(32, ImportXFile("%1_a", frame)),(8, ImportXFile("%1_b", frame)) ]);
goto :backfromtemplate

:dostatictemplate
echo > %1source.mdl use "effect"; frame = ModifiableNumber(%3); object = LODGeo(ImportXFile("%1.x", frame),[ (64, ImportXFile("%1_static", frame)) ]);
goto :backfromtemplate

:donolodtemplate
echo > %1source.mdl use "effect"; frame = ModifiableNumber(%3); object = ImportXFile("%1.x", frame);
goto :backfromtemplate

:dotextonly
if %1 == lens (mdlc %1text %1.mdl) else (mdlc -optimize %1text %1)
goto :done

:makepm
call convpm %1flat
xmunge -reduce 0.5   %1flat_pm.x %1_a.x
xmunge -reduce 0.01  %1flat_pm.x %1_b.x
goto :backfrompm

:extractpm
xmunge -extract %3 %1.x %1
If Exist %1_bound.x goto bounds
cvh -extract %1
goto done

:flatcvh
cvh -flatten %1
goto :done


:quit
here is a list of "original" geos, suitable for passing to geo2mdl (see below)
geo.txt
CODEacs02 2 1
acs05 2 1
acs08 2 1
acs19 1 1
bgrnd03 0 1
bgrnd05 0 1
bgrnd50 0 1
bgrnd51 0 1
bgrnd52 0 1
bgrnd53 0 1
bgrnd54 0 1
bgrnd55 0 1
bgrnd56 0 1
bgrnd57 0 1
bom01a 1 44
bom01b 1 32
bom03 1 20
bom04 1 60
bom05 1 95
bom05b 1 95
bom07 1 60
bom07b 1 60
bom20 1 1
bom30 1 1
cap01 1 60
cap02a 1 1
cap03 1 1
cap04 1 1
cap05 2 1
cap06a 1 1
cap500 2 1
cap501 2 1
cap502 2 1
cap503 2 1
cap504 2 1
cap07 1 1
cap08 1 1
cap09 1 1
cap20 1 1
cap100 1 1
cap101 1 1
cap102 1 1
cap103 1 1
cap300 1 1
cap301 1 1
cap302 1 1
cap303 1 1
cap21 1 1
fig01 1 40
fig02 0 76
fig03 0 30
fig04 0 57
fig05 0 61
fig07 1 58
fig08 1 59
fig09 1 59
fig11 1 59
fig12 0 47
fig13 1 60
fig16 1 60
fig15 1 60
fig17 1 60
fig20 1 1
fig21 1 1
fig22 1 1
fig23 1 1
fig24 1 1
fig25 1 1
fig30 1 1
fig31 1 1
fig32 1 1
fig33 1 1
fig34 1 1
mis12 1 15
ss01 2 1
ss06 2 1
ss18 2 1
ss19a 2 1
ss21a 2 1
ss22 2 1
ss23 2 1
ss24a 2 1
ss27 2 1
ss28 2 1
ss90 2 1
ss92 2 1
ss93 2 1
ss94 2 1
ss95 2 1
ss96 2 1
ss97 2 1
ss98 2 1
ss99 2 1
ss100 2 1
ss101 2 1
ss102 2 1
ss103 2 1
ss104 2 1
ss105 2 1
ss106 2 1
ss107 2 1
ss300 2 1
ss301 2 1
ss302 2 1
ss303 2 1
ss304 2 1
ss305 2 1
ss306 2 1
ss307 2 1
utl01b 1 1
utl02 1 1
utl04 1 1
utl06 1 1
utl07 1 1
utl17a 1 1
utl18a 1 1
utl19 0 1
utl20 2 1
utl27a 1 49
utl27b 1 49
utl28a 1 1
utl94 1 1
utl95 1 1
utl103 1 1
utl104 1 1
utl105 1 1
utl200 1 1
utl201 1 1
utl202 1 1
utl203 1 1
utl204 1 1
utl205 1 1
fig02ops1 1 1
fig05ops1 1 1
fig07ops1 1 1
fig11ops1 1 1
utl92a 1 1
artifact 3 1 1
aleph_sphere 3 1 1
belters_flagplat 3 1 1
biosplat 3 1 1
flag 3 1 1
giga_flagplat 3 1 1
ic_flagplat 3 1 1
rix_flagplat 3 1 1
acs14 3 1 1
utl22 3 1 1
utl93b 3 1 1
utl91 3 1 1
utl90 3 1 1
utl74 3 1 1
utl666 3 1 1
acs01 3 75 1
acs04 3 1 1
acs29 3 1 1
acs30 3 1 1
acs34 3 1 1
acs36 3 1 1
acs38 3 1 1
acs39 3 1 1
acs40 3 1 1
acs41 3 1 1
acs42 3 1 1
acs46 3 1 1
acs48 3 1 1
acs56 3 1 1
acs57 3 1 1
acs63 3 1 1
acs64 3 1 1
mis01 3 1 1
mis02 3 1 1
mis03 3 1 1
mis05 3 1 1
mis06 3 1 1
mis07 3 1 1
mis08 3 1 1
mis09 3 1 1
mis10 3 1 1
mis11 3 1 1
mis13 3 15 1
mis14 3 15 1
muzzle 3 15 1
ops1 3 1 1
ops2 3 1 1
ss02 3 1 1
ss04 3 1 1
ss05 3 1 1
ss08 3 1 1
ss20 3 1 1
utl01 3 1 1
utl10 3 1 1
debris 3 1 1
utl11 3 1 1
utl14a 3 1 1
utl23 3 1 1
utl23f 3 1 1
utl24 3 1 1
utl25 3 1 1
utl99 3 1 1
utl100 3 1 1
utl101 3 1 1
utl102 3 1 1
wep01 3 1 1
wep02 3 1 1
wep03 3 1 1
wep04 3 1 1
wep05 3 1 1
wep06 3 1 1
wep07 3 1 1
wep08 3 1 1
wep09 3 1 1
wep10 3 1 1
wep11 3 1 1
wep12 3 1 1
wep13 3 1 1
wep16 3 1 1
wep17 3 1 1
wep18 3 1 1
wep19 3 1 1
wep90 3 1 1
wep91 3 1 1
wep92 3 1 1
utl05 3 1 1
pointer 4 0 1
cube 4 0 1
sphere 4 0 1
circle 4 0 1
globe 4 0 1
globe1 4 0 1
globe2 4 0 1
globe3 4 0 1
globe4 4 0 1
globe5 4 0 1
globe6 4 0 1
globe7 4 0 1
globe8 4 0 1
globe9 4 0 1
globe10 4 0 1
lens 4 0 1


geo2mdl.bat

Code: Select all

FOR /F "tokens=1,3* delims=," %%G IN (geo.txt) DO @makegeo %%G

EDIT beware: the echo commands for template generation appear to have wrapped in the code tags
also be advised you need a "custom" cvh.exe that uses the CWD (not artbuild) as well as all the usual suspects:
xtobm.exe
xmunge.exe
rlines.exe
qhull.exe
pmxtox.exe
meshimp.exe
mdlc.exe
fprog.exe
fmesh.exe
above all need to be in CWD

convpm.bat changed slightly to remove the fedroot stuff

CODE@echo off
rem Usage: convpm rootname
rem For example. If you have a file mesh.x run as "convpm mesh"

if not exist %1.x goto error_nofile

rem Option: merge faces topologically based on vertex geometry (-gmerge)
set filteropt1=
set filteropt1=-gmerge -genus


rem Option: regenerate normals based on dihedral angles between faces
set filteropt2=


rem Option: speed up simplification by including fewer edges in initial priority queue
set simpopt1=


rem Option: improve simplification fidelity, specify number of points (default= #vertices)
set simpopt2=

set filter1=-genus -triangulate -genus %filteropt1% -fixvertices -fixfaces
set filter2=-rmcomp 0 -renormalizenor -genus -nice %filteropt2%


rem Start of the conversion process

echo Converting X File to Internal mesh format
xtobm.exe %1.x
if errorlevel 1 goto error_xtobm

echo Filtering internal mesh format file
fmesh.exe %1.m %filter1% %filter2% > %1.nice.m
if errorlevel 1 goto error_filtermesh
echo .

echo Simplifying mesh to a base mesh and a set of vertex splits
meshsimp.exe %1.nice.m -prog %1.prog %simpopt1% %simpopt2% -simplify >%1.base.m
if errorlevel 1 goto error_simplify

rlines.exe %1.prog >%1.rprog
if errorlevel 1 goto error_reverse
echo .

echo Converting Base Mesh and Vsplits to .X file
fprog.exe -fbase %1.base.m -fprog %1.rprog -pm >%1.pm
if errorlevel 1 goto error_filterprog

pmtopmx.exe %1.pm
if errorlevel 1 goto error_pmtopmx

echo .
pmxtox.exe %1.pmx
if errorlevel 1 goto error_pmxtox

echo All Done!
goto exit

:error_nofile
echo %1.x doesn't exist. Usage convpm base_filename
goto exit

:error_xtobm
echo Converting the X File to Internal mesh format failed
goto exit

:error_filtermesh
echo .
echo Filtering the internal mesh failed
goto exit

:error_simplify
echo .
echo Simplifying the mesh failed
goto exit

:error_reverse
echo .
echo Reverselines failed
goto exit

:error_filterprog
echo .
echo Creating the PM file failed
goto exit

:error_pmtopmx
echo .
echo Converting the PM to PMX file format failed
goto exit

:error_pmxtox
echo .
echo Converting the PMX file to an X File failed
goto exit

:exit

Last edited by Imago on Fri Jul 11, 2008 2:15 am, edited 1 time in total.
Image

These bugs haven't been fixed yet because don't have any developers interested in fixing them up. --Tigereye
Imago's stupid-sensor is supersensitive. --RealPandemonium
The art is managing the flow of the drama to achieve the desired results. --Big_Beta_Tester
joeld wrote:But we’ve been amazed at the level to which some of the Allegiance fans have remained hard-core.
Compellor
Posts: 994
Joined: Fri Jul 06, 2007 12:56 am
Location: Columbus, OH

Post by Compellor »

I see things are rather complicated. Thanks for the info dump, I'll pour over it eventually.
Any job worth doing with a laser is worth doing with many, many lasers. -Khrima
Beyond a shadow of a doubt if you don't watch them like a hawk they will stack their collective balls off - MrChaos on Alleg players
Compellor
Posts: 994
Joined: Fri Jul 06, 2007 12:56 am
Location: Columbus, OH

Post by Compellor »

You say I need a custom cvh.exe, where would I get that? Would that be the one that comes in the standard 'tools' download?
Any job worth doing with a laser is worth doing with many, many lasers. -Khrima
Beyond a shadow of a doubt if you don't watch them like a hawk they will stack their collective balls off - MrChaos on Alleg players
Imago
Posts: 1440
Joined: Tue Sep 23, 2003 7:00 am
Location: Minneapolis, MN
Contact:

Post by Imago »

I'm not sure, if you can't build your own cvh and the tools download contains a cvh.exe that was built with the /artbuild/ path code, you may have to make a folder called /artbuild/ and move stuff around to accomidate
Image

These bugs haven't been fixed yet because don't have any developers interested in fixing them up. --Tigereye
Imago's stupid-sensor is supersensitive. --RealPandemonium
The art is managing the flow of the drama to achieve the desired results. --Big_Beta_Tester
joeld wrote:But we’ve been amazed at the level to which some of the Allegiance fans have remained hard-core.
Adaven
Posts: 1959
Joined: Sat Oct 25, 2003 7:00 am
Location: Greater Ozarks

Post by Adaven »

What are you trying to do?

The text mdl's are really only used for textures I thought. I don't think you really *need* to use text mdl's. They were just created to make things a little easier for editing. The Alleg installer still uses regular bmp.mdl's, the only text mdl's you might have in your artwork folder are there from mods because some of the custom artists prefer using them.

All the text mdl files say is something like this example:

nebulatest-1.mdl
QUOTE use "model";
nebulatest-1bmp = ImportImageFromFile("nebulatest-1.bmp", true);[/quote]

All it is doing is telling your computer that when it looks for a texture bmp.mdl file, that it can get the image data from a regular picture file at a certain location. The True/False at the end turns on/off black = transparent. You could probably make one in notepad and rename it to .mdl, or you can use MdlThing which lets you take image files and creates text .mdl's that point to them.
Compellor
Posts: 994
Joined: Fri Jul 06, 2007 12:56 am
Location: Columbus, OH

Post by Compellor »

What's going on here is that I'm trying to put a model ingame without buying milkshape, for my own amusement really. From the searching I've done on the forums, it seems to be possible, but while I didn't expect it to be easy, or for there to be much documentation, I'm starting to wonder whether this is some sort of fool's errand. This is the first time I've even looked at a batch file.
Any job worth doing with a laser is worth doing with many, many lasers. -Khrima
Beyond a shadow of a doubt if you don't watch them like a hawk they will stack their collective balls off - MrChaos on Alleg players
madpeople
Posts: 4787
Joined: Tue Dec 16, 2003 8:00 am
Location: England

Post by madpeople »

Compellor wrote:QUOTE (Compellor @ Jul 11 2008, 12:33 AM) Okay, I get that I'm supposed to create a text mdl, what I'm not sure of is how. Do I just create a text file and rename it *.mdl? Does it need to be *text.mdl, like with bmps? Do I need to do something with mdlThing? The wiki doesn't address this at all.

Also, if I can view a .x file in mdledit, does that necessarily mean mdlc -optimize will work?

As to the content, the wiki says:

So would the end result be the following?

Code: Select all

use "effect";

frame = ModifiableNumber(initialFrame);

object = ImportXFile("fig02.x", 1);
...or are some of those other words, like initialFrame, actually placeholders? Again, the wiki isn't clear.
initial frame is a place holder, if you don't know what to use it for, put 0 in. (.x supports animation that number selects which frame from the animation to use for the model) - i thought i explained that when i wrote the wiki *wonders if it got changed - i would check, but i'm on my laptop*

basically, choose the simplest text example, copy it into a .txt file, change initial frame, change the file.x to be your .x file
rename your .txt file to .mdl
pass your text mdl to mdlc with the optimize parameter (as explained in the wiki)

hopefully you will get a binary .mdl out the end, though you probably won't as the converter is rather fussy about what type of .x file you give it.

I can say it IS possible to make a .mdl file that works in allegiance from a .x file

EDIT: *i think*
it's been a while since i played with these things, and i never actually entered the variables into the template, a tool called sed.exe did it for me
you may need to search the forums for KGJV 's posts explaining these kinds of things
Adaven wrote:QUOTE (Adaven @ Jul 11 2008, 06:20 PM) ...
text .mdls can be used to do models too (see wiki on mdlc)
Last edited by madpeople on Fri Jul 11, 2008 7:13 pm, edited 1 time in total.
Imago
Posts: 1440
Joined: Tue Sep 23, 2003 7:00 am
Location: Minneapolis, MN
Contact:

Post by Imago »

lol, here:

http://downloads.sourceforge.net/freealleg...rig_artwork.zip (~60MB)

[quote=""Release notes""]Notes: Contains src/Artwork/256 without the .WAV, .MML (help) and misc files. I've added build tools and batch scripts so you don't need nmake. Simply unzip and double-click artbuild.bat.[/quote]


make changes to the .x, text.mdl, & .bmp /w mspaint and notepad if it suits you
Last edited by Imago on Sat Jul 12, 2008 7:28 am, edited 1 time in total.
Image

These bugs haven't been fixed yet because don't have any developers interested in fixing them up. --Tigereye
Imago's stupid-sensor is supersensitive. --RealPandemonium
The art is managing the flow of the drama to achieve the desired results. --Big_Beta_Tester
joeld wrote:But we’ve been amazed at the level to which some of the Allegiance fans have remained hard-core.
Compellor
Posts: 994
Joined: Fri Jul 06, 2007 12:56 am
Location: Columbus, OH

Post by Compellor »

If mdlc or xmunge won't work on, say, fig02.x, does that necessarily mean I'm doing something wrong? That is, am I right to assume that all the original .x files should work fine, for testing purposes?
Last edited by Compellor on Sun Jul 13, 2008 9:06 pm, edited 1 time in total.
Any job worth doing with a laser is worth doing with many, many lasers. -Khrima
Beyond a shadow of a doubt if you don't watch them like a hawk they will stack their collective balls off - MrChaos on Alleg players
Post Reply