Game Development Community

Milkshape LOD good news

by J. Alan Atherton · in Artist Corner · 11/07/2003 (12:51 am) · 30 replies

Hello Milkshapers,

Today I spent about 5 hours picking at the exporter code, trying to figure out how to add in levels of detail. Well, after a few hours of programming, I got my computer to crash really bad. After that, I started over and just did a simple test to see if I really understood. I got it... for a simple scene (just a sphere and cube) I got the sphere to be the up-close detail level, and the cube to be the distant level. I have no idea whether my current train of thought for implementing this will support animation or a collision mesh, but I imagine many of you would be glad to have even static LOD support. The process of creating a model that uses LOD will be very tedious and limited (probably frustrating too), but that's the way it must be with Milkshape as it stands.

I think I will have time this Saturday to try it out and see if animation works. I'll keep you posted, and when it's ready for testing I'll have anyone who wants make suggestions (which will become a TODO list).
Page «Previous 1 2
#1
11/07/2003 (4:02 am)
That is great news!
#2
11/07/2003 (5:46 am)
John - you are my new hero.

We (MS3D users) have needed this in Torque for a long long time. I'm just glad someone finally came along with enough of an understanding of it to pull it off! ;-)

Thanks in advance for your efforts and PLEASE keep us posted - this is VERY exciting news! =)

(You just made my month!)
#3
11/07/2003 (4:40 pm)
Oh, THANK YOU John :-) That's one of the features I've been hoping for in the MilkShape exporter one o' these days :-)
#4
11/08/2003 (4:55 pm)
Alright, the moment you've been waiting for is here! Download the file below, and to understand how to use it, read the README.txt file included. This is a very early version. No animation support. Things must be done a certain exact way for it to work. This is not designed to replace the other exporter. It only exports LOD meshes, not others. This will change in future versions. So backup your other exporter if you want to be able to export animations. Enjoy.

students.cs.byu.edu/~ecliptix/ms3dLOD.zip

Post here with suggestions or bugs. I do need to know about the bugs.
#5
11/09/2003 (10:33 pm)
Well, you guys are going to _flip_... I found out that animation DOES work in the current exporter. It's just time consuming to setup. But I don't think it gets much better with other editors... it's not really all that bad. I mean, you have to work to get anything to look good, right? So basically what you do is start with a fresh copy of your model (meaning you save it to a different name... backup like).
First you regroup everything into one group (except collision). (In a future version, this won't be necessary, but recommended). The joints should still be assigned to this group. This becomes your first detail level. Then you go through the process of creating the next detail level as outlined in the readme.txt. Once you've merged that with your master details file, you must re-assign the joints (the tedious part). Simply hide the first level of detail, then select the verts for the head, and assign to the head joint. Then select verts for the torso, assign to the torso joint. And so on. As long as each LOD appears in order on the mesh list (from top to bottom) you should get animated LOD.
It looks like the only things I need to do are: add options to the dialog, and allow for multiple meshes (instead of grouping into one big mesh, unless I decide to not support that, since it would take SO much more work for _you_ guys to create new levels of detail... you would have to regroup each segment of your model for each detail level, instead of just assigning to joints). Oh, and I guess I oughtta see about getting this into HEAD. Of course, we'll need to test to make sure it exports vehicles and such to the extent that it did before. Wait until I add the options before testing too much though :)
#6
11/10/2003 (12:42 am)
Hi John, great work

not sure if the following are some problems or not(so correct me if i'm wrong)

Following is the head and control block of your lodTest.dts

Nodes: 1
Objects: 2
decals: 0
subshapes: 1
iflmaterials: 0
noderations: 0
nodetranslations: 0
nodescalesuniform: 0
nodeScaleAligned: 0
nodescaleArbitrary: 0
groundtranslations: 0
ObjectStates: 2
decalStates: 0
Triggers: 0
detaillevels: 3
Meshes: 5
Names: 6
SmallestSize: 1,401298464324817E-45
smallest DetailLevel: 2
---------------------------------------------
Checkpoint: 0
---------------------------------------------
Shape Radius: 7,089494705200195
Shape TubeRadius: 5,729773998260498
Shape Center:
     x = -0,01250004768371582,
     y = 0,
     z = 0
Shape Bounds min.:
     x = -4,225471496582031,
     y = -4,212971687316895,
     z = -4,232950687408447
Shape Bounds max.:
     x = 4,2004714012146,
     y = 4,212971687316895,
     z = 4,232950687408447
---------------------------------------------
Checkpoint: 1
---------------------------------------------
Node(0)
  Name-Index = 0
  Parent = -1
  first Object = -1
  Child = -1
  Sibling = -1
---------------------------------------------
Checkpoint: 2
---------------------------------------------
Object(0)
  Name-Index = 1
  NumMeshes = 2
  first Mesh = 0
  Node = 0
  Sibling = -1
  firstdecal = -1
Object(1)
  Name-Index = 5
  NumMeshes = 3
  first Mesh = 2
  Node = 0
  Sibling = -1
  firstdecal = -1
---------------------------------------------
Checkpoint: 3
---------------------------------------------
---------------------------------------------
Checkpoint: 4
---------------------------------------------
---------------------------------------------
Checkpoint: 5
---------------------------------------------
  Subshape(0) FirstNode = 0
  Subshape(0) FirstObject = 0
  Subshape(0) Firstdecal = 0
---------------------------------------------
Checkpoint: 6
---------------------------------------------
  Subshape(0) NumNodes = 1
  Subshape(0) NumObjects = 2
  Subshape(0) NumDecals = 0
---------------------------------------------
Checkpoint: 7
---------------------------------------------
nodeDefTranslations(0)
     x = 0,
     y = 0,
     z = 0,
---------------------------------------------
Checkpoint: 8
---------------------------------------------
---------------------------------------------
Checkpoint: 9
---------------------------------------------
---------------------------------------------
Checkpoint: 10
---------------------------------------------
ObjectState(0)
  VIS = 1
  Frame = 0
  MatFrame = 0
ObjectState(1)
  VIS = 1
  Frame = 0
  MatFrame = 0
---------------------------------------------
Checkpoint: 11
---------------------------------------------
---------------------------------------------
Checkpoint: 12
---------------------------------------------
---------------------------------------------
Checkpoint: 13
---------------------------------------------
Detailevel(0)
  Name-Index = 2
  Subshape = 0
  ObjectDetail = 0
  Size = 120
  AvgError = -1
  MaxError = -1
  Polycount = 36
Detailevel(1)
  Name-Index = 3
  Subshape = 0
  ObjectDetail = 1
  Size = 80
  AvgError = -1
  MaxError = -1
  Polycount = 48
Detailevel(2)
  Name-Index = 4
  Subshape = 0
  ObjectDetail = 2
  Size = -1
  AvgError = -1
  MaxError = -1
  Polycount = 12
---------------------------------------------
Checkpoint: 14
---------------------------------------------

In the Shape are 2 objects, but the third detailblock points to a third object.
Object 0 = Lod0
Object 1 = col
So Detaillevel 2 is the Detaillevel for the Collision (you see it at its Size = -1), maybe there will be some problems with the Collisions (but i'm not sure)

Next problem is maybe the sorting in the Detaillevels
Detaillevel0 => Size=120, Polycount=36
Detaillevel1 => Size=80, Polycount=48
#7
11/10/2003 (5:09 am)
John, could you have a single mesh or multiple mesh option? There are some very good reasons to have multiple mesh objects. Hiding limbs or armor for example :)

I tried out a static object and it seems to work great so far. Very nice work.
#8
11/10/2003 (5:43 am)
Missed this one this weekend or I would have tried it out allready.

I will grab it tonight and see what paces I can put it through in the next few days.

At any rate, wonderful contribution to the community John... MANY developers here will benefit from this.

Thanks for your hard work. =)
#9
11/10/2003 (8:06 am)
Sven,
Thanks for the info... what tool are you using to show all that information?

As far as I could tell digging through the code, (remember this is for the milkshape exporter) the collision mesh has always used a detail level. The sizes are supposed to be sorted that way (mesh with most detail should be biggest on-screen). (edit) Oh, I see... more polys are in the second detail level (where there should be less). I'll have to look into that.

If you could explain why these are problems, I am certainly open to listen. And I would definitely like to know how you got all that info... it will help when I get everything implemented to make sure things are working properly.
#10
11/10/2003 (8:09 am)
Sabrecyd,

Yes I will add the option... but don't get mad at me when you see how long it takes to actually make the meshes for the detail levels :) I suppose you only have to do it once for each model. And it makes the game run faster. So it's worth it.

I worked it through in my head, though, and allowing for this is something that will take less than an hour to implement... much simpler than I initially thought. So it's definitely going in.
#11
11/10/2003 (9:04 am)
Very cool! This will be very useful.

Don't worry, I don't get mad easily ;)
#12
11/10/2003 (11:51 am)
John,
i write this tool for my own to examine the dts files, because now one can tell you what you have to set anywhere. As an example the IFL Material, i have added IFLmaterial to the Milkshape exporter.
- The exporter recognize the material.ifl (with error message but it works)
- i set all datas to the IFLmaterial group
- i set the flags in the material
- i create a animation sequence,
but in all this stuff i missed a little thing and the only thing what you here is you can look at the source code thats the only documentation.
So that was the reason i wrote this tool, but i stuck in the mesh data at the enormals.

Oki the sort thing you see already and the other thing with the objects. Forget it i doublechecked it and its correct.
#13
11/10/2003 (12:21 pm)
Oki forget the sorting problem ;-)

Not the exporter is the problem the Model is the problem, hehe.

your Lod0 has 36 Polygons and Lod1 has 48 Polygons.
So the exporter sorts the details in right order, only in your model the second group has more polygone than the first ;-)

So, no more problems and no error => it works fine
#14
11/10/2003 (12:21 pm)
Sven,

Do you plan on submitting the IFL additions to add into the HEAD, or as a resource? This would be very beneficial to the community as well. The DTS statistics tool would also be very useful. Did you make the DTS tool a command-line tool, or what?
#15
11/10/2003 (12:57 pm)
[Edit] Double posting [/edit]
#16
11/10/2003 (1:21 pm)
John,

if i get the IFL work, i will submit it.
The tool is a windows application, written in Powerbuilder 7.0.
#17
11/10/2003 (1:22 pm)
[edit] Double posting [/edit]
#18
11/14/2003 (1:15 am)
Triple post?

Very good news indeed. i was going to take it upon myself to try as an exercise, but i dont think i have the skill for it.

Now to learn python and try and get that exporter to do animations and LOD for blender....
#19
11/14/2003 (8:28 am)
@Luke: When you start working on LOD, don't be afraid to ask how they're done... I now understand that aspect of the DTS format. It took a little while, since there's no documentation, but it's really simple in the end.

Everyone else:
I've got another version just about ready... this one supports multiple meshes and custom pixel sizes for each detail level. And the order of meshes in the Milkshape window doesn't matter (automatically sorts them). I should get it out there this weekend.
#20
11/14/2003 (11:11 am)
All work on a milkshape exporter for DTS is good news, for one thing, its possible to get almost any mesh format into milkshape, so a fully functional milkshape 2 DTS, (as this is heading) makes it possible for modelers using various modeling programs they prefer, and then pass it through milkshape at a reasonable price ie $20 for milkshape, not to mention being able to use lithunwrap for texturing.
Point being that almost all 3d modeling programs will export to 3ds, even Rhino 3d which is a nurbs modeler can export to 3ds, and Milkshape can import 3ds as users will know.
Even if the process needs a little manipulation and proves to be slightly unfreindly, what does it matter.
It can only add to the amount of Artists able to produce fully funcional DTS models for your games.
Damn good work John keep it up.
Page «Previous 1 2