Game Development Community

Objects not "skinned" when exported

by Edward Maybert · in Artist Corner · 01/19/2005 (3:16 pm) · 8 replies

I am new to MilkShape and Torque and cannot seem to figure out what I am doing wrong here. When I create a model in MilkShape, skin it, and export it as a DTS into Torque, the model shows up but not the material. ( model is grey ).

I have ensured that, when exporting, the "Export Materials" checkbox was selected, and also ensured the texture file was co-located in the same folder as the DTS file.

There were no errors reported in the console either.

Any help on where to look to resolve this peoblem would be greatly appreciaed.
~ed

#1
01/19/2005 (5:11 pm)
Possibly a dumb question: when you skin it inside MilkShape, does the texture show up correctly in the 3D window, or does it show up grey inside MS3D also?

Another question, not so dumb this time: did you use UVWrapper to skin your model, or MilkShape's built-in Texture Mapper (I think that's what it's called)?
#2
01/19/2005 (7:43 pm)
Hey Ray, thanks for the response.

The texture shows up fine in the MilkShape 3D Window. I did use UVWrapper. I loaded the Milkshape model file into UVWrapper, created and exported the resulting UV model and associated UV texture files, which I then imported back into MilkShape to perform the final skin.

I tried different file formats for the texture file too; BMP, JPG, and PNG; all with the same result.

As far as the Torque end of it, I am following along with the 3D Prgramming All-In-One Book, and basically followed what the author did there... I created a Torque "Item" in a *.cs file, and then used the World Editor to place the Item into the World. The Item shows up fine ( spins in place like other Torque Items ). Also, the extra parameters I set in MilkShape ( such as creating a new material named "opt:scale=0.1" for scaling) work fine too ( the scaling works ).

I was thinking that maybe the texture file was in the wrong directory, so have been moving it around, but to no avail. Since I'm not too familiar with Torque, I'm not sure how Torque determines "where" to look for texture files and "which" file to load ( is that info embedded in the DTS file, or declared in some *.cs file ).

Lastly, I have also tried the new Milkshape DTS exporter, but that doesn't work either ( in fact, in munges the material names in Milkshape ).

Thoughts?
Thanks again for the help,
~ed
#3
01/20/2005 (12:31 am)
Well, if it's looking okay in MilkShape, that eliminates your Material name as the source of the problem.

And you put both the item and its texture/skin files in the same directory, like data/shapes/items, so that's not the problem.

You created a file called server/scripts/whatever.cs, where you defined both an Item and a ShapeBaseImage, specifying the same shapeBase file in both datablocks.

And the file server/scripts/whatever.cs wouldn't have loaded if you hadn't exec'ed it in the beginning part of server/scripts/game.cs. So that's not it.

It must be something with the exporter. Hmm...

Try this: export it using the old Torque Game Engine DTS exporter. At the bottom of the exporter dialog is a checkbox that says:
Export material information
.
Make sure that checkbox is checked. When I toggle that checkbox off and on, my texture disappears and reappears on the exported model. (Ed, thanks again for Looking Gl -- er, Torque Show Tool Pro.)

I can't find a similar setting in the new Torque DTS Plus exporter, so I can't help you with that one. Yet.

Regards
Ray
#4
01/20/2005 (7:04 am)
I tried un-checking/re-checking the "export materials" box with the same result.

I thought I'd start from scratch again so I made a new model in Milkshape ( just a 3x3 box ), unwrapped the texture in UVMapper, exported the new unwrapped model and texture files, etc so once again all looked good in MilkShape. I then went into Torque World Editor Creator, selected my new box from the Static Shapes Tree hierarcy and placed the box in the world, but again, the box showed up untextured ( grey ) in Torque.

I then loaded both my original model as well as the new 3x3 Box model in the Torque Show tool and both still appeared untextured (grey) in the show tool as well.

Strange.

I am using the following:
MilkShape 3D 1.7.0
UVMapper 0.25e (beta)
DTS Exporter V 1.3
Torque and Torque Show Tool 3DGPAI1 version ( came on a CD with the 3D Game Programming All-In-One book )
all running on a WinXP Pro box ( Pentium 4, 1GB RAM)

Thanks again for the time and effort.
~ed
#5
01/20/2005 (3:07 pm)
Ed, would you mind emailing me your files? I'll try to duplicate your problem on my end. I've got all the tools you listed, so it should be pretty easy. My email address is listed in my GG profile. (Click on my name at the left to find the email address.)

I'll need the following files:
your_model.ms3d - the MilkShape file
your_model.dts - the Torque DTS file
your_model.obj - the UVMapper file
your_models_skin.bmp (it's big and bulky, but bombproof)
server/scripts/wherever_your_model_is.cs
server/scripts/game.cs

I have seen this before, and ironically it was while I was working through Ken Finney's book.

Regards
Ray
#6
01/20/2005 (5:59 pm)
Good news, bad news. Good news: I finally got something to render! Bad news: not sure what I did to fix it ;)

Well... I only really did two things, both to the BMP texture file. First, I increased the color-depth to 16 million colors. Second, I ensured the file was square (512X512) or (1024X1024).

I also think perhaps the original model is somehow corrupted as that one still renders grey, but when I copy it under a new name, ( as well as use new names for all texture files ) then all is ok.

Part of it too is perhaps, since I'm using Ken Finney's code-base, there are dozens of files I've been hacking away at, most of which I only partly understand at this point, and who knows what glitches I may have inadvertantly introduced.

So I think, at least for now, I'm back on track. Thanks for the generous offer to review my files though. I'm going to try to get that original model to render tomorrow and will drop a note to let you know how it went. If you're like me, it bugs me when I don't know why something doesn't work as it should :)

I will let you know if I get that going or not.
~ed
#7
01/20/2005 (6:11 pm)
I'm very glad to hear that you have it licked. I laugh at myself when my ego gets involved and I have to track the problem to its source if only to satisfy my curiosity or my pride.

Finney's code base is organized to make a complicated subject simpler for beginners, and yet we (yes, all of us) still blunder around in our ignorance. Sometimes I delete the entire Torque directory and start over. I actually do my modeling in another part of the HD completely, and copy the relevant files to the Torque directories.

About texture size:
One cool thing I discovered on these forums was that although the dimensions of the texture file have to be powers of two, they don't have to be square. This is useful if, for example, you're modeling something long and slender. If you create a long and slender texture and then resize it to 512x512, you lose a lot of detail, but if you resize it to something closer to the original, like 64x512, you get much better detail on your textured model.

Best of luck to you.

Regards
Ray
#8
01/20/2005 (7:42 pm)
Thanks for the note on the texture size. I would have wasted many bits thinking I needed a square texture.

I finally got the original model to render! ( yeah I know... sometimes I just can't let things go... those are the times I know I was born a programmer :) ).

I was examining/comparing the two *.cs files of the model that rendered vs. the model that didn't and the only difference was that the one that didn't render had a commented out line of code. So when I removed the comment... viola'... the darned thing rendered! Even funnier though is when I put the comment back in... it still rendered?!?! My only guess is that by altering the file, I set the dirty flag which caused Torque to recompile the *.cs which resolved the prob. ( possibly the original compiled file was corrupted? )

Anyway *whew* I feel better now. The world makes sense again. ( at least the digital one )

Thanks again for all your help, and if ever I can return the favor just drop me a line. I'd be more then happy to help!

~ed