Jump to content

Blender .Mu import and removing double vertices = weird artifacts


Recommended Posts

Hi

I am messing around in Blender getting the hang of it and I imported some models to customize them a bit for my purposes.

But every model I imported has double vertices which is a pain to work with obviously. So I deleted all doubled ones using [A] to select all vertices and then selected the remove double function in the [w] menu.

And then the model turned to ... the smoothing looks weird

before

zEs2i5R.png

after

u2HhpDq.png

Here some other screenshots of this ingame.

Does anybody know what this is and how I can get rid of it?

Javascript is disabled. View full album
Edited by VentZer0
Link to comment
Share on other sites

Try turning off "Smooth Shading". In the first picture, left hand side, middle screen, there's two buttons, "Smooth" and "Flat". With the cockpit selected click "Flat". That's the first step, try it and see what you get. (I don't know for sure but I have a hunch, and if it works I know how to make it smooth in-game)

Link to comment
Share on other sites

I already tried doing this and thought it might make a difference, but it doesn't. Smooth or flat shading in Blender does not affect how the model looks in KSP

That's in unity, yes. But does it fix the problem with the weird shading in Blender? (This seems to be the issue.)

If your artifacts are in-game, what you're going to want to do is switch the imported shaders in Unity to calculated ones. When you add in a model in Unity, click the model in the assets bar, go to the inspector tab, (or one of the tabs on the same bar), and click through until you find the "Normals and Tangents" bit, and set it to these values:

9E4oy0E.png

Link to comment
Share on other sites

Yes the flat shading looks ok just flat and coarse, which is to be expected.

Hmm I haven't done that with unity yet, I just used the import export function of that blender script. Will try and report.

- - - Updated - - -

Ok I have it in Unity and it has its texture and stuff, it renders fine without any weird artifacts, but how do I export it into a .mu from within unity?

Link to comment
Share on other sites

Yes the flat shading looks ok just flat and coarse, which is to be expected.

Hmm I haven't done that with unity yet, I just used the import export function of that blender script. Will try and report.

- - - Updated - - -

Ok I have it in Unity and it has its texture and stuff, it renders fine without any weird artifacts, but how do I export it into a .mu from within unity?

You're going to need KSP PartTools, the dev's custom part exporter.

http://forum.kerbalspaceprogram.com/threads/65356-0-23-PartTools

The version number seems out of date but it's still fine AFAIK.

Extract the .zip, then place the PartTools folder inside of your Unity project's Assets folder. That should begin the import process. After that, you're going to want to select your GameData directory (I believe the plugin automatically creates a window). Now it's time to select your model, and add a few things. The first is a collider if your model does not have one by default. Go to the Inspector tab with the model in the editor window (the 3d one) selected, and click "Add Component" at the bottom. Click Physics -> Mesh Collider, and in the new menu select "Convex".

Then go to KSP -> Part Tools and change your export directory, and model name to something recognizable. Export it, and then put it in the folder of the original part. (You might just export to the folder.) Go into the .cfg and change the Model line from "model.mu" to whatever you changed the exported model's name to.

Link to comment
Share on other sites

I have part tools installed already because I was also doing IVAs ... but I dont see ANY export option aynwhere, all I can do is export as a .unitypackage

Whoops, sorry, that might be confusing. On the Part Tools menu (the script component) there's a button that says "Write". Click it.

Link to comment
Share on other sites

At the top level of your GameObject for the part, you need to have the Part Tools component added there. Just installing it alone isn't enough. If the GameObject doesn't have it, you can click "Add Component", then select KSP->Part Tools.

Once added, you should see the field to pick a filename for the .MU, select a format for textures, and hit "Write".

Link to comment
Share on other sites

At the top level of your GameObject for the part, you need to have the Part Tools component added there. Just installing it alone isn't enough. If the GameObject doesn't have it, you can click "Add Component", then select KSP->Part Tools.

Once added, you should see the field to pick a filename for the .MU, select a format for textures, and hit "Write".

Yeah, this. This is what I was trying to say but looking back it wasn't what I said.

Link to comment
Share on other sites

Ok I got it to work now, BUT the cockpit is upside down ingame, its weird ... I tried rotating it by 180° in unity and saved it again, nothing... still upside down... dafuq?

Javascript is disabled. View full album

meh fixed it, gameobject and the mesh itself where rotated 180°

Edited by VentZer0
Link to comment
Share on other sites

Ok, so for the first picture you originally posted, the reason you get those smoothing artifacts after removing the double verts is because I used the edge split modifier in Blender to make sharp edges. Once you merged those verts the smoothing took effect on the whole model.

Edit: so if you want to modify a mesh, then you would merge the verts. But you would have to re-apply the splits in order to get sarp edges once again.

Edited by martinezfg11
Link to comment
Share on other sites

I believe the part's "zero" orientation is defined in your Blender model, not in Unity.

If you flip the part 180 degrees in the Unity editor, you are only flipping it in "world coordinates" just like you would by rotating it in the SPH. It's still upside down relative to its local coordinate system.

You can fix that by flipping the part in Blender and re-exporting it.

I am not sure how Unity handles split verts to make sharp edges. I've had a few exports to and from Sketchup which looked good (and with sharp edges) in Blender but had the normals pointing the wrong way when imported into Unity.

The correct way to make sharp edges is to mark them as sharp in Blender, or mark the associated faces as 'flat'. Switching to a different shader isn't going to be of much use.

Link to comment
Share on other sites

I'm pretty sure you had applied an Edge Split modifier before. That modifier doubles the edges that are supposed to be sharp to make them appear like that. When you removed doubles, you removed those edges, and your model started looking wrong.

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

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...