Jump to content

Broken Lighting on Milkshape Model When Exported as DTS


DShiznit

Recommended Posts

Cross-posted from https://www.garagegames.com/community/forums/viewthread/143635


A friend and I are working on a project in T3D (3.10) for which I've attempted to produce a player model. However, I am unable to get the model to light properly in T3D when I export it as a dts. The model looks great in Milkshape, and looks fantastic exported as a .dae, but the lighting breaks when I export as a dts.


screenshot_003-00000.png


The model on the left was simply exported as a dts using the latest dts plus exporter. The model in the middle was one of my experiments, where I exported first as a Half-Life SMD, which I imported back into Milkshape, then immediately exported using the dts plus exporter. The one on the right was exported as a Collada .dae. The problem with the SMD trick is that it combines all of my materials that use the same texture (as well as their meshes). This is a problem because at some point I need to be able to color the individual parts of this model which, from what I understand, can only be done per material. I tried exporting the SMD with every material set to a different texture (thus preserving my meshes and materials), then restoring the original texture assignments before exporting as a dts, but that results in the same broken lighting seen on the left. The problem with exporting as a .dae is that I lose my skeleton, which is pretty important for a player model.


I spent a week creating this model and the last 6 hours trying to get it to light correctly in T3D. If anyone has any idea what I'm doing wrong, or what can be done to fix this model, I'd appreciate it.


This is the ms3d, as well as the exported dts's and .dae.

https://www.dropbox.com/s/rtp8cnf33gajz0m/minifigProblem.zip?dl=0

Link to comment
Share on other sites

Some of the normals on your model are wrong, some faces on the models front and back face inwards, which leads to wrong shading. Another problem is that the shading groups are a bit wrong here and there, which also leads to weird lighting results. There are also some unnecessary edges left on the model that are not connected to a face, which I don't know what it will do.

Regarding the materials you should merge the model into one shape and add one material for it, it is much simpler and much more efficient. You have to consider that you have to rig and animate the model at some place in the future as well in case you want it to be a player character.

On top of all that, the exporter you use may have issues, but I would make sure you correct the model before you consider that.

Link to comment
Share on other sites

Can you tell me how I can fix the normals and shading groups in Milkshape? I tried googling but the results weren't all that helpful. All I got was "assign smooth parts to one shading group, and flat parts to another". Do I do this for each piece of the model? The only part with inside-faces is the torso, and that appears to light correctly, though I can scale them so they aren't right up against the outer faces if that'll help. They're only there so that other players can see something inside if they cut off someone's arm. I also cannot find any extraneous edges (the clean tool removes 0 triangles and when I highlight everything with face selection and move it, no vertices are left behind).


For my application, merging the materials and shape isn't really an option. As I said earlier, I need to be able to color the individual pieces of this model for customization, and the code resource for that works on a per-material basis. I also want to be able to hide individual pieces for gibbing and attaching other pieces (hook, peg leg, short legs, skeleton arm, etc.)


The model is already rigged and I've done animations before, so that won't be a problem. One of the options I was considering was to export just the skeleton as a dts, and each individual piece as a separate collada mesh, then merge them with T3D's shape editor.


EDIT- I unwelded everything and let it auto-smooth, to create a flat shaded model with no smoothing whatsoever, but the lighting is still broken:

screenshot_004-00000.png


This is what the normals look like. I'm actually not sure what I'm supposed to be looking at but I'm hoping someone here can tell something from this

screenshot_004-00001.png


Is it possible the shape is just too detailed? Or has too many meshes for the exporter? I'm gonna try something.


EDIT2- Bingo. Regrouping and reducing the number of materials fixed the problem:

screenshot_005-00001.png


I'm gonna do some experimenting and see exactly how many groups/materials I can get away with. I can attach the head and hands pretty easily as mounted objects.


EDIT3- Ok, this is really weird. Everything works fine if I group the hands, legs, and arms, together in their own respective groups. But it breaks if they're present as separate groups, or even by themselves. It literally only lights correctly if the legs, hands, and arms, are each a single group with both parts (when I removed just the left hand, arm, and leg, I got the broken lighting). It must be an issue with the exporter, but I don't understand why it lights correctly when both legs/arms/hands are present as a single group, but incorrectly when they're separate, or when there's just one of each. At this point I'm considering exporting just the chest, hip, and head meshes and attaching everything else as mounted objects, but I fear that will be terrible for performance. Does anybody have any other ideas?

Link to comment
Share on other sites

Not extra vertices but extra edges, no idea how you managed to create those.

You can have as many objects and materials as you want, but it does not make sense if you do not need them.

You have several options, you can switch body parts and reskin each object. So it depends what you need, but I would just create a different model for each body part and use on atlas texture for them all. Or as a little hack if you only need plain colors and no texture you can even get away with no textures and just using vertex paint.

I don't use milkshape so I cannot help you with that, I just noticed several potential issues with your model and it seems you found the one that caused the problem.

Link to comment
Share on other sites

Can you tell me where the extra edges are? I'm not seeing any in Milkshape, which tells me the exporter is adding them (I'm assuming you're looking at the dts itself and not the ms3d). I still don't understand why it works with the legs/arms/hands as unified groups but not separately (or even alone).


https://www.dropbox.com/s/l72gkysvyghhvxp/minifigProblem2.zip?dl=0


This includes the original ms3d to which I've made a minor change (scaling the inside) as well as one where I've regrouped the hands, arms, and legs. The exported .dts is from the latter file, and is the one pictured above that lights correctly.

Link to comment
Share on other sites

I always export collada, place it in the editor, then it automatically converts it and when I'm done with the model for the release I delete the .dae file and rename the .dts file by removing the ".cached" from the name.

It is a bit more complicated, but I never had issues that way.

Link to comment
Share on other sites

I would do precisely that, except as I said, the collada exporter ignores the skeleton. Instead it attaches a node to each group, which when removed, changes the orientation of the mesh. I might port to blender and try my luck with it's exporters.

Link to comment
Share on other sites

I tried importing into Blender, but it's .ms3d importer failed to import the skeleton. The Source SMD importer worked fine, but I'll need to figure out how to rename my meshes and materials before I can export that model.


I completely redid all of the shading on the model, by separating and regrouping every single continuous surface and resmoothing. Even with them all as separate groups, the exported model still had broken shading, I can only conclude at this point that Milkshape's dts plus exporter (as well as the old exporter, which I also tried with the same result) is broken and cannot export my geometry.


I'll try working with the Blender model imported from SMD, as at this point that's my only option.


Here is the current ms3d, dts, and the dump file from when the dts compiled, in case anyone is familiar enough with the exporter to make use of it: https://www.dropbox.com/s/5w0g7qslctphzty/minifigProblem3.zip?dl=0

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...