Milkshape and Models

Search and find cool skins and models, or introduce your own ones!
1337GameDev
Skilled
Posts: 198
Joined: Thu Apr 16, 2020 3:23 pm
Personal rank: GameDev

Milkshape and Models

Post by 1337GameDev »

Not sure if this is the correct place, there's no category for "Model/Texturing questions." Please move if if incorrect.

I currently have a model I have sourced, and it appears correct in Milkshape3d, with the texture. I export it, and look at the .uc file generated for the texture map/origin/scale and have that in my custom mod.

It imports fine, but in game / in the mesh browser, it appears, but certain triangles are transparent, as if normals are wrong, but they seem to be correct in milkshape. is there anything I have to do, to export the model correctly?

I tried the plugin for Milkshape that gives me the "Vertex -> Align Normals" option, and it doesn't help at all.

Ideas? Any way to see the normals in milkshape / correct them (if that's the issue). In the mesh browser / in game, when the object rotates, I do NOT see the backfaces of the invisible triangles, so it doesn't seem to be a normals issue....

:noidea
User avatar
EvilGrins
Godlike
Posts: 9739
Joined: Thu Jun 30, 2011 8:12 pm
Personal rank: God of Fudge
Location: Palo Alto, CA
Contact:

Re: Milkshape and Models

Post by EvilGrins »

Screenshots might help us see what you're seeing.
http://unreal-games.livejournal.com/
Image
medor wrote:Replace Skaarj with EvilGrins :mrgreen:
Smilies · viewtopic.php?f=8&t=13758
1337GameDev
Skilled
Posts: 198
Joined: Thu Apr 16, 2020 3:23 pm
Personal rank: GameDev

Re: Milkshape and Models

Post by 1337GameDev »

Screen Shot 2021-07-29 at 5.50.39 PM.png
This is what I'm seeing. It has the default engine texture applied, to eliminate the issue from being due to my texture....
User avatar
Feralidragon
Godlike
Posts: 5493
Joined: Wed Feb 27, 2008 6:24 pm
Personal rank: Work In Progress
Location: Liandri

Re: Milkshape and Models

Post by Feralidragon »

If you're exporting as a vertex mesh (_a.3d and _d.3d files), ensure that the whole model is within a 256 unit bounding box in Milkshape.
To clarify, what this means is that none of the vertices of the mesh can be any further than 127 on any of the positive axis (starting from the center) or further than 128 on any of the negative axis (also from the center).

If any vertex is outside of that range, it will overflow and cause all sorts of distortions and issues like the one you're seeing there.
This is a limitation of the format itself btw, not a limitation from Milkshape itself.

Another option that you have is to export as a skeletal mesh instead (.psa and .psk), but you're required to have at least one animation joint, and all vertices are required to be associated to one of such joints at least (you can create 1 joint and associate all vertices to it, and have no animation).

Skeletal meshes have none of the limitations of vertex meshes, and vertex meshes have a lot more problems than this, that lead for the model to have some deformations (vertices are snapped to the nearest 0.125 in X and Y, and 0.25 in the Z axis, because the Z axis has half of the precision and scale, hence why all models are imported with the Z scale being the double of X and Y) and the UVs to not be perfectly aligned if the texture size is over 256x256 (even at 256x256 they may be 1 pixel off, but in most cases is not noticeable), and the list of issues goes on.

The only upsides of using vertex meshes are to have meshes with a different animation per vertex and to be able to customize some poly flags post-export with UnrealFX (like setting polys as translucent, environment mapped, masked, double-sided, etc).
1337GameDev
Skilled
Posts: 198
Joined: Thu Apr 16, 2020 3:23 pm
Personal rank: GameDev

Re: Milkshape and Models

Post by 1337GameDev »

Hmm, not sure how I tell if the model is within 256 bounding box from the origin in Milkshape.... Is there a way to make a cube to a specific size? I know I could set the grid size and then snap to grid....?

I exported my model as a PSK (I omitted the PSA, as I don't have animations), and use this to import:

Code: Select all

#exec MESH MODELIMPORT MESH=Item1 MODELFILE=Models\Item1.PSK LODSTYLE=0
#exec MESH ORIGIN MESH=Item1 X=0 Y=0 Z=0
#exec TEXTURE IMPORT NAME=SKIN_Item1 FILE=Textures\Item1.bmp GROUP="Skins" FLAGS=2
#exec MESHMAP SCALE MESHMAP=Item1 X=0.04 Y=0.04 Z=0.08
#exec MESHMAP SETTEXTURE MESHMAP=Item1 NUM=1 TEXTURE=SKIN_Item1
And it imports, but doesn't have my texture applied in the UEd Mesh Browser, but does in Milkshape... Not sure what is going on....

Assuming milkshape's x/y coordinates are accurate, then my model is 40x50x60....

Looking at the model imported via the .3d format, in the UEd Mesh Browser, and when i zoom in far, the holes disappear.... Is it an LOD issue? I'm not sure..... :( I have no idea what's going on.
User avatar
Feralidragon
Godlike
Posts: 5493
Joined: Wed Feb 27, 2008 6:24 pm
Personal rank: Work In Progress
Location: Liandri

Re: Milkshape and Models

Post by Feralidragon »

I never used PSK myself (by the time I realized how great they were and how they worked, it was already too late for me lol), but they work a bit differently from the other older type of meshes, so your texture may not be applied maybe because the skins may start at 0 rather than 1, so you could try to import with NUM=0 instead.

As for the actual coordinates and grid size, it's direct: 1 unit in Milkshape is equal to 1uu in Unreal Engine.
So if you zoom in within Milkshape, and get at the point where you cannot zoom in any further, the grid you see is the unit grid, so you can tell from here how large your mesh is.

As for the zooming itself in the Unreal Editor, yes, by default imported meshes have a LOD setting such that the mesh will morph pretty quickly the moment your camera is moved away from it.
You can adjust this in 2 ways:
  • you can set the base LOD during import with #exec MESH LODPARAMS MESH=<your mesh> STRENGTH=<LOD level here, between 0.0 and 1.0>, where 1.0 is the default value it imports the mesh with, and 0.0 is for the mesh to never morph in relation to LOD;
  • you can also set the LODBias property in the actor class your mesh is in, increasing up to a point where you're satistied (it works in the opposite direction of STRENGTH above, but I don't know the practical upper limit, although I have used 8.0 as the "no morphing value", although the real limit may be lower).
1337GameDev
Skilled
Posts: 198
Joined: Thu Apr 16, 2020 3:23 pm
Personal rank: GameDev

Re: Milkshape and Models

Post by 1337GameDev »

Hmm, I tried reimporting with the texture as NUM=0, and now it applies, but has holes... wtf.

Changing to 1 again makes it have holes too.

I even tried with

Code: Select all

LODSTYLE=12 
at the end of the normal import statement....no difference.
Tried this too.....

Code: Select all

#exec MESH LODPARAMS MESH=Skull STRENGTH=1.0
I also set LODBias=8.0 in the default properties block... to no avail....
Screen Shot 2021-08-03 at 12.01.15 AM.png
Screen Shot 2021-08-03 at 12.01.15 AM.png (18.04 KiB) Viewed 1881 times
Here is the model info from milkshape for my model... This is after I ran a process of "smoothing" as a test. I included a test of before smoothing, with the same results.
This was the original stats....
Screen Shot 2021-08-03 at 12.05.17 AM.png
Screen Shot 2021-08-03 at 12.05.17 AM.png (18.23 KiB) Viewed 1881 times
I've tried reexporting as .3d but no luck...

I don't get what's going in....This should be very simple....
User avatar
Feralidragon
Godlike
Posts: 5493
Joined: Wed Feb 27, 2008 6:24 pm
Personal rank: Work In Progress
Location: Liandri

Re: Milkshape and Models

Post by Feralidragon »

Like I mentioned in my post, STRENGTH works on the opposite direction of LODBias, meaning for the directive to fix your issue you need to set it up like this instead:

Code: Select all

#exec MESH LODPARAMS MESH=Skull STRENGTH=0.0
with a STRENGTH of 0.0, which disables LOD morphing completely.
1337GameDev
Skilled
Posts: 198
Joined: Thu Apr 16, 2020 3:23 pm
Personal rank: GameDev

Re: Milkshape and Models

Post by 1337GameDev »

Feralidragon wrote: Tue Aug 03, 2021 10:39 am Like I mentioned in my post, STRENGTH works on the opposite direction of LODBias, meaning for the directive to fix your issue you need to set it up like this instead:

Code: Select all

#exec MESH LODPARAMS MESH=Skull STRENGTH=0.0
with a STRENGTH of 0.0, which disables LOD morphing completely.
I tried that and the mesh seems intact now, but parts of the mapped texture are green? (when it's only brown / black / red)

I'm getting really frustrated.... :???: :omfg:
User avatar
Feralidragon
Godlike
Posts: 5493
Joined: Wed Feb 27, 2008 6:24 pm
Personal rank: Work In Progress
Location: Liandri

Re: Milkshape and Models

Post by Feralidragon »

That means those parts are untextured (the "green" is from the default actor texture), likely because they belong to a different multiskin index.
To confirm this, open the actor in the editor, and assign your texture to each one of the Multiskins, the moment you assign the texture to the right Multiskin those areas will become correctly textured.

Having that said, it seems that you only have 1 texture to apply to the whole mesh, right?
That being the case, it likely means that you have have different materials assigned to the model on Milkshape's side, like 1 material for some polys of the model, and another for other polys, which when exported are interpreted as different multiskins for those areas of the mesh.

If that's the case, you need to make sure that the entire model only uses 1 material in Milkshape.
It's been years since I last opened Milkshape, so I don't remember how exactly they are assigned, or even if they are also called "material" there, but this is what you should look into now.
1337GameDev wrote: Wed Aug 04, 2021 5:30 am I'm getting really frustrated.... :???: :omfg:
Don't be. :)
Look at the progress you made thus far: you went from a mesh that was completely destroyed on import, to just having to deal with a small texturing issue now, you already solved the hardest issues, so just 1 more fix and you will be good to go. :tu:
1337GameDev
Skilled
Posts: 198
Joined: Thu Apr 16, 2020 3:23 pm
Personal rank: GameDev

Re: Milkshape and Models

Post by 1337GameDev »

Feralidragon wrote: Wed Aug 04, 2021 1:05 pm That means those parts are untextured (the "green" is from the default actor texture), likely because they belong to a different multiskin index.
To confirm this, open the actor in the editor, and assign your texture to each one of the Multiskins, the moment you assign the texture to the right Multiskin those areas will become correctly textured.

Having that said, it seems that you only have 1 texture to apply to the whole mesh, right?
That being the case, it likely means that you have have different materials assigned to the model on Milkshape's side, like 1 material for some polys of the model, and another for other polys, which when exported are interpreted as different multiskins for those areas of the mesh.

If that's the case, you need to make sure that the entire model only uses 1 material in Milkshape.
It's been years since I last opened Milkshape, so I don't remember how exactly they are assigned, or even if they are also called "material" there, but this is what you should look into now.
1337GameDev wrote: Wed Aug 04, 2021 5:30 am I'm getting really frustrated.... :???: :omfg:
Don't be. :)
Look at the progress you made thus far: you went from a mesh that was completely destroyed on import, to just having to deal with a small texturing issue now, you already solved the hardest issues, so just 1 more fix and you will be good to go. :tu:
Hmm, in milkshape, I only have ONE material, and assigned it to the entire model.... it's a skin.

Hmm, the model had green in the mesh browser too... and I can't set multiskins there....

Maybe it's "unmapped" areas of the model, if it scales wrong, and the texture doesn't cover the entire model?

I did eventually get it to work, by using the 3d format, and a scale of xyz of 0.4,0.4,0.8 and

Code: Select all

#exec MESH LODPARAMS MESH=Skull STRENGTH=0.0
I still am bothered that i can't get psk to work, as it's not limited to 256 unit bounding box.... :/
User avatar
Feralidragon
Godlike
Posts: 5493
Joined: Wed Feb 27, 2008 6:24 pm
Personal rank: Work In Progress
Location: Liandri

Re: Milkshape and Models

Post by Feralidragon »

Well, you likely have more than 1 "something" there (like smoothing groups, maybe, or something else), which is causing the mesh to be exported with more than 1 texture mapping applied.

Also, Multiskins are not set in the mesh browser, they are set in the actor using that mesh: you can open an actor's properties, and go to Display > Multiskins, and you can test it out that way.
1337GameDev
Skilled
Posts: 198
Joined: Thu Apr 16, 2020 3:23 pm
Personal rank: GameDev

Re: Milkshape and Models

Post by 1337GameDev »

I only have one group of vertices, faces and polygons in milkshape... And only one material.

It looks correct in milkshape.

And yeah, I figured multiskins was about actors, as it's a property of the base actor class.

Idk what to do to figure out what it's doing for the psk version as I want to use that in the future.

Also, do you know how a render texture is set for a model? (I'll need that for a later weapon in making)
User avatar
sektor2111
Godlike
Posts: 6412
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Milkshape and Models

Post by sektor2111 »

I have a question: If in initial image it reads 1416 triangles and over 700 vertices, will this ever work in UE1 ? To me this is a very complex thing and I don't think it's supported properly.
User avatar
Feralidragon
Godlike
Posts: 5493
Joined: Wed Feb 27, 2008 6:24 pm
Personal rank: Work In Progress
Location: Liandri

Re: Milkshape and Models

Post by Feralidragon »

Although we went over this in Discord, adding here a quick summary:
  • First, you create a ScriptedTexture in the Unreal Editor itself (whenever you want any kind of dynamic/fractal texture, you need to create it in the editor);
  • Save the texture into a new texture package;
  • Save the texture package in your mod package source directory (like you do with code, textures, meshes, and other resources you will import and compile), preferrably in a "Textures" folder (by convention);
  • In the import exec directives, add an exec directive to import and merge this texture package into your final package, like so: #exec OBJ LOAD FILE=Textures\YourTexturePackage.utx PACKAGE=YourModPackage
The moment the texture package is imported and merged into your own, you can use and reference any textures from there in any way you like.
The same goes for any type of package you may have to create in the editor, not just textures, although textures are pretty much the only type of package you would almost ever need to create separately in the editor first.
sektor2111 wrote: Fri Aug 06, 2021 6:13 am I have a question: If in initial image it reads 1416 triangles and over 700 vertices, will this ever work in UE1 ? To me this is a very complex thing and I don't think it's supported properly.
Yeah, it works just fine.
In NW3 I have models with maybe double of those polys, if my memory doesn't fail me.

But if you have many of them in view, depending on your hardware you may start noticing a frame drop at around just 10-20 models like those, so what I do in my case is to manipulate the weapons LODBias in real-time depending on your framerate.
So if your framerate starts to drop, the mod will automatically adjust the LODBias to lower values so the framerate increases again.

But this causes the sort of visual "glitch" the OP was talking about, especially at short distances if the framerate impact is too great for any reason.

All of this in 436, that is, because starting at 469 meshes are rendered in a fairly different way: up until 451 renderers were forced to render polys 1 at a time, but in 469 renderers can (and do) batch-render multiple sets of polys at once, which speeds up the rendering significantly, to the point stuff like this is now possible to have without framerate drops, even in relatively old computers (old = 5-6 years old):



So in 469 something like 1500 polys is even less of a problem.
And the dev team is still trying to improve and further modernize the renderers so we get greater speed ups.

Having said that, however, it's indeed a good idea to always optimize the model to have only the polys it actually needs.
It's very easy to fall into the fallacy of adding more polys for a mesh to look better or smoother, which in most cases more polys, especially in a game like this, do not actually make the mesh look much better, given the way meshes are lit up, how they render the textures (no material support), among other things.
Post Reply