Jump to content

Somewhere to put any knowledge learned about using the .mu plugin.


Recommended Posts

Thank you. Once again, great information. I have been already adjusting for duplicate vertices without realising it was being caused the plugin. I was thinking it was just a normal thing. I came across doing it when I would go to apply a face and it wouldn't take, I found that if I used merge at the vertices points first that then it would work. This explains alot. Also why models that were fine  on one export would claim to have over 65,000 vertices on the next. I had been getting around it by cutting the models into pieces. I can see going back and re-exporting  my models after using the merge function in my near future.

One caviat I would add for the Mesh-→Merge-→By Distance. Is make sure to go into the pop up that will appear to be sure thedistance tis 0.0001 at maximum if not lower or else you might find some parts of the mesh you didn't want merged ending up merged.

So much great information I am now going to have to shoe horn into my brain. :)

@Stone Blue

 

 

Edited by ColdJ
Link to comment
Share on other sites

@Stone Blue

Well I have bad news and good news.

Bad news is that when I tried to save it as a .blend it refused to save it afterwards to a .mu and I lost a hours work and had to start again. This is the message that came up.

fHXspgP.png

From then on I started having glitches I don't usually get including standard box colliders not wanting to stay where they were put. I may have to clear settings cache in Users\Appdata\Roaming to have a fresh start. The plugin definitely has a glitch when it comes to vertices numbers because now that I found the setting that tells me the actual vertices of the mesh I have seen parts that only have 11,000 vertices being accused of having over 65,000 and only cutting the part up into separate smaller pieces seems to mollify it.

The good news is that the merge trick works and now as soon as I import I shift highlight all the parts and use that to remove the un-needed vertices.

I have used it to remove over 250,000 vertices in one case.

Before.

B0yGhoL.png

After.

ANxZZrv.png

And after much battleing with the Kraken.

GGlvviJ.pngDGTZfDs.png

 

Edited by ColdJ
Link to comment
Share on other sites

On 2/25/2022 at 3:15 AM, Stone Blue said:

Not necessary to add lights or anything, for easy visualisation/labeling, to figure out proper axis-rotations, for odd-ball things KSP does, like thrust direction, RCS FX direction, the weird 90°/180° offset for IVAs, etc.
The method/settings i describe below, are just display settings, therefor, unlikke adding light-objects, or other, to your hierarchy, NOTHING extra gets exported/affects your .Mu, cluttering up your hierarchy while you work, or if you forget to remove before export

Is there a way to get the change to stick?

I have been using that in single arrow on thrust transforms to see which way they are pointing but when you import the model later it has reverted to plain axis. I was previously having a problem where thrust transforms for engines would rotate 90 degrees every time you exported and it was hard to tell which way they had gone. That was why I was putting cameras in the heirachy so I could see which way it had turned.

Link to comment
Share on other sites

5 hours ago, ColdJ said:

Is there a way to get the change to stick?

I was able to reproduce a thrust transform, rotating 90° along one axis, *every* time I re-imported the .mu. As well as the transform display setting defaulting backk to Plain Axes.

I'm not positive, but it might be, that when you export the .mu, the plugin "translates" Blender left-hand orientation, to Unity right-hand. (The X-axis being to left, vs right)
It *might* do this same translation, upon *import*, changing Unity rotation back to Blender rotation... ??
Which might mean its cumulatively doing it every time you export/re-import the .mu... ?? I dont know.

As far as the transform display setting, I'm sure thats not a field in the .mu file format, its a Blender display setting, so it doesnt get saved in the .mu file. There *might* be a default setting for it in the Blender Preferences, that you could change, for it to default to whenever you open a new .blend... ??

I dont know... But you *can* get around *both* of these issues, again, by *never* re-importing your exported .mu, and just keep working in the .blend file.

Link to comment
Share on other sites

Apply scale under MU Hierachy works for model meshes and bashed colliders but not on anything wire frame.

Found this out while going through and removing vertices from the YnoT1300 mod. Box colliders, like airlocks and ladders, or axis like thrust transforms etc don't have the scale applied but rather get changed back to a scale of 1. Even if you don't highlight them before applying scale, if they are within the heirachy of a model mesh they will get affected. So if you do Apply Scale to your mesh so that it's current dimensions are considered a scale of 1, you will have to go and re-adjust any wireframe objects that are under it.

This is fixed in the newer .mu plugin used with Blender 3 onwards.

Edited by ColdJ
Link to comment
Share on other sites

Shader set up for a mirror texture.

Start with standard KSP background colours. Easiest thing is to import  a stock foil tank and use it's material to build off. Set your main texture to a light grey pic and your specmap to a slightly darker grey pic. The bump map is the standard light lavender, probably not even needed but I couldn't be bothered removing it. And then set it up with the following. Remember you have to give it a new name over in MU Shader, which is within Materials, if you want your changes to stick.

GKqkDNF.jpg

Edited by ColdJ
Link to comment
Share on other sites

  • 2 weeks later...

Multiple animations in 1 model.

Not strictly about the .mu plugin but relevant if you use it to make animated parts. I am currently building an X-wing and the engines and S foils are a combined part separate from the body. It technically contains 2 animations that run off 2 different types of animation module. One is a colour animation so that the engines glow brighter with the throttle and the other controls the S foils opening and closing. Now without having the "Layer =" paramater in the modules, the S foils would snap shut and snap open and wouldn't work to plan. Turns out the colour animation was interfering with their operation. Once you add in the Layer equals paramater and assign different numbers to each, it goes back to working correctly. It doesn't seem to matter if the number actually relates to a layer in blender, only that the animations in the config have different layer numbers. Here is an example of a working set up. (This is using Linuxgurugamers module that allows your generic animations to have sound.)

    MODULE
    {
        name = FXModuleAnimateThrottle
        animationName = colorAnimation
        dependOnEngineState = True
        responseSpeed = 0.5
        engineName = Ion
        dependOnThrottle = True
        layer = 2
    }

 

    MODULE
    {
        name = ModuleAnimateGenericEffects
        animationName = X-WingFoil
        startEventGUIName = Peace
        endEventGUIName = Fight
        actionGUIName = Toggle S Foils
        deployEffectName = deploy

        postDeployEffectName = deployed
 
        postDeployEffectLength = 5.0
        retractEffectName = retract

        postRetractEffectName = retracted
 
        postRetractEffectLength = 5.0

        animSpeed = 1

        layer = 0    
    }

Edited by ColdJ
Link to comment
Share on other sites

@Waifu Art Thou Romeo

Hi. How is your 3d modeling going?

I now know how to create animations from scratch and I have successfully created a retractable wheel for an R2D2 clone by observing how a Squad retractable landing gear was set out in Blender. I am still using the export, then re-import before changing anything method for dealing with anything dragged in from other models. Have you read the info from Stone Blue that the plugin multiplies the vertices on every import?

I have to select all the actual model parts, go into edit mode and use "Merge by distance" to clear all the extras it adds.

Link to comment
Share on other sites

@ColdJ now that you are getting into animations, if you are making *new* animations, make *sure* you are setting your loc/pos/rot coords to Quaternions, when inserting your key frames.
Not a problem i guess, if you already model using quats... but if like me, you model using Euler, switch to quats before inserting keyframes.
I think thats covered in one of the pages in the Wiki on the repo.

Edited by Stone Blue
Link to comment
Share on other sites

Just now, Stone Blue said:

@ColdJ now that you are getting into animations, if you are making *new* animations, make *sure* you are setting your loc/pos/rot coords to Quaternions, when inserting your key frames.
Not a problem i guess, if you already model using quats... but if like me, you model using Euler, switch to quats before inserting keyframes.
I think thats covered in one of the pages in the Wiki on the repo.

Hi there. Thankfully for me it was already set to Quaternions when I started, (maybe the doing of the plugin?), so I didn't get any trouble. I did read the info off the github page you gave me links to and took a screen pic so as to easily refer to it. Haven't tried an animation that is designed to constantly rotate yet but have successfully created a number of animations, including retactable landing pads and ladder for an X wing which use both location and rotation and have covers that slide into place once stowed. I can't upload video but I can get some before and after pics.

Link to comment
Share on other sites

On 3/11/2022 at 9:45 PM, ColdJ said:

@Waifu Art Thou Romeo

Hi. How is your 3d modeling going?

I now know how to create animations from scratch and I have successfully created a retractable wheel for an R2D2 clone by observing how a Squad retractable landing gear was set out in Blender. I am still using the export, then re-import before changing anything method for dealing with anything dragged in from other models. Have you read the info from Stone Blue that the plugin multiplies the vertices on every import?

I have to select all the actual model parts, go into edit mode and use "Merge by distance" to clear all the extras it adds.

So THAT'S where all those extra kilobytes were coming from! Noted, thank you.

 

And no, I never found a more effective way than that. I've been taking a long break, but I think I figured out the workflow. Wheels are just so goofy in this game that it's been hard to get myself working on it.

 

Not to mention that I'm no longer convinced the ship I'm interested in even CAN fly, regardless of how good of a computer they put on it. The CoP is just SO FAR ahead of the CoM. I don't think the Skylon design will ever work without hacks.

Edited by Waifu Art Thou Romeo
Link to comment
Share on other sites

13 hours ago, Waifu Art Thou Romeo said:

Not to mention that I'm no longer convinced the ship I'm interested in even CAN fly, regardless of how good of a computer they put on it. The CoP is just SO FAR ahead of the CoM. I don't think the Skylon design will ever work without hacks.

The config file and the drag cubes can be adjusted to compensate. COP can be moved. Look at the stock Squad command pods for examples. They are adjusted so that the bottom of the pod stays facing down when falling to the ground. I don't know how to calculate drag cubes directly but you can either look in the "PartDatabase.cfg" file (found in the main Kerbal Space Program folder) for the drag cube of a part that is shaped as you want, and then copy and paste it's drag cube into your part config, or create a shape in the 3d model program that is what you need, give it a simple config and let it get loaded up, then go and find it's drag cube in the PartDatabase.cfg file and copy it into your models config. Also you can add the module for lift, e.g

    MODULE
    {
        name = ModuleLiftingSurface
        useInternalDragModel = False
        deflectionLiftCoeff = 0.6
        dragAtMaxAoA = 0.1
        dragAtMinAoA = 0.03
    }

So that your part has wing like properties.

Using these methods I have comfortably flying Star Wars models that would act like flying bricks without them.

Remember that the properties you want don't have to match the external look of your model.

Good Luck.

Link to comment
Share on other sites

2 hours ago, ColdJ said:

Be warned that the program converts quad faces to Tris on every import, so you will need to convert tris to quads before each export at the same time you do merge by distance to get rid of the extra vertices.

Mmm.. not *quite*...
Pretty sure it does that on *export*... You're seeing it happening every time you re-import, because it all got converted on the *previous* export.
Its a Unity thing... Unity will automatically convert everything to tris, anyway...
Having faces as tris or quads, is not what duplictaes the verts. It makes no difference having tris or quads after you import into Blender.
The only advantage to converting everything to quads in Blender, is maybe it makes it easier on your eyes, and causes less mis-selection of edges, because there *are* less edges drawn in the 3D view.
Converting tris/quads has NO affect on final model.

The duplicating of the verts on import, IIRC, is Vertex Color being used in the shaders, and to store/write the additional shader data, the plugin duplicates those verts that *do* have the extra data. Its not a failing of the plugin, its a required feature/function, so you get complete & correct import of the KSP shaders... Its a Unity/PartTools thing.

EDIT: Some clarification I have on this from @Katniss218:
"
duplicated verts is a unity thing too
Unity doesn't do flat shading
every piece of flat shading in unity relies on duplicated verts
Unity's meshes don't support multiple normals per vertex... so to get multiple vertex normals, you have to have seperate/duplicate vertices"

These two points are two of several reasons, why you shouldnt re-import the .mu after changes/edits and exporting it.
If you import a .mu only the *first*, initial time, yes, you need to go thru *every* mesh object manually, and delete the dupe verts with Merge.
But that should be the *one & only* time you need to do that.

This whole thing could be avoided, if actual *source* files (.blend/.obj/.fbx) were originally available for all these old mods we are trying to update/fix.
Thats why its a good idea to do repos (ala Github or similar), and host these files, or even the Unity project(s)...
Not many modders have, or even to this day, do that, unfortunately :(

FYI @Waifu Art Thou Romeo @darthgently

Edited by Stone Blue
Link to comment
Share on other sites

32 minutes ago, ColdJ said:

Be warned that the program converts quad faces to Tris on every import, so you will need to convert tris to quads before each export at the same time you do merge by distance to get rid of the extra vertices.

@darthgently Have you read through this thread?

If you want to make models in blender then this can get you started.

I will now, thanks!

Link to comment
Share on other sites

38 minutes ago, ColdJ said:

Well until someone can tell me why it is refusing to export to .mu after saving it as a .blend I am stuck with having to re-import and go through the ritual of merge by distance. Converting to Quads before export was suggested on taniwha's github/wiki that you sent me links for.

Hmm.. I'll take a look at the Wiki again for that.
If its refusing to export, it *should* be giving an error message, with what the issue is... also, IIRC, theres a way to look at the "log", but I cant recall off-hand
 

38 minutes ago, ColdJ said:

I have to constantly re-import when building because the program randomly creates normals facing in rather than out but doesn't make it obvious in the 3D program. Only once loaded up in KSP does it become obvious where normals are backwards and need flipping. I could use Solidify faces set at 0.001 all the time but then I would have double the amount of vertices.

That sounds like some kind of Blender/BFA setting not doing normals the way you want, while you're working... you shouldnt have to mess with the Solidify faces setting.
There is a toggle in Blender/BFA, that will display normals direction, for faces, as well as edges & verts... I usually turn it on, to check over the whole of the model right before i export, to make sure there are no strays.
To find it, (in BFA), Edit Mode... go along the top toolbar in the 3d view...3 icons over from the UV button, the "Show Overlays/Overlays" button... click the dropdown... scroll down past "Shading", till you see "Normals".... only 3 icons there: Verts, Edges, Faces.... click which you want normals to be displayed on (multiple can be selected at same time)... to the right is numeric textbox... that is length of the blue indicator line, you can adjust. Just toggle the normals display on/off, here, when you do/do not want them visible.


You could also try unchecking "Autosmooth", and/or clicking "Clear Custom Split Normals", under "Normals", in the object Properties window... I just *cannot* recall the ramifications of that, so test it on something you dont mind losing.

EDIT: Oh... also, if after making sure all your *face* normals are properly facing, and you *still* see weird coloration/shadows/z-fighting on certain faces in-game, it might be good to go back and check your *vertex* normals. Use the method above to display the vertex normals. If you see some pointing differently from others, *on the same face*, you may need to redefine/fix those verts.
Pretty sure, when you do the Merge on the dupe verts, sometimes Blender/BFA will delete the incorrect ones (at least as far as Unity/PT/KSP/Taniwha's exporter, are concerned. Lie, theres no way it knows *which* duplicate vert to delete... and the whole reason we *have* those dupes is because of the vertex normal data... Make sense?...

Edited by Stone Blue
Link to comment
Share on other sites

@ColdJ Ah... yeah.. thats a pop-up of a snippet from the log...
Usually, or at least *sometimes*, there is an actual error/warning message that pops up, with a clearer message, without the details...
Like, IIRC, one place it shows, is in the status bar... right where that yellow triangle icon, and the red bar are in your screenshot

I still cant read the log details well with Blender/BFA/Python.... But that *could* be a file permission problem, due to C:? vOv
The other thing i would say to try, might be to edit the plugin's folder name... delete the "-master" from it... I know a long time ago, it was established that Taniwha was using special characters in the folder name, specifically a period (.) .... Its a Blender or Python thing that you cant use some special characters in folder names... Dash (-), *might* be one of them...
Ever since I found that out, whenever I install/update, I always edit the folder name to: /io_object_mu

Edited by Stone Blue
Link to comment
Share on other sites

I will look into that.

It took a while but I believe I found the overlays drop down you said. I started by looking to the left when I should have looked right. Looks like there are 2 ways of doing it, one that colours the face side blue and the other side red, and one that puts little lines sticking out from the face side.

Very helpful. Thank you very much for that.

@Stone Blue

Link to comment
Share on other sites

1 hour ago, ColdJ said:

It took a while but I believe I found the overlays drop down you said. I started by looking to the left when I should have looked right. Looks like there are 2 ways of doing it, one that colours the face side blue and the other side red, and one that puts little lines sticking out from the face side.

Very helpful. Thank you very much for that.

Oh.. yup.. i forgot about the facing coloring red/blue thing... i dont use that one :P

Oh, I cant remember if it was discussed earlier, but any Ngons will prevent an export. I usually, occasioanlly check for those as/if I add a lot of new faces... Also, one moar good, quick check to do before *every* export.

Just for everyone's FYI, easy way to check for Ngons is, in Edit mode, with NOTHING selected in the mesh, do Select-->Faces by Sides. In bottom left corner, a little thing will popup, ">Select Faces by Sides", click the dropdown, mae sure its set to "4", and change to "Greater Than"... Any Ngons will then automagically be selected and show up as highlighted. Then you just have to manipulate them. If nothing shows up highlighted, then you're good to go on Ngons (or lack of, which is what you are shooting for :P )

 

Edited by Stone Blue
Link to comment
Share on other sites

44 minutes ago, Stone Blue said:

Just for everyone's FYI, easy way to check for Ngons is, in Edit mode, with NOTHING selected in the mesh, do Select-->Faces by Sides. In bottom left corner, a little thing will popup, ">Select Faces by Sides", click the dropdown, mae sure its set to "4", and change to "Greater Than"... Any Ngons will then automagically be selected and show up as highlighted. Then you just have to manipulate them. If nothing shows up highlighted, then you're good to go on Ngons (or lack of, which is what you are shooting for :P )

I get the "Ngons detected in mesh, tangents won't be exported" message all the time but it still exports and on import they are magically fixed.

After fixing all the wrong way normals in the Tie Advanced nacelles I went and renamed the folder and then reinstalled the plugin. I got a simple blend file model to export as .mu but the old Tardis one came up error again, so there must be a deeper issue with it.

More great info. I am learning alot today. :)

By the way, how exactly do you manipulate them? What needs doing to make them not Ngons?

 

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