Jump to content

Animating Material Properties?


Recommended Posts

Would anybody out there know how to animate material properties of a KSP mesh?

For instance brightness for throttle amount or making somthing go translucent?

Link to comment
Share on other sites

@ColdJ A method of animating material properties is the use of ModuleColorChanger{}. For engines, the driver module (which supplies current state information) is FXModuleThrottleEffects{}. In engines made by Nertea there are two instances of this pair of modules. One for throttle glow and one for heat glow. I'm not aware of how to (via config alone) make something turn transparent when exposed to heat. Things like that would have to be arranged as a Unity animation and controlled by ModuleAnimateHeat{} which has no keys worth mention.

The pair of modules for throttle glow. Heads-up, the effect only works around 50% of throttle and is like a light switch, which sucks. Better to use a Waterfall plume that fills in the nozzle and skip this bit.

Spoiler

...

MODULE
{
	name = FXModuleThrottleEffects
	fxModuleNames = throttleColor // a unique identifier. Paired with the other module via this
	responseSpeed = 1 // current state rate of change. No need to change this
	dependOnEngineState = True
	dependOnThrottle = True
	preferMultiMode = True // if dual-mode engine
}
MODULE
{
	name = ModuleColorChanger
	moduleID = throttleColor // a unique identifier. Paired with the other module via this
	animRate = 1 // affects animation speed. Higher is faster but no need to change it
	shaderProperty = _TintColor // the aspect of the material to affect. This uses a different shader
	includedRenderer = ThrottleEMM // whitelist transforms with this name. Multiple keys accepted, one value per key
	toggleInEditor = False
	toggleInFlight = False
	redCurve
	{
		key = 0 0
		key = 1 1
	}
	greenCurve
	{
		key = 0 0
		key = 0.5 1
	}
	blueCurve
	{
		key = 0 0
		key = 0.5 1
	}
	alphaCurve
	{
		key = 0 0
		key = 1 1
	}
}

 

 

The pair of modules for heat glow. Note that the RGBA curve is different here vs the one for throttle glow. It's not the best curve...but it works.

Spoiler

...

MODULE
{
	name = FXModuleThrottleEffects
	fxModuleNames = heatColor // a unique identifier. Paired with the other module via this
	responseSpeed = 1 // current state rate of change. No need to change this
	dependOnEngineState = True
	dependOnThrottle = True
	preferMultiMode = True // if dual-mode engine
}
MODULE
{
	name = ModuleColorChanger
	moduleID = heatColor
	animRate = 0.025 // affects animation speed. Value is very low to make anim very slow
	shaderProperty = _EmissiveColor // the aspect of the material to affect
	toggleInEditor = False
	toggleInFlight = False
	excludedRenderer = ThrottleEMM // blacklist transforms with this name. Multiple keys accepted, one value per key
	redCurve
	{
		key = 0.0 0 1 1
		key = 0.5 1 1 1
	}
	greenCurve
	{
		key = 0.3 0 1 1
		key = 0.7 1 1 1
	}
	blueCurve
	{
		key = 0.5 0 1 1
		key = 1.0 1 1 1
	}
	alphaCurve
	{
		key = 0 0
		key = 0.5 1
	}
}

 

 

The pair of modules for recoloring an ablator part. ModuleAblator{} drives ModuleColorChanger{}.

Spoiler

...

MODULE
{
	name = ModuleAblator
	ablativeResource = Ablator
	lossExp = -7500
	lossConst = 0.1
	pyrolysisLossFactor = 6000
	reentryConductivity = 0.01
	ablationTempThresh = 500 // in Kelvin, the number at which ablation starts
	useChar = True
	charModuleName = shieldChar // a unique identifier. Paired with the other module via this
}
MODULE
{
	name = ModuleColorChanger
	moduleID = shieldChar // a unique identifier. Paired with the other module via this
	shaderProperty = _BurnColor // the aspect of the material to affect
	useRate = False
	toggleInEditor = False
	toggleInFlight = False
	redCurve
	{
		key = 0 0
		key = 0.4 0.5
		key = 1 0.25
	}
	greenCurve
	{
		key = 0 0
		key = 0.45 0.125
		key = 1 0.25
	}
	blueCurve
	{
		key = 0 0
		key = 1 0.25
	}
	alphaCurve
	{
		key = 0 0.8
	}
}

 

 

Link to comment
Share on other sites

@JadeOfMaar

Thank you for this very interesting information,. Very interesting how modules can be paired this way. Great to have more information in my knowledge base.

I should have given more information.

What I meant to ask is how to add animation to the material applied to a mesh inside a 3d model editor. I only work in BforArtists/Blender using the .mu plugin. I can see and copy materials from other models that have an animation such as the one that goes from dark to bright to show an engines throttle amount. First time I did this was making use of the material used by the stock Ion engine and applying it to things like my X-wing models.

And recently I have seen an animated material that makes a TARDIS go almost fully transparent when toggled.

But I have no idea how to create these effects from scratch.

I realise that it might be something that can only be done in the Unity editor, but I don't know how you can get all the software needed to do that these days as the old links seem to be broken.

So was wondering if it could be done in Blender, and if so, how. Or if in UNITY how and where would you get the setup you need to do it?

Link to comment
Share on other sites

@ColdJ You're welcome. Sorry, I don't have any Blender knowledge to share and I'm particularly not aware of those who use strictly Blender and use it to create Unity-compatible texture animations. They either only create heat emissives as I've shown you or they may have their own custom partmodule to control texture animations using scenarios other than throttle and heat.

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