1,360
edits
Line 153: | Line 153: | ||
</source> | </source> | ||
Then, a derived effect (my-flame.eff in the above example) has to be created. Here the parameters for the flame are specified. For instance, | |||
<source> | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<PropertyList> | |||
<name>AB-flame</name> | |||
<inherits-from>Effects/thrust-flame</inherits-from> | |||
<parameters> | |||
<flame_color_low_r type="float">0.95</flame_color_low_r> | |||
<flame_color_low_g type="float">0.55</flame_color_low_g> | |||
<flame_color_low_b type="float">0.1</flame_color_low_b> | |||
<flame_color_high_r type="float">1.0</flame_color_high_r> | |||
<flame_color_high_g type="float">1.0</flame_color_high_g> | |||
<flame_color_high_b type="float">1.0</flame_color_high_b> | |||
<use_shocks type="int">1</use_shocks> | |||
<use_noise type="int">1</use_noise> | |||
<thrust_collimation type="float">0.1</thrust_collimation> | |||
<thrust_density type="float">1.0</thrust_density> | |||
<base_flame_density type="float">0.1</base_flame_density> | |||
<noise_strength type="float">0.2</noise_strength> | |||
<noise_scale type="float">0.3</noise_scale> | |||
<deflection_coeff type="float">0.</deflection_coeff> | |||
<flame_radius_fraction type="float">0.8</flame_radius_fraction> | |||
</parameters> | |||
</PropertyList> | |||
</source> | |||
creates the F-15 afterburner flame shown below: | |||
[[File:Flame_f15.jpg|700px|F-15 afterburner flames]] | |||
The meaning of the parameter is as follows: | |||
<source> | |||
<use_shocks type="int">1</use_shocks> | |||
<use_noise type="int">1</use_noise> | |||
</source> | |||
are configuration parameters determining whether random noise should be used for the flame and whether shock diamonds should be rendered. Both are modestly expensive, i.e. if they're not used it's better to switch them off (i.e. set to zero). | |||
<source> | |||
<flame_color_low_r type="float">0.95</flame_color_low_r> | |||
<flame_color_high_r type="float">1.0</flame_color_high_r> | |||
<base_flame_r type="float">0.8</base_flame_r> | |||
</source> | |||
(same for the (g,b) channels) set the color. base_flame refers to the part of the flame which is directly attached to the thruster and usually brightest. flame_color_high refers to the high density part of the flame, flame_color_low refers to the low density parts of the flame. (rgb) values always need to be [0:1] | |||
<source> | |||
<thrust_density type="float">1.0</thrust_density> | |||
<base_flame_density type="float">0.1</base_flame_density> | |||
</source> | |||
determine the overall emitter density in the flame and in the base directly at the thruster respectively. There's no formal upper limit for the parameters, but a flame with density 1 already appears fairly opaque. | |||
<source> | |||
<flame_radius_fraction type="float">0.8</flame_radius_fraction> | |||
</source> | |||
governs how much of the bounding box the flame radius at the exhaust nozzle fills. If the flame needs to expand (as for the plume of a thruster operating in vacuum) or needs to bend (as for a flame deflected by the airstream) this parameter needs to be small, if the flame is essentially cylindrical the paramater can be chosen close to 1 to minimize clipping errors. Note that this determines the size of the flame relative to the bounding box - the overall size of the flame should be adjusted by using a scale animation on the bounding box | |||
<source> | |||
<noise_strength type="float">0.2</noise_strength> | |||
<noise_scale type="float">0.3</noise_scale> | |||
</source> | |||
determined how turbulent the flame looks. noise_strength [0:1] determines how prominently the noise influences the flame and noise_scale (in meters relative to the original bounding box) determines how large the visible patches of turbulence are (given that the original bounding box is not larger than 5 m in the longest direction, the parameter should probably kept between 0.1 and 5). | |||
<source> | |||
<shock_frequency>1.0</shock_frequency> | |||
</source> | |||
influences at what distance shock diamonds appear in the flame. Useful values are perhaps between 0.2 and 5. | |||
<source> | |||
<thrust_collimation type="float">0.1</thrust_collimation> | |||
</source> | |||
should take a value [0:1] and determines how collimated the flame is. For values > 0, the flame is widened - note that this requires a sufficiently small flame radius fraction to avoid clipping errors. For widened flames, the density is automatically lowered and shock diamonds are removed. | |||
<source> | |||
<deflection_coeff type="float">0.</deflection_coeff> | |||
</source> | |||
should be somewhere between [0:0.06] and gives a lateral deflection (such as by an airstream) to the flame. Note that this re-positions the origin of the flame in the bounding box to better utilize the bounding box volume, i.e. if you need a dynamical deflection, you also need a translate animation for the bounding box. | |||
Any of those parameters can be adjusted runtime by replacing the value with <b><use>/my-property</use></b>. Dependent on how /my-property is created it might be tied though (in particular JSBSim-computed properties are) in which case it is not picked up by the effect framework - you need to copy it via property rule to an untied property then. This allows to render dynamical changes of the flame. | |||
For instance the [[SpaceShuttle - Project Overview|Space Shuttle]] main engines use | |||
<source> | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<PropertyList> | |||
<name>ssme-flame</name> | |||
<inherits-from>Effects/thrust-flame</inherits-from> | |||
<parameters> | |||
<flame_color_low_r>0.9</flame_color_low_r> | |||
<flame_color_low_g>0.7</flame_color_low_g> | |||
<flame_color_low_b>0.5</flame_color_low_b> | |||
<flame_color_high_r>0.7</flame_color_high_r> | |||
<flame_color_high_g>0.7</flame_color_high_g> | |||
<flame_color_high_b>1.0</flame_color_high_b> | |||
<base_flame_r type="float">0.8</base_flame_r> | |||
<base_flame_g type="float">1.0</base_flame_g> | |||
<base_flame_b type="float">1.0</base_flame_b> | |||
<use_shocks type="int">1</use_shocks> | |||
<use_noise type="int">1</use_noise> | |||
<thrust_collimation><use>/sim/systems/various/ssme-flame-collimation</use></thrust_collimation> | |||
<thrust_density><use>/sim/systems/various/ssme-flame-density</use></thrust_density> | |||
<base_flame_density type="float">1.0</base_flame_density> | |||
<shock_frequency>1.0</shock_frequency> | |||
<noise_strength>0.3</noise_strength> | |||
<noise_scale>0.1</noise_scale> | |||
</parameters> | |||
</PropertyList> | |||
</source> | |||
to simulate the change of flame geometry in the thin upper atmosphere during ascent: | |||
[[File:Shuttle flame05.jpg|400px|Space Shuttle main engine flames during early ascent]] | [[File:Shuttle flame05.jpg|400px|Space Shuttle main engine flames during early ascent]] | ||
[[File:Shuttle flame06.jpg|400px|Space Shuttle main engine flames during late ascent]] | [[File:Shuttle flame06.jpg|400px|Space Shuttle main engine flames during late ascent]] | ||
Using the deflection parameter, the curved SRB separation motor flames are rendered using | |||
<source> | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<PropertyList> | |||
<name>SRBsep-flame</name> | |||
<inherits-from>Effects/thrust-flame</inherits-from> | |||
<parameters> | |||
<flame_color_low_r type="float">0.95</flame_color_low_r> | |||
<flame_color_low_g type="float">0.55</flame_color_low_g> | |||
<flame_color_low_b type="float">0.1</flame_color_low_b> | |||
<flame_color_high_r type="float">1.0</flame_color_high_r> | |||
<flame_color_high_g type="float">1.0</flame_color_high_g> | |||
<flame_color_high_b type="float">1.0</flame_color_high_b> | |||
<use_shocks type="int">0</use_shocks> | |||
<use_noise type="int">1</use_noise> | |||
<thrust_collimation type="float">0.4</thrust_collimation> | |||
<thrust_density type="float">1.0</thrust_density> | |||
<base_flame_density type="float">0.0</base_flame_density> | |||
<noise_strength type="float">0.7</noise_strength> | |||
<noise_scale type="float">0.4</noise_scale> | |||
<deflection_coeff type="float">-0.06</deflection_coeff> | |||
<flame_radius_fraction type="float">0.1</flame_radius_fraction> | |||
</parameters> | |||
</PropertyList> | |||
</source> | |||
[[File:Flame_sep.jpg|700px|Space Shuttle SRB separation motor flames]] | [[File:Flame_sep.jpg|700px|Space Shuttle SRB separation motor flames]] | ||
Application of the effect is not limited to flames, it can also do heat blur (think a very transparent, high-noise dark emitter distribution) or vapour trails and other smoke. | |||
By itself, the effect does however not compute ambient and diffuse light channels, i.e. for non-emissive distributions lighting is the responsibility of the user. One quick way of obtaining a correct fading of color with light in the scene is to create an untied property based on | |||
<source>/rendering/scene/diffuse/red</source> | |||
and used this to scale all color values. | |||
<b>Important note:</b> Do not use the full (rgb) information in the property tree for ALS, it will produce pronounced color mismatches with the rest of the scene as ALS determines light inside the shader and never uses the properties. | |||
== ALS glass effect == | == ALS glass effect == |
edits