Question BrianJ's Falcon 9R v1.2 tune-up

tradx

New member
Joined
Sep 6, 2016
Messages
18
Reaction score
0
Points
0
Hi BrianJ & Orbiters

I am still trying to do some minor modifications on your fantastic FalconHeavy. I have started by changing things on the Falcon 9R v1.2 and have 4 questions. (I am not sure whether it would be more correct to ask each of the questions in different threads? Please let me know if I should do so)

1-I added some Particle Stream effects to the M1 engine of the second stage as shown below

PARTICLESTREAMSPEC exhaust_sec1 = { //line 432
0, 3, 10, 150, 0.01, 0.15, -0.4, 2, PARTICLESTREAMSPEC::EMISSIVE,
PARTICLESTREAMSPEC::LVL_SQRT, 0, 1,
PARTICLESTREAMSPEC::ATM_PLOG, 1e-7, 1,
exhaust4
};

AddExhaustStream(th_main[1], _V(0, 0, -10), &exhaust_sec1); //line 497
(file attached - change extension to .cpp)
The particle stream effect looks good until an altitude of 100km where it starts vanishing until it reaches 113km or so and disappears completely. I can’t find where about in your code is the guy responsible for this, I am pretty sure you will know that
It could make sense to me that if ParticleStream is a function of air density, at that altitude the air density is so low that being the gas molecules so far apart from each other it would be no visible effect on the generated particles but I would like to change that to make it more realistic. (You can see it in SES-9 launch-> [ame="https://www.youtube.com/watch?v=muDPSyO7-A0"]SES-9 Full Webcast - YouTube[/ame]

2-I would like to add a sonic boom effect when reaching Mach1, I have tried to use the computerex add-on orbSonicBoom within his add-on pack (see below)
[ame="http://orbithangar.com/searchid.php?ID=3508"]Computerex Add-on Pack[/ame] (thanks computerex)
But I can’t make it work. I am supposed to create an .ini file that would contain the particle stream effects for the condensation cloud AND (I think this is where I am failing) name it with the class name of the vessel (name of the .dll module of the vessel?)

3- I would like to know what function I could use to change the colour of the meshes under certain conditions. I would like to change the colour (to red) of the M1 engine of the upper stage when firing like in the real life. This is implemented on the SpaceX launch vehicles and Dragon add-on (link below)
[ame="http://orbithangar.com/searchid.php?ID=5442"]SpaceX launch vehicles and Dragon[/ame]

4- Also done on the above add-on, could any of you tell me how to insert comments or debugging texts on the screen (like using oapiDebugString but being able to choose the position of the screen where you want to plot the text, colour/font…)

Thanks a lot for your help Orbiters!
 

Attachments

  • f9_v12_stg2.doc
    66.5 KB · Views: 6

Longjap

Active member
Joined
Jun 8, 2011
Messages
191
Reaction score
41
Points
28
PARTICLESTREAMSPEC exhaust_sec1 = { //line 432
0, 3, 10, 150, 0.01, 0.15, -0.4, 2, PARTICLESTREAMSPEC::EMISSIVE,
PARTICLESTREAMSPEC::LVL_SQRT, 0, 1,
PARTICLESTREAMSPEC::ATM_PLOG, 1e-7, 1,
exhaust4
};

AddExhaustStream(th_main[1], _V(0, 0, -10), &exhaust_sec1); //line 497
(file attached - change extension to .cpp)
The particle stream effect looks good until an altitude of 100km where it starts vanishing until it reaches 113km or so and disappears completely. I can’t find where about in your code is the guy responsible for this, I am pretty sure you will know that


These are the lines responsible
Code:
PARTICLESTREAMSPEC::LVL_SQRT, 0, 1,
PARTICLESTREAMSPEC::ATM_PLOG, 1e-7, 1,

You can use LVL_FLAT and ATM_FLAT instead of LVL_SQRT and ATM_PLOG to have a constant mapping of the stream until cut off. These values are described much more thoroughly in the API guide inside your SDK doc folder.

I'm not sure what you're trying to do. I think this behaviour is quite realistic in fact. The video shows to me the exhaust is not producing contrails. Only exhaust flames.
 

tradx

New member
Joined
Sep 6, 2016
Messages
18
Reaction score
0
Points
0
Thanks Longjap,

Thanks for that! I was aware of behaviour of the contrail due to the type of atmospheric and particle level function however I missed it completely here, my bad I should've seen that!
Anyway I have tried it using the constant params as you suggested (LVL_FLAT and ATM_FLAT) and also linear mapping LVL_PLIN and I don't get any contrail at all, I'll need to tweak it a bit more and see if I can make it work since using the same PARTICLESTREAM params in the contrail of another vessel using Vinka's spacecraft works fine.
On the other hand, I completely agree with your last comment. In reality, there is no contrail but flames coming out of the nozzle. Unfortunately, I can't think of another way of simulating these flames but to work a bit with the contrail effects (maybe giving short lifetime to particles and playing with the rest of the params). If any of you have any idea on how to simulate exhaust flames in Orbiter please let me know that would be amazing and make simulations much more realistic
 

BrianJ

Addon Developer
Addon Developer
Joined
Apr 19, 2008
Messages
1,679
Reaction score
902
Points
128
Location
Code 347
Hi tradx,
sorry I haven't got much time to help at the moment (I'm trying to avoid becoming homeless!) but....
1. What longjap said :)
2. I think OrbiterSound makes a sonic boom by default (check the OrbiterSound config screen) but you could always check when the Mach number goes from <1 to >1 and trigger a .wav (there are examples for callouts at stage sep in the code).
3. You could have a look at the Mars Cargo Dragon code, the heatshield changes colour during reentry. See SetMeshMat() in the code. You may need to chop the mesh up a bit to do this.
4. You could use CreateAnnotation(). If you want to send me your email by p.m.,I can send example code.

Good luck!
 

Longjap

Active member
Joined
Jun 8, 2011
Messages
191
Reaction score
41
Points
28
Thanks Longjap,

Thanks for that! I was aware of behaviour of the contrail due to the type of atmospheric and particle level function however I missed it completely here, my bad I should've seen that!
Anyway I have tried it using the constant params as you suggested (LVL_FLAT and ATM_FLAT) and also linear mapping LVL_PLIN and I don't get any contrail at all, I'll need to tweak it a bit more and see if I can make it work since using the same PARTICLESTREAM params in the contrail of another vessel using Vinka's spacecraft works fine.
On the other hand, I completely agree with your last comment. In reality, there is no contrail but flames coming out of the nozzle. Unfortunately, I can't think of another way of simulating these flames but to work a bit with the contrail effects (maybe giving short lifetime to particles and playing with the rest of the params). If any of you have any idea on how to simulate exhaust flames in Orbiter please let me know that would be amazing and make simulations much more realistic

No problem. :) I've been looking into animating exhaust flames as well. I'm just beginning with coding but I recognise the values from my experience with multistage2015 by Fred18.
[ame="http://www.orbithangar.com/searchid.php?ID=7010"]Multistage2015 - for Orbiter 2016[/ame]
Which I can recommend very much to begin designing or enhancing your first rocket.

Maybe it's possible to use the mesh and make the module "live" of DaveJ's falcon to preserve the great flyback features in multistage2015 and design the particle streams from inside the multistage2015 easy GUI. It also has some extra features to make the particle stream grow related to higher altitude which is even more realistic. :) To stick with coding and use the code of the growing effect to make a .dll with that you should ask Fred.

With the use of Multistage I'm not sure if this works and if you can keep the features of the falcon's flyback adjustments etc. in game. But I see no problem with it. Perhaps others can chime in if I'm wrong.

About the animating of exhaust flames, I've been trying to create the effect too. Make or use a nice flame texture to use for it. With using particle stream it will produce it as a particle and you can try to simulate an animation. You can play around with these values.

• SRCSIZE
• SRCRATE
• V0
• SRCSPREAD
• LIFETIME
• GROWTHRATE
• ATMSLOWDOWN

Short lifetime for flames, keep the source size as wide as the engine nozzle. V for speed exiting the nozzle (For me personally only useful for contrail effects). Source rate how much is produced in Hz. Heavy growth rate to widen the flames exiting if you're using cloud like flame textures.

Build a couple particle streams on top of each other to make it more complex, but well, it's up to your creativity. :tiphat:

(I'm trying to avoid becoming homeless!)

Always make that a priority! ;)
 

tradx

New member
Joined
Sep 6, 2016
Messages
18
Reaction score
0
Points
0
Thanks for your inputs BrianJ and Longjap. It's much appreciated!
 

tradx

New member
Joined
Sep 6, 2016
Messages
18
Reaction score
0
Points
0
Using oapiMeshMaterial function

3. You could have a look at the Mars Cargo Dragon code, the heatshield changes colour during reentry. See SetMeshMat() in the code. You may need to chop the mesh up a bit to do this.

Hi BrainJ and all,

Thanks for this, I have used the SetMeshMat() function within Mars Cargo Dragon code and it works just perfect!
Now the thing is that when the engine ignites, the mesh colour changes immediately. I have been trying to change gradually the colour (changing to the max red after 2 seconds for instance) using a for loop with "sleep delays" within in (I tried to thread it as well but the code is so awful I won't put the code here cause I don't want to get kicked out of the forum:lol:) and very weird things happened...Could any of you c++ experts give me a hint on how to do that?

The code I retrieved from BrinaJ's Mars Dragon and applied to this particular case is the following (working as shown without gradual implementation)

void f9_v12_stg2::SetMeshMat()
{
double red_fact = 1;

MATERIAL *mat2 = oapiMeshMaterial(hMcap, 1); //see pg 116 API_Ref

mat2->emissive.r = red_fact;

oapiSetMaterial(dhMesh2, 1, mat2); ////see pg 119 API_Ref

}

NOTE: I also changed the material and texture of the lower part of the nozzle (group mesh13) as follows:
MATERIAL 2
TEXTURE 3
...to get a nicer incandescent reddish:)
 

fred18

Addon Developer
Addon Developer
Donator
Joined
Feb 2, 2012
Messages
1,667
Reaction score
104
Points
78
With the use of Multistage I'm not sure if this works and if you can keep the features of the falcon's flyback adjustments etc. in game. But I see no problem with it. Perhaps others can chime in if I'm wrong.

It is surely possible, it's just a matter of code a proper module for the detached stage and use that instead of the default stage.dll and that's it!
 
Top