Jump to content

Texture Animation


noonespecial

Recommended Posts

YANFRET and I were talking recently, discussing texture I've made for my new Orion MPCV pod and YANFRET had an idea. I have two textures for the pod:

AdR5uWc.png?1

and

GtpyrLq.png?1

The idea is simple. To be able to animate the texture so that the later texture is showing after re-entry. Since we're using DRE, which has heat shielding as a depleteable resource, perhaps the animation could be bound to the usage of resource. Or... something else. Neither of us are programmers, so we're only guessing.

Would anyone care to take a shot at righting a plugin to accomplish this?

Link to comment
Share on other sites

YANFRET and I were talking recently, discussing texture I've made for my new Orion MPCV pod and YANFRET had an idea. I have two textures for the pod:

http://i.imgur.com/AdR5uWc.png?1

and

http://i.imgur.com/GtpyrLq.png?1

The idea is simple. To be able to animate the texture so that the later texture is showing after re-entry. Since we're using DRE, which has heat shielding as a depleteable resource, perhaps the animation could be bound to the usage of resource. Or... something else. Neither of us are programmers, so we're only guessing.

Would anyone care to take a shot at righting a plugin to accomplish this?

This is actually really really easy, RealChute does exactly this to change part textures in the editor. You just need to loop through the part renderers, and change the material's texture. I say you should try it yourself, C# is pretty easy to learn and that particular job is not all that hard :)

Link to comment
Share on other sites

Er.... um.... easy you say? I have no idea how to write a plugin, but I guess I'll look into it.

As I said, it's easy! C# itself is a simple language, and the forums is full of resources to get you started to mod KSP. I'd like to propose my help, but it's finals period and I really don't have any time to allocate to this until the few first weeks of January

Link to comment
Share on other sites

I have a little (read: very little) experience with C#, I'm more familiar C++. I'm not familiar with the KSP/Unity APIs though. I'll have to look them up. I've glanced at them a few times here on the forum. I'll see if I can figure out, if not, I'll ask some questions. Good luck with your finals :)

Link to comment
Share on other sites

What would be really great is being able to blend between arbitrary images; you could blend between the original texture and a second one, then between second and third. It would allow progressively more damage, without it being too obvious that you're just blending.

Link to comment
Share on other sites

What would be really great is being able to blend between arbitrary images; you could blend between the original texture and a second one, then between second and third. It would allow progressively more damage, without it being too obvious that you're just blending.

That's just as easy as blending from a first one to a second one.

Link to comment
Share on other sites

When dealing with textures at run time ksp adds an extra hurdle in that many textures can not be read from (or written to), ie you can't read the individual pixel values. Textures loaded from mbm and tga files behave like this, textures loaded from png files are readable, at least in win32 and 64 bit ubuntu.

Link to comment
Share on other sites

Another thing that just occured to me is a greyscale blending mask that changes the interpolation speed or length. it you would allow per-pixel control over the blending so you could have some parts of the texture look like flakes of paint are disappearing.

Link to comment
Share on other sites

which realchute module does this? so I can look at the source? right now I'm blindly looking at the different parachute related ones on github

It doesn't happen directly in any part module, but in the ProceduralChute object, right here. Also, Realchute does jot blend textures, but it switches between different textures. Blending is simply a matter of interpolating each pixel value between one another.

Link to comment
Share on other sites

When dealing with textures at run time ksp adds an extra hurdle in that many textures can not be read from (or written to), ie you can't read the individual pixel values. Textures loaded from mbm and tga files behave like this, textures loaded from png files are readable, at least in win32 and 64 bit ubuntu.

Is this true?

Link to comment
Share on other sites

Someone else recently requested exactly this feature and was asking if my texture animator could be used; not really for this, sadly. However, blending textures.... That sounds promising! You can only apply one shader per object in KSP afaik, so I assume you mean blend at diffuse level within the shader, stupid_chris? I'll see what I can dig up in Unity docs.

Link to comment
Share on other sites

If it is indeed possible, that shouldn't be a problem :) I'm involved in a little plugin side project with nli2work at the moment, which I'm quite excited about - this goes on the top of the 'to do next pile'. This is going to be an interesting one to code, as it has far wider applications than just reacting to re-entry heat. With the blending mechanic working, you could weather stuff that's been out on long missions, add micro-meteorite marks.... an almost endless list of things which will enhance the look and feel of KSP. I really hope it's possible to do in KSP!

Link to comment
Share on other sites

As long as the plugin is manipulating a channel that is in the shader it is less hard. RPM does it with the MFD screen, you can set the screen to use Emissive or MainTex depending on the shader you assigned to the screen object. FStextureSwitch2 can independently change MainTex and Bump channels.

Hard part is getting a shader that has the proper channels to handle all the visual aspects you want to display. the current best option is Bump/Translucent/Specular; which gives you Normal Map; Diffuse; and Alpha channels; plus uniform Specular setting. KSP Emissive shaders don't use Alpha channel for transparency. rbray or Shaw would know more specifics and what is and isn't possible to extend the KSP shaders. Another option is use one of the Unity shaders; a bit of hit and miss from my previous attempts.

of course we can hack around the limited shaders by stacking layers of mesh each using different existing shaders, works pretty well, if not the most elegant solution. the orbital tug pod has 3 window glass layers for example spaced 0.001 apart. JSISelectableFlag swaps any PNG in GameData/Flag or /Agencies, on 2 of those layers for pretty wide variety of effects.

Edited by nli2work
Link to comment
Share on other sites

as long as the shader has enough texture channels, they can be set to control different surface properties, direct swap or gradual blend is different ways to get to the same point. The current shaders are limited is because they are pre-compiled, you can't change what the texture channels control (Spec, Diffuse, AO, etc), and you can't add or remove texture channels if you need or don't need them. Empty texture channels are problematic often times during part compile. You have to write and compile a new shader if you wanted separate texture channels to control Transparency and Specular.

This is main reason I'm looking forward to Unity 5 shaders; they work much more like material editor in a 3d app, and the in-game shader is compiled during game build. I expect PartTools will need an update to support Unity 5 shaders.

Edited by nli2work
Link to comment
Share on other sites

have you tried contacting Starwaster for any way to have the textures trigger on reentry as he is doing work for DRE...

Oh yea? which parts? the heatshields? *stupid me... of course the heat shields. LOL

Edited by nli2work
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...