Jump to content

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


Recommended Posts

2 hours ago, ColdJ said:

If each louvre is on a axis that is constrained to look at a moving axis at the tip of the axis that the control suface uses. I think that is what you were going for but I am not sure if you aimed at an empty that is parented inside the axis empty and at a distance from the origin point to create a bigger arc.

It's not a LookAtConstrain it's a ConstrainPosition. When the target rotates, the mover rotates to the same angle, so each Door(N)Axis rotates to the same angle as NozzleTransform. Here is my config for all this mess.

Spoiler

    MODULE
    {
        name = AnimatedEngine
        EngineAnimationName = EngineDoors
        WaitForAnimation = 0.73
    }

 

    MODULE
    {
        name = ModuleControlSurface
        useInternalDragModel = True
        dragCoeff = 0.001
        deflectionLiftCoeff = 0
        ctrlSurfaceRange = 45
        ctrlSurfaceArea = 1
        actuatorSpeed = 60
        transformName = NozzleTransform //DoorAxis
        ignorePitch = True
        ignoreYaw = True
        ignoreRoll = True
    }

    MODULE
    {
        name = FXModuleConstrainPosition
        matchRotation = true
        matchPosition = false
        CONSTRAINFX
        {
             targetName = NozzleTransform
             moversName = Door1ctrl
        }
        CONSTRAINFX
        {
             targetName = NozzleTransform
             moversName = Door2ctrl
        }
        CONSTRAINFX
        {
             targetName = NozzleTransform
             moversName = Door3ctrl
        }
        CONSTRAINFX
        {
             targetName = NozzleTransform
             moversName = Door4ctrl
        }
    }

2 hours ago, ColdJ said:

Leaving transforms with .001, .002 etc is only for thrust, intake and points you want the same exhaust effect to spawn at because the game treats them as the same.

This is exactly what I was aiming for because NozzleTransform and NozzleTransform.001 are actually thrust transforms, not because I'm too lazy to rename them :D  But my assumption that control surfaces work in a similar manner as gimbal transforms was wrong. Having multiple thrust transforms with the same name and using them as gimbals works just fine. They can deflect in opposite directions for roll so the game doesn't treat them exactly the same.

Originally there was no thrust vectoring, just 2 thrust transforms fore more "rectangular" exaust and these 4 parts covering the engine when it's not in use. But then I decided to repurpose them to do something useful instead of being roasted in the exhaust for no reason.

Edited by Manul
Link to comment
Share on other sites

5 hours ago, Manul said:

And of course there is a problem because ModuleControlSurface didn't work with both instances of NozzleTransform. That's easy to fix by parenting NozzleTransform.001 to something like NozzleAxis and using ConstrainPosition to match it's rotation with NozzleTransform.

I was basing the advice about .001 based on your pics showing only one thrust following your louvre.

Currently building a Zeppelin. Put the Hot Air Balloon next to it for comparison.

6PSktqX.jpeg

Link to comment
Share on other sites

3 hours ago, ColdJ said:

As I am self taught I have never tried to get into the whole animated bones way of controlling animations for complex effects, but maybe you should learn for what you are doing. The Squad afterburning engines use this method for making the nozzle expand and shrink with the throttle while still having the nozzles gimbal. Hooligan Airships Core uses a very complex setup for the Cirrus balloon. I believe that this method might give you what you want to do.

This is what I might need for landing gear because using constrain modules to handle both suspension and retraction motion is a huuuge pain. I managed to make "hydraulic cylinders" stay solid when the suspension works but they begin to fall apart during retraction. And I have no idea how to make a folding strut like this without suffering a major brain explosion. And without this strut my landing gear looks incomplete and not realistic.

 

Edited by Manul
Link to comment
Share on other sites

Here is the design I ended up with and I'm not satisfied yet

Spoiler

Pzf9ivK.png

cStMKYY.png

oWZJmZp.png

That green thing under the wing is another source of pain: a retractable light.

Link to comment
Share on other sites

5 minutes ago, Manul said:

This is what I might need for landing gear because using constrain modules to handle both suspension and retraction motion is a huuuge pain.

I generally cheat these as the actual suspension just ocilates at the suspension transform based on it's orientation and you don't want the wheel pivots to be other than vertical when deployed or you can get nasty skating happening in game. Now you can have the suspension at an angle as long as the steering transform is the straight up and down in comparison to the gear. That is the Steering transform does not follow the exact orientation of the Suspension transform.

Now you can make it look like you have hydraulic struts bouncing at an angle using the constraint like in the stock landing gear.

    MODULE
    {
        name = FXModuleLookAtConstraint            // scissor links
        CONSTRAINLOOKFX
        {
            targetName = anchor2
            rotatorsName = link1
        }
        CONSTRAINLOOKFX
        {
            targetName = anchor1
            rotatorsName = link2
        }
    }

Take note of the orientation of both in the model and you will see that they point at each other on a particular axis.

As for the folding action, that can be achieved through animations that are parented inside each other and make sure to have the origin points of the meshes at the points you want to pivot that piece at within the sequence. When animating you want to animate the parent first and see what that does to the child, then based on that animate the child, then if it has a child animate that etc, eventually you will get a sequence that looks right.

Everything to do with suspension and steering should be done only when fully deployed, as it ceases to work when the animation is retracting the gear. Also you want the "deployTgt" transform to be centred in Wheel collider as the wheel only works when the "DeployTgt" is where the Wheel collider is in virtual space.

No matter what you see in Squad wheels. Always build fully deployed and then do the animation to retract.

Then have the module in the config look like this

    MODULE
    {
        name = ModuleWheelDeployment
        baseModuleIndex = 0
        
        animationTrfName = Medium
        animationStateName = LandingGearMediumDeploy
        deployedPosition = 0
        deployTargetTransformName = deployTgt
        
        TsubSys = 1.0
        useStandInCollider = True
        slaveModules = 8
        
        fxDeploy = deploy
        fxRetract = retract
        fxDeployed = deployed
        fxRetracted = retracted
    }

By the way         baseModuleIndex = 0 is refering to where

    MODULE
    {
        name = ModuleWheelBase

is in the list of modules within the config. If you don't have it as the first module this will not work.

5 minutes ago, Manul said:

That green thing under the wing is another source of pain: a retractable light.

Build it as a separate model with a node attachment on the wing for it. Too many things within a wing that move can get troublesome.

Link to comment
Share on other sites

1 hour ago, ColdJ said:

Now you can make it look like you have hydraulic struts bouncing at an angle using the constraint like in the stock landing gear.

I managed to make hydraulic cylinder that doesn't fall apart  but the folding front strut is too much for me because LookAtConstraint seems to freak out when something above in the hierarchy begins to rotate and move in multiple axis. It has a problem with things that aren't cylinders BDModuleLookAtConstraint from BD animation modules handles rotation much better than the stock one, I had to use it for suspension arms because with the stock module they used to twist in the most unnatural way while being retracted. It's really hard to describe, I need a video to show the difference between stock and Bahamuto's modules, but it's still not ideal so I,m not sure about the folding strut that should look at a virtual point while folding.

Edited by Manul
Link to comment
Share on other sites

Ok. I try to stick to stock so that I don't force people to have to have other mods when possible, but if it works for you that is the way to go. I have used mods that add sound for the wheels and animation of things moving from one state to another.

Where the constrained things are in the heirarchy can make a difference.

Haven't had time to check the looping animation yet, the scanner loops too but I think it needs to link to scanning module to work. Could have a light that scans I guess. :)

 

Link to comment
Share on other sites

1 hour ago, ColdJ said:

but if it works for you that is the way to go.

Now I'm just trying to make things work at all costs, optimization will come later.... I hope it will :confused: And I'm stuck to BDAnimationModules and B9AnimationModules anyways because they allow such things like engine/RCS deployment and intake animation. And I really really like watching things fold and unfold that's the main force driving me into KSP modding: make moar moving stuff because we already have enough boring static stuff (and wobbly robotic stuff).   Maybe I'll switch to bones instead of swarming constrain modules to create parallelograms. And I still have no idea how to make an angled strut fold like this :  ___  => /\  no matter the rotation issues. I can't use animation because it's involved into suspension motion so I need a virtual point to point the LookAtConstraints at it. Or match their rotation using ConstrainPosition.

And now I begin to understand why there is no angled landing gear with working angled suspension in any mods using stock modules.  But there is plenty of angled suspension using KSPWheel plugin, it allows multiple modules to move/rotate one object.

1 hour ago, ColdJ said:

Haven't had time to check the looping animation yet

I took a look into the centrifuge and rotary light cfg and both of them are using FSAnimateGeneric instead of the stock AnimateGeneric. Yes, the good old Firespitter, another dependency that is nearly impossible to drop. And we have the giant B9 HX reactor that spins despite having no animation modules in it's cfg... it just spins.

Edited by Manul
Link to comment
Share on other sites

3 hours ago, ColdJ said:

Build it as a separate model with a node attachment on the wing for it. Too many things within a wing that move can get troublesome.

Do you know what this line in the ModuleLight means? My guess is that it should point at the lens that changes color when the light does.

  MODULE
   {
          name = ModuleLight
          lightName = Wlamp
          lightMeshRendererName = WingLight
          useAnimationDim = True
          lightBrightenSpeed = 2.5
          lightDimSpeed = 2.5
          resourceAmount = 0.01
          animationName = LightDeploy
          useResources = True
    }

Edited by Manul
Link to comment
Share on other sites

@Manul

It is the name of the mesh that you want to brighten. So in your model in your 3d work space you cut your mesh up into different parts, you name the mesh that represents the light panel, dome etc to the name that you put in that line. Easiest is to go look in the latest squad lights that can change colour. Compare the model in blender to it's config and you will see the correlation. It is also where you can get the correct material setup for doing that.

Link to comment
Share on other sites

2 hours ago, ColdJ said:

Easiest is to go look in the latest squad lights that can change colour.

I tried to reverse engineer the stock taxi lights and got even more confused :confused:  esMYYyG.png

The whole lamp is a single mesh but only the lens gets it's light effects.

 

UPD: meh, I get the idea, this is where the emissive texture comes into play, indicating which part of the mesh should actually be emissive

Edited by Manul
Link to comment
Share on other sites

On 6/18/2024 at 12:26 PM, ColdJ said:

As this example is for a heat effect, leave this as is and then right click the same box and a small menu will come up. At the top of the menu it has the option of "Insert keyframe" . Left click it and then open the Animate workspace.

Thank you! That was a crucial step for making actual lights instead of solid dark bricks emitting a 1kW beam from another dimension. And now I can make red hot glowing nozzles as well. That was a thing I could not figure out myself no matter how many models I looked through. I was looking for some checkboxes or digital inputs that enabled the emission  and the actual "emission switch" was to animate the emission color from black to anything else.

pVoDw7C.png

ZNpjsUU.png

:D It shines! Finally!

Link to comment
Share on other sites

Tried to see if I could use unity with part tools but having to be online through the hub and signing in each time is not worth the effort.

Link to comment
Share on other sites

I am trying to make a transparent window. I am using a .png texture file with alpha baked in. Should the texture even have an alpha value?

But I can't get the transparency and specularity of the glass to look right in game.

What shader should I pick and what is a good setup?

 

Link to comment
Share on other sites

57 minutes ago, NippyFlippers said:

I am using a .png texture file with alpha baked in. Should the texture even have an alpha value?

Yes, It determines which part of a mesh should actually be transparent. Or at least be more transparent than the others depending on the shader settings. I'm using a translucent specular shader here but I can't get it right either.

BNoqmEC.png

Link to comment
Share on other sites

Posted (edited)

Is this for an internal or external window? Are you wanting a tint or marks on the window?

Internally you can simply remove the window mesh for it to be see through as long as your external has it mesh face only facing out.

For a see through window you need to use the correct shader. KSP/Alpha/Translucent works well. You need to pair it with a texture pic where the panel you uv map to has it's opacity lowered. I use Paint.net to make my texture pics and when you expand the colour palete box using "more" there is a slider for opacity. If the colour is full opaque then even with that shader you won't see through, but as you lower the opacity the mesh will be more and more see through in game. The Hot Air Balloon mod I recently put out uses this shader for the balloon. Full opaque is 255, I wanted to be able to just see through it so that things like the Sun would shine through, so I set the opaqueness to 230. If you dropped it to 10 you would be barely able to see the tint.

Don't worry about adjusting  alpha or anything like that. The shader is preset to handle anything like that. Just the opaqueness of the panel you uv map to in your texture pic and selecting the correct shader.

@NippyFlippers @Manul

Hey Manul did you get my message about positioning prop using BforArtists?

Edited by ColdJ
Link to comment
Share on other sites

8 minutes ago, ColdJ said:

Hey Manul did you get my message about positioning prop using BforArtists?

Yes, it sounds like an alternative to the Unity Editor that gets really wonky when it comes to precision positioning, but that's a pretty masochistic alternative.

Link to comment
Share on other sites

1 minute ago, Manul said:

Yes, it sounds like an alternative to the Unity Editor that gets really wonky when it comes to precision positioning, but that's a pretty masochistic alternative

Yep, but it is the only one I have unless I farm all my internal prop making out to someone who has a working unity setup. :)

Link to comment
Share on other sites

15 minutes ago, Manul said:

Yes, It determines which part of a mesh should actually be transparent. Or at least be more transparent than the others depending on the shader settings. I'm using a translucent specular shader here but I can't get it right either.

BNoqmEC.png

I have baked a PNG file and it has alpha values in the areas corresponding to the glas parts. But in game the glass is barely visible (see picture). I need some adivce what values for the KSP/Alpha/Translucent Specular Shader work well, because in game it looks nothing like in blender.

14 minutes ago, ColdJ said:

Is this for an internal or external window? Are you wanting a tint or marks on the window?

Internally you can simply remove the window mesh for it to be see through as long as your external has it mesh face only facing out.

For a see through window you need to use the correct shader. KSP/Alpha/Translucent works well. You need to pair it with a texture pic where the panel you uv map to has it's opacity lowered. I use Paint.net to make my texture pics and when you expand the colour palete box using "more" there is a slider for opacity. If the colour is full opaque then even with that shader you won't see through, but as you lower the opacity the mesh will be more and more see through in game. The Hot Air Balloon mod I recently put out uses this shader for the balloon. Full opaque is 255, I wanted to be able to just see through it so that things like the Sun would shine through, so I set the opaqueness to 230. If you dropped it to 10 you would be barely able to see the tint.

Don't worry about adjusting  alpha or anything like that. The shader is preset to handle anything like that. Just the opaqueness of the panel you uv map to in your texture pic and selecting the correct shader.

@NippyFlippers @Manul

Hey Manul did you get my message about positioning prop using BforArtists?

It is for an external window. The texture is baked and looks fine, alpha channel is adding some slight opacity for the window parts of the file and all. It just looks bad ingame.

Also I have a problem with sections of my part showing as grey in-game.

I am trying to make a cargo bay that has doors with transparant windows. I am using two texture files, one for the doors including trasnparent windows, one for the hull. But for some reason I cannot get the script right in order to texture both elements. (see pictures)

Can you help me with that, please?

PART {
    name = FlyingBoatServiceBay
    module = Part
    author = NippyFlippers
    mesh = FlyingBoatServiceBay
    rescaleFactor = 1
    TechRequired = fuelSystems
    entryCost = 8200
    cost = 1550
    category = Payload
    subcategory = 0
    title = Flying Boat Service Bay
    manufacturer = testn
    description = Taken from Bill's fishing boat.
    attachRules = 1,1,1,1,0
    mass = 1
    dragModelType = default
    maximum_drag = 0.2
    minimum_drag = 0.3
    angularDrag = 2
    crashTolerance = 65
    breakingForce = 2000
    breakingTorque = 2000
    maxTemp = 2000
    bulkheadProfiles = size2, srf
    tags = Boat Hull Flying


    NODE {
        name = top
        transform = node_stack_top
        size = 1
        method = FIXED_JOINT
        crossfeed = True
        rigid = False
    }

    NODE {
        name = bottom
        transform = node_stack_bottom
        size = 1
        method = FIXED_JOINT
        crossfeed = True
        rigid = False
    }

}

pics:

5gLqA5S.png

841Icpr.png

BHZ7YMn.png

Link to comment
Share on other sites

3 minutes ago, NippyFlippers said:

But in game the glass is barely visible (see picture)

This is the same problem I have. The glass does have some tint but it's barely recognizable as a glass from most angles. The shader doesn't have many settings to play with so I guess it is the right texture that makes a good glass in some mods.

Link to comment
Share on other sites

3 hours ago, Manul said:

This is the same problem I have. The glass does have some tint but it's barely recognizable as a glass from most angles. The shader doesn't have many settings to play with so I guess it is the right texture that makes a good glass in some mods.

And I can't figure out why KSP refuses to load the second texture. I know it is possible for KSP, other part authors do it, too. But when I try to use the a module that way, for example:

PART {
    name = FlyingBoatServiceBay
    module = Part
    author = NippyFlippers
   
    MODEL {
        model = TestMod/Parts/FlyingBoatServicebay/FlyingBoatServiceBay
        texture = FlyingBoatServiceBayHullTex , TestMod/Parts/FlyingBoatServicebay/FlyingBoatServiceBayHull
        texture = FlyingBoatSerciceBayDoorTex , TestMod/Parts/FlyingBoatServicebay/FlyingBoatSerciceBayDoor
        texture = FlyingBoatSerciceBayDoorGlassTex , TestMod/Parts/FlyingBoatServicebay/FlyingBoatSerciceBayDoor
    }

... }

Then still KSP refuses to load the texture for the hull part. :mad:

Is it even possible to use multiple image texture files using this .mu plugin? Am I damned to use Unity to achieve that? If so, what version?

Edited by NippyFlippers
Fixed Typos
Link to comment
Share on other sites

5 hours ago, NippyFlippers said:

Is it even possible to use multiple image texture files using this .mu plugin?

Yes, but you assign them in material properties in Blender. (Using the fork BforArtists is easier and makes it easier to help you if you need help with things.)

Starting to use the .mu plugin but having had previous experience using"Unity" or "Blender without using it for KSP" actually works against you. There are things that you do in those creators that don't work, or work in the same way when using the plugin. Don't worry about baking in when it comes to textures or animations. It doesn't work that way for this method.

I have actually answered your question but I fear that Manul may have confused things because they are used to the way Unity works and you can't apply those methods for this.

7 hours ago, ColdJ said:

For a see through window you need to use the correct shader. KSP/Alpha/Translucent works well. You need to pair it with a texture pic where the panel you uv map to has it's opacity lowered. I use Paint.net to make my texture pics and when you expand the colour palete box using "more" there is a slider for opacity. If the colour is full opaque then even with that shader you won't see through, but as you lower the opacity the mesh will be more and more see through in game. The Hot Air Balloon mod I recently put out uses this shader for the balloon. Full opaque is 255, I wanted to be able to just see through it so that things like the Sun would shine through, so I set the opaqueness to 230. If you dropped it to 10 you would be barely able to see the tint.

Don't worry about adjusting  alpha or anything like that. The shader is preset to handle anything like that. Just the opaqueness of the panel you uv map to in your texture pic and selecting the correct shader.

So having used KSP/ALPHA/TRANSLUCENT/SPECULAR I have created a demonstration for you. There are 6 identical cubes, they all use the same shader and the same colour but I have put 6 panels on the texture pic, starting from completely opaque and becoming less so for each panel in turn.
HrwiuqK.png

And as you can see in my pic you have different levels due to this.

Your posts of config show that you are using an older method of doing things.

    mesh = FlyingBoatServiceBay

Should not be used anymore as no matter what you write as the name of the .mu file it will use the first mesh it comes across in alpabetical order in the folder.

In any new config always use "MODEL" as it makes it clear to the config which .mu to use and you can even put your .mu in another folder as long as you make the path clear.

You only ever need to put the texture locations in the MODEL if they are not in the same folder as the .mu and of course you need to have them setup in your .mu material properties.

This is the config for the test I did, note no need to tell the config what texture to use.

 

Spoiler

PART
{
    name = CJTestBed
    module = Part
    author = ColdJ
    MODEL
    {
        model = HotAirBalloon/Biplane/TestBed1
    }
    scale = 1
    rescaleFactor = 1
    PhysicsSignificance = 1
    node_stack_top = 0.0, 0.1287344, 0.0, 0.0, 1.0, 0.0, 0
    node_stack_bottom = 0.0, -0.1287344, 0.0, 0.0, -1.0, 0.0, 0
    node_attach = 0.0, -0.1287344, 0.0, 0.0, -1.0, 0.0, 0
    TechRequired = precisionEngineering
    entryCost = 5800
    cost = 16
    category = Structural
    subcategory = 0
    title = TestBed
    manufacturer = CJ Auto Instruction
    description = A test for opacity
    attachRules = 1,1,1,1,0
    mass = 0.001
    dragModelType = default
    maximum_drag = 0.2
    minimum_drag = 0.2
    angularDrag = 2
    crashTolerance = 7
    maxTemp = 2000 // = 3000
    bulkheadProfiles = size0, srf
    tags = #autoLOC_500774 //#autoLOC_500774 = connect cube frame girder scaffold structur truss
    MODULE
    {
        name = ModuleCargoPart
        stackableQuantity = 3
        packedVolume = 14
    }
}

Your use of

    NODE {
        name = top
        transform = node_stack_top
        size = 1
        method = FIXED_JOINT
        crossfeed = True
        rigid = False
    }

While still valid and used for robotic parts is not needed, and simply using the    "node_stack_top = 0.0, 0.1287344, 0.0, 0.0, 1.0, 0.0, 0" method gives you much more versatility, and allows you to change things without having to edit the .mu you have created.

Some Preset shaders that come with the .mu plugin can have some amounts adjusted in the right hand panel ( I have done this for KSP Bumped Specular Mapped to go from a metallic sheen to a mirror finish) but generally should not be messed with and just left as they come.

SO I hope once you have read this and tried what I have told you that you will get the result you want.

Link to comment
Share on other sites

35 minutes ago, ColdJ said:

I have actually answered your question but I fear that Manul may have confused things because they are used to the way Unity works and you can't apply those methods for this.

Actually I'm confused myself because I don't understand the connection between Blender material settings and the way they get converted into KSP/Unity material settings (seen in Mu Shader tab in Blender). Blender things like assigning alpha channel to glossiness (this is how stock cockpits have glossy windows) is nowhere to be seen in Mu Shader properties but it can be seen in the game.

The way how things on the left interact with the actual Unity material settings in the right window is a mystery for me. The right window is a usual KSP/Unity stuff that can be adjusted in Unity editor, all this junction box stuff on the left is unavailable in Unity editor.

RZMFoAb.png

Edited by Manul
Link to comment
Share on other sites

8 minutes ago, Manul said:

Actually I'm confused myself because I don't understand the connection between Blender material settings and the way they get converted into KSP/Unity material settings (seen in Mu Shader tab in Blender). Blender things like assigning alpha channel to glossiness (this is how stock cockpits have glossy windows) is nowhere to be seen in Mu Shader properties but it can be seen in the game.

Like I said. Allow the preset shaders do their thing and do the rest in the texture pic.

You can't create custom shaders in blender and use them in KSP. You can only use the Presets installed by the .mu plugin and at most adjust some amounts.

.mu plugin does all the work when you export your model.

And for the odd shader or material setup that doesn't come with the plugin you can grab it from a model that has it and assign it to your mesh. That is how I can use the "DepthMask" shader to make better cockpits. You just get the material property from a stock model and assign it to your mesh.

As you know I only recently worked out how to animate colour and light from scratch, rather than grab the setups from other models.

I started this thread in 2022 and you can see from reading the thread or looking at my mods in order of release how I have slowly experimented and worked out how to do things with the .mu plugin over that time.

So best to not assume that any way you do things in Unity applies when using this method.

28 minutes ago, Manul said:

The way how things on the left interact with the actual Unity material settings in the right window is a mystery for me. The right window is a usual KSP/Unity stuff that can be adjusted in Unity editor, all this junction box stuff on the left is unavailable in Unity editor.

Left is all the way blender sets out the creation of a shader. The right panel is the only place you can adjust the KSP shaders and have the changes stick.

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