studiomdl problem?


=[L*H]=Hitman
04-21-2004, 10:28 AM
Is there any way for studiomdl.exe to NOT compile a model so that it resizes the image? I have a 512x512 image and it resizes it to like 507x511. What the hell is this!? Is there a different version that does NOT resize my images?

If so, please direct me towards it because I dislike this resizing of images!

Thanks for your time...

Trp. Jed
04-21-2004, 01:24 PM
Yeah, its a bug in the current version of StudioMDL. I have notifided Mugsy about it but whether he remembers to fix in the next version...

However, there is a fix but its a bit of a hack so read on carefully.

First thing you need to do is make a change to your QC file. Somewhere after all the $body and $bodygroup definitions, add the following:


// studiomdl.fix
$bodygroup "fix" {
blank
studio "fix"
}


OK. Now, with that done, open one of your reference SMD's, doesnt matter which one, in a text editor. At the top of your SMD, you'll see a section called "nodes". Basically these are the bones in your model and we're only interested in the first one which starts with a zero (0) and ends in -1.

What you do next is you create a new text file and call it "fix.smd". You paste the following into the top of that text file and place line for the node "0" which you got from your SMD in the correct place.


version 1
nodes
0 "Root" -1
end


O.K. That done, we want to create a new section directly underneath that by copying and pasting the following:


triangles
texture_filename.bmp
0 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
0 0.0000 0.0001 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000
0 0.0001 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000
end


The next stage is to duplicate the section starting "texture_filename.bmp" and the three lines of numbers underneath it for as many textures there are in your model. What you then do is change the "texture_filename.bmp" lines, adding the names of the texture files in your model.

So, assuming I have 4 textures in my model called "my_texture_1", "my_texture_2" and so on, my final SMD file would look like this:


version 1
nodes
0 "Root" -1
end
triangles
my_texture_1.bmp
0 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
0 0.0000 0.0001 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000
0 0.0001 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000
my_texture_2.bmp
0 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
0 0.0000 0.0001 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000
0 0.0001 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000
my_texture_3.bmp
0 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
0 0.0000 0.0001 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000
0 0.0001 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000
my_texture_4.bmp
0 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
0 0.0000 0.0001 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000
0 0.0001 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000
end


Make sure you don't forget the "end" at the end of the file. O.K, thats that, so save your fix.smd along with your other smd files. If your SMD's are in a different location to the QC file, alter the reference to it in the $bodygroup as needed.

O.K. With that done, compile your model! :)

What it does is add a subgroup to your model called fix where the first group is blank and the second contains a miniscule polygon, 1 for each texture, at the origin of your model. Because the first reference in the fix bodygroup is blank and the game doesn't use the group, the tiny polygons never get drawn to screen and never mess with your polycount.

What the fix.smd does, is for each texture in your model, it maps one of the polygons to it, and sets it use the absolute maximum width and height of the texture. Because of this when Studiomdl tries to compile, it cant reduce the size of the texture because it thinks all of it is being used by the model.

- Jed

=[L*H]=Hitman
04-21-2004, 11:28 PM
Jed.......... <3

Silverghost
05-01-2004, 02:49 PM
All this to fix that damn cropping problem? bah,

Ive notice that it doesnt always crop when compiling when test compiling my ahcked model, but as soon as everything is good, and I want to finish it, it always crops D:

Felix
05-06-2004, 05:16 PM
I hate to revive this thread guys, but I just figured out after a lot of trial and error that the 'end' at the end of the fix.smd actually keeps this from working.

(Edit: Okay maybe I was wrong...it seems like only one of them didn'[t crop for some reason.)

Silverghost
05-14-2004, 09:07 PM
yeah that is wierd

the 'end' in the last section gives me an error
************ ERROR ************
.\/end not found
,ü

So I got rid of the end and it compiled, and none of the textures got clipped.

Trp. Jed
05-15-2004, 09:10 AM
Thats wierd, technically any section of the SMD requires an end to tell the parser that the section has actually ended.

- Jed

Day of Defeat Forum Archive created by Neil Jedrzejewski.

This in an partial archive of the old Day of Defeat forums orignally hosted by Valve Software LLC.
Material has been archived for the purpose of creating a knowledge base from messages posted between 2003 and 2008.