PakledHostage Posted August 20, 2012 Share Posted August 20, 2012 A few months ago, I did some work developing a physics model for re-entry heat that would behave in a way that is representative of reality, while using minimal computational overhead. The thread can be found here. I finally got around to coding it, but I am no good at 3D modelling and I don’t know enough about Unity to make visual re-entry effects so I didn’t bother. Instead, I am posting the basic physics module here in case anyone wants to incorporate it into their own project. And if anyone reading this wants to collaborate on developing a re-entry heat module, please send me a PM. Note that this isn’t intended as a useable re-entry heat module so I am only posting the raw source code here. Feel free to incorporate it into your own projects though. Also I think a proper re-entry physics model should account for excessive deceleration as well. Maybe the spacecraft should be destroyed if the g-meter reaches the top of the red zone on the navball?I've included some screen shots below that were taken during a low-angle re-entry from low Kerbin orbit. The data displayed in the re-entry heat UI was calculated using the code library that I've attached to this post: Link to comment Share on other sites More sharing options...
MrPwner Posted August 20, 2012 Share Posted August 20, 2012 Nice! I had an idea for reentry but for the appearance of it. You could use the heating effect of engines and make some kind of invisible model on a heatshield part with normally invisible textures. But when you start heating up, the effect could become visible. Very interested in this.Also, I can model. I'd have to figure out parttools first for the emissive map first, but then I could make that happen.For my modelling work you can check my signature. Link to comment Share on other sites More sharing options...
MrPwner Posted August 24, 2012 Share Posted August 24, 2012 Alright, for people interested in this, here's a little update.PakledHostage and I have been talking through PM about what we can do with this. He already has done an awesome job running the numbers and coding the part.Now, we want to merge it with actual visible effects from a dedicated heatshield part. It will use emissive maps (like the heating effect in airbreathing engines) to simulate visible heat on the heatshield itself, and to make a shock-like effect that surrounds the reentering capsule.Or as PakledHostage explained it:The colour of the heat shield's emissive texture could then be defined in terms of the computed heat shield temperature, and the colour of the re-entry effect model could be defined in terms of the shock temperature. And the transparency of the shock re-entry effect model could be defined in terms of the air density.I've been busy making a heatshieldmodel getting to work with Parttools and got it figured out (check renders below). The only thing left to do now is incorporate the heating effect. Once I got that figured out in parttools, which shouldn't take too long thanks to CardBoardProcessors great tutorial, we can start on implementing that visible heat in the coding.PakledHostage also wanted to incorporate burning up in the atmosphere, which would of course make the whole concept complete. He'll be away on vacation soon. During that time I'll try to figure out the programming part (I have no experience with plugins, but I do with C#).If we can get all that to work, we basically got working reentry! And once we release it, will allow other modmakers to easily make their own heatshield.Heatshield render in blenderHeatshield render in Unity (with working bumpmap, although the normal map has to be inversed)Heatshield with effectmodel (heatshield lower middle). The shock-effect model will normally be invisible, until you start heating up and the emissive map becomes visible) We hope you're as excited as we are about this Please tell us what you think, suggestions are always welcome Link to comment Share on other sites More sharing options...
PakledHostage Posted August 24, 2012 Author Share Posted August 24, 2012 (edited) I think this project is going to be a good learning experience for both MrPwner and I, but I think we can do a good job. And while it may not turn out to be possible to vary the transparency of the shock re-entry effect model, I think we can make it look pretty and behave realistically with a bit of effort. I am looking forward to getting it working because I think re-entry heat is something that is missing from the game. If I remember my space history correctly (I am sure someone will correct me if I am wrong), the Soviets were able to orbit impressively large spacecraft in the early days but they couldn't successfully re-enter them. This is because it is quite the technological challenge to bring a spacecraft (or warhead) down from orbit in one piece. We currently have it easy in KSP... Edited August 24, 2012 by PakledHostage Link to comment Share on other sites More sharing options...
cocomoe1002 Posted August 25, 2012 Share Posted August 25, 2012 Now i am wondering when the heat effects are done are they going to have a effect on the spacecraft if the craft doesnsnt have a heat shield what will happen? And my 2nd question will the heating effects be able to see in the new IVA as they go thoough the atmoshpere does that effects anyhting inside the ship. Ik many new things are to be added in 0.17. Also my 3rd last question. is the reentry just for the planet Kerbin. Or for the other planets that are going to be added to the game like Eve, or The new Murs like planet ? will they have the heating reentry to? Link to comment Share on other sites More sharing options...
ZeroTheAstronaut Posted August 25, 2012 Share Posted August 25, 2012 This is pretty cool; I hope you guys get this working. Link to comment Share on other sites More sharing options...
AncientAstronaut Posted August 25, 2012 Share Posted August 25, 2012 This will be an amazing add-on. Keep at it! Link to comment Share on other sites More sharing options...
Arrowstar Posted August 25, 2012 Share Posted August 25, 2012 Nice! How long did it take to put the physics together for this? What sorts of fluid and thermal models did you use? (I haven't had a chance to look at source yet.) Link to comment Share on other sites More sharing options...
Dani-Sang Posted August 25, 2012 Share Posted August 25, 2012 FYI... Emissive & Normal map don't work atm togheter unless you create your own shader atm. Also to create your own heatflames with emissive map on transparacy, that needs its own custom shader aswel and you need to code that in. I've tried this myself, but I'm not a coder and didn't get further and Kethane came around as a more interesting goal. You guys are definatly going the right way. If you guys need help then poke me. Good plan if PakledHostage & MrPwner team up togheter, you will achieve a lot more then on your own. Link to comment Share on other sites More sharing options...
MrPwner Posted August 25, 2012 Share Posted August 25, 2012 Now i am wondering when the heat effects are done are they going to have a effect on the spacecraft if the craft doesnsnt have a heat shield what will happen? Currently we're working on a heatshield only module. So there will only be simulated re-entry when one of those heatshields is present on the vessel. But we can probably extend this to command pods with integrated heatshields.And my 2nd question will the heating effects be able to see in the new IVA as they go thoough the atmoshpere does that effects anyhting inside the ship. Ik many new things are to be added in 0.17. From what I understand, you can see anything outside your ship when in the internal cockpit view. So if the model and texture are done right, this means reentry would be visible from within the capsule.Also my 3rd last question. is the reentry just for the planet Kerbin. Or for the other planets that are going to be added to the game like Eve, or The new Murs like planet ? will they have the heating reentry to?As far as I could see from the coding, it's all specific to Kerbin, now. But we'll probably make it support the other planets as well.Nice! How long did it take to put the physics together for this? What sorts of fluid and thermal models did you use? (I haven't had a chance to look at source yet.)You can find PakledHostage's work on that [thread=13271]here[/thread]FYI... Emissive & Normal map don't work atm togheter unless you create your own shader atm. Also to create your own heatflames with emissive map on transparacy, that needs its own custom shader aswel and you need to code that in. Do you mean that it won't work ingame? In Unity I got an emissive and bumpmap working. Can't check it ingame since there's no coding that will play the animation yet. Link to comment Share on other sites More sharing options...
Dani-Sang Posted August 25, 2012 Share Posted August 25, 2012 Do you mean that it won't work ingame? In Unity I got an emissive and bumpmap working. Can't check it ingame since there's no coding that will play the animation yet.You will see it working within Unity, but won´t work ingame. You will eventually just see a object without normal, but emissive will work. Devs have been informed about and fix is inbound Link to comment Share on other sites More sharing options...
MrPwner Posted August 25, 2012 Share Posted August 25, 2012 Ahh alright then. Thanks for the info.Too bad for now, it would look much cooler if it worked, with the tiles and all Link to comment Share on other sites More sharing options...
Dani-Sang Posted August 25, 2012 Share Posted August 25, 2012 Ahh alright then. Thanks for the info.Too bad for now, it would look much cooler if it worked, with the tiles and all Counts for my models aswel Link to comment Share on other sites More sharing options...
MrPwner Posted August 25, 2012 Share Posted August 25, 2012 Dani-Sang, you're right, there's no shader that allows transparency and emissive (not that I doubted you ). After curiously fooling around a bit in Unity and looking at the shader coding in monodevelop, I managed to make the shader take the alpha channel of an emissive map where the unaffected areas are transparent. (Magically without errors)With a normal emissive animation it looks like this:Mid-animation. As you can see it has transparency, the heatshield part is visible (effectmodel is still a model with single-sided faces).But at the beginning of the animation it looks like this. It's the standard emissivecolor. I want it to be fully transparent at the beginning of the animation, so I'd have to see if I can incorporate transparency into the animation, somehow.Is it even possible to get custom shaders working ingame in any way? If not I just wasted my afternoon But hey, time you enjoy wasting, wasn't wasted, right? Link to comment Share on other sites More sharing options...
Dani-Sang Posted August 25, 2012 Share Posted August 25, 2012 (edited) Tosh Car plugin has its own shaders... which have transparancy shaders and aren't standard within KSP currently. I've heard more people talking about it. About what happens, I kind of expected that hahaha. I think the following solution should be as followed:- Keep Emissive on at all times. - Adjust total opacity value of object in question from 0 to 1. Its funny, you are exactly doing what I wanted to do but I had have no coding knowledge so I stopped. Great to see you picking it up like this. I will help you to the end .---Other problem is that it wont "animate". So you have 2 options... 1. I have read somewhere the there is a code within unity shaders that looks at a texture and divide that within a few squares. It will look at one square on moves along.2. Try to flicker or randomize opacity of the animation with a high rate. This is the more subtle and easy method and I think this is easier to code.---I'll follow this thread closely Edited August 25, 2012 by Dani-Sang Link to comment Share on other sites More sharing options...
MrPwner Posted August 25, 2012 Share Posted August 25, 2012 Tosh Car plugin has its own shaders... which have transparancy shaders and aren't standard within KSP currently. I've heard more people talking about it. Nice, then this definitely has the potential to work.And I guess I'll have to look through Tosh's source to see what he did and how he did it.Thanks for the help Link to comment Share on other sites More sharing options...
Dani-Sang Posted August 25, 2012 Share Posted August 25, 2012 Nice, then this definitely has the potential to work.And I guess I'll have to look through Tosh's source to see what he did and how he did it.Thanks for the help yw... if you manage base code working, and if you want, I can give you some nice looking heathshields. Link to comment Share on other sites More sharing options...
LaydeeDem Posted August 25, 2012 Share Posted August 25, 2012 You guys might be interested in this:http://kerbalspaceprogram.com/forum/showthread.php/18063-PLUGIN-0-16-ShaderReplacer Link to comment Share on other sites More sharing options...
MrPwner Posted August 25, 2012 Share Posted August 25, 2012 Thanks for that Nutt007, that'll really help! Link to comment Share on other sites More sharing options...
Dani-Sang Posted August 25, 2012 Share Posted August 25, 2012 Ooh, thats for me intresting aswel! Link to comment Share on other sites More sharing options...
MrPwner Posted August 25, 2012 Share Posted August 25, 2012 Well, I managed to get the transparency at the beginning fixed You actually have to code it in to make it useable in the animation.I'm beginning to understand the shaders a bit better Link to comment Share on other sites More sharing options...
Dani-Sang Posted August 25, 2012 Share Posted August 25, 2012 (edited) :thumbsup: keep going like this and you can release something nice this weekend going to ask directly for a request to keep in count to make it usefull for other people.In Tosh's cart & some of his other plugins, you will give the object a name and the pluginwill know exactly what it does. Unless it is fully animation based, then it won't be needed ofcourse. Edited August 25, 2012 by Dani-Sang Link to comment Share on other sites More sharing options...
thorfinn Posted August 25, 2012 Share Posted August 25, 2012 (edited) I gave a look at your source code. Very good work, and also instructive for my long-delayed modding project!It's hard to avoid the fact that a Kerbin reentry is definitely mild compared to what we experience on Earth, though But there are a couple of things that maybe you could think about...First, why don't you just lower the speed of sound a bit? 320 m/s feels terribly fast on a planet as small as Kerbin, and our leading planetary scientists (I mean here on the forum ) have long debated the very high density of the Kerbal atmosphere. I'd raise the molecular mass and lower gamma to get something like 250 m/s for Mach 1 at sea level.... (your "R" contains both the gas constant and the molecular mass, right?)Two: can we say that you are modeling a metallic, "heat sink" type thermal protection system now? You assume that the whole mass of the TPS is heated uniformly after all (like in the first experiments for ICBM nuclear warheads if I'm not mistaken). This means that the capsule sits on a slab of red-hot metal during peak heat... and you could easily say that even the low temperatures that you get are not that low at all in such a situation: the shield requires its own insulation to avoid frying capsule systems and scalding the Kerbals.So, you could put a quite low temperature threshold for heat sink, forcing them to be quite massive, and start working on an approximated way to model an ablative shield for weight-constrained users (I have an idea about this last point but I still need to check it.)Also: you are right, the steep end of a reentry corridor is usually constrained by G loading, or peak heat flux (since they go hand in hand): but the maximum total heat load is encountered on the shallow trajectory. Edited August 25, 2012 by thorfinn Link to comment Share on other sites More sharing options...
Cooly568 Posted August 26, 2012 Share Posted August 26, 2012 I will keep a close eye on this. Reentry FTW. Link to comment Share on other sites More sharing options...
Dani-Sang Posted August 27, 2012 Share Posted August 27, 2012 Any Progress on this? Link to comment Share on other sites More sharing options...
Recommended Posts