2,733
edits
Red Leader (talk | contribs) (→The grain texture and the rain effect: Some minor edits) |
Red Leader (talk | contribs) (→The exhaust flame effect: Formatting) |
||
| Line 158: | Line 158: | ||
This is a standard XML model definition that needs to specify the geometry, all animations and the effect to use. For the geometry you can use the standard ''Aircraft/Generic/Effects/Thruster/thrust_flame.ac'' or make your own. The F-15 uses a slightly different 3D model to allow for the nozzles. The 3D model needs to be big enough to contain the flame, bearing in mind that the flame is drawn as a cylinder. | This is a standard XML model definition that needs to specify the geometry, all animations and the effect to use. For the geometry you can use the standard ''Aircraft/Generic/Effects/Thruster/thrust_flame.ac'' or make your own. The F-15 uses a slightly different 3D model to allow for the nozzles. The 3D model needs to be big enough to contain the flame, bearing in mind that the flame is drawn as a cylinder. | ||
< | <syntaxhighlight lang="xml"> | ||
<?xml version="1.0"?> | <?xml version="1.0"?> | ||
<PropertyList> | <PropertyList> | ||
| Line 193: | Line 193: | ||
</PropertyList> | </PropertyList> | ||
</ | </syntaxhighlight> | ||
=== Effect definition for model === | === Effect definition for model === | ||
To define the effect to apply to the model (as referenced in the ''effect'' section in the model XML) you need to create ''my-flame.eff'' as below. The ''.eff'' file defines the parameters that are passed into the shader and it is these that control how the flame looks. | To define the effect to apply to the model (as referenced in the ''effect'' section in the model XML) you need to create ''my-flame.eff'' as below. The ''.eff'' file defines the parameters that are passed into the shader and it is these that control how the flame looks. | ||
< | <syntaxhighlight lang="xml"> | ||
<?xml version="1.0" encoding="utf-8"?> | <?xml version="1.0" encoding="utf-8"?> | ||
<PropertyList> | <PropertyList> | ||
| Line 224: | Line 224: | ||
</parameters> | </parameters> | ||
</PropertyList> | </PropertyList> | ||
</ | </syntaxhighlight> | ||
=== F-15 Afterburner example image === | === F-15 Afterburner example image === | ||
| Line 234: | Line 234: | ||
The meaning of the parameters are as follows: | The meaning of the parameters are as follows: | ||
< | <syntaxhighlight lang="xml"> | ||
<use_shocks type="int">1</use_shocks> | <use_shocks type="int">1</use_shocks> | ||
<use_noise type="int">1</use_noise> | <use_noise type="int">1</use_noise> | ||
</ | </syntaxhighlight> | ||
<syntaxhighlight lang="xml" inline><use_shocks></syntaxhighlight> and <syntaxhighlight lang="xml" inline><use_noise></syntaxhighlight> are the parameters that control the random noise and the shock diamonds. Both are modestly computationally expensive, i.e. if these effects are not required it is better to switch them off by setting these values to zero. | |||
< | <syntaxhighlight lang="xml"> | ||
<flame_color_low_r type="float">0.95</flame_color_low_r> | <flame_color_low_r type="float">0.95</flame_color_low_r> | ||
<flame_color_high_r type="float">1.0</flame_color_high_r> | <flame_color_high_r type="float">1.0</flame_color_high_r> | ||
<base_flame_r type="float">0.8</base_flame_r> | <base_flame_r type="float">0.8</base_flame_r> | ||
</ | </syntaxhighlight> | ||
(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] | (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] | ||
< | <syntaxhighlight lang="xml"> | ||
<thrust_density type="float">1.0</thrust_density> | <thrust_density type="float">1.0</thrust_density> | ||
<base_flame_density type="float">0.1</base_flame_density> | <base_flame_density type="float">0.1</base_flame_density> | ||
</ | </syntaxhighlight> | ||
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. | 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. | ||
< | <syntaxhighlight lang="xml"> | ||
<flame_radius_fraction type="float">0.8</flame_radius_fraction> | <flame_radius_fraction type="float">0.8</flame_radius_fraction> | ||
</ | </syntaxhighlight> | ||
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 | 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 | ||
< | <syntaxhighlight lang="xml"> | ||
<noise_strength type="float">0.2</noise_strength> | <noise_strength type="float">0.2</noise_strength> | ||
<noise_scale type="float">0.3</noise_scale> | <noise_scale type="float">0.3</noise_scale> | ||
</ | </syntaxhighlight> | ||
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). | 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). | ||
< | <syntaxhighlight lang="xml"> | ||
<shock_frequency>1.0</shock_frequency> | <shock_frequency>1.0</shock_frequency> | ||
</ | </syntaxhighlight> | ||
influences at what distance shock diamonds appear in the flame. Useful values are perhaps between 0.2 and 5. | influences at what distance shock diamonds appear in the flame. Useful values are perhaps between 0.2 and 5. | ||
< | <syntaxhighlight lang="xml"> | ||
<thrust_collimation type="float">0.1</thrust_collimation> | <thrust_collimation type="float">0.1</thrust_collimation> | ||
</ | </syntaxhighlight> | ||
should take a value | should take a value of between 0 and 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. | ||
< | <syntaxhighlight lang="xml"> | ||
<deflection_coeff type="float">0.</deflection_coeff> | <deflection_coeff type="float">0.</deflection_coeff> | ||
</ | </syntaxhighlight> | ||
should be somewhere between | should be somewhere between 0 and 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 | Any of those parameters can be adjusted runtime by replacing the value with <syntaxhighlight lang="xml" inline><use>/my-property</use></syntaxhighlight>. Dependent on how <code>/my-property</code> 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 | For instance the [[SpaceShuttle - Project Overview|Space Shuttle]] main engines use | ||
< | <syntaxhighlight lang="xml"> | ||
<?xml version="1.0" encoding="utf-8"?> | <?xml version="1.0" encoding="utf-8"?> | ||
| Line 317: | Line 317: | ||
</parameters> | </parameters> | ||
</PropertyList> | </PropertyList> | ||
</ | </syntaxhighlight> | ||
to simulate the change of flame geometry in the thin upper atmosphere during ascent: | to simulate the change of flame geometry in the thin upper atmosphere during ascent: | ||
| Line 326: | Line 326: | ||
Using the deflection parameter, the curved SRB separation motor flames are rendered using | Using the deflection parameter, the curved SRB separation motor flames are rendered using | ||
< | <syntaxhighlight lang="xml"> | ||
<?xml version="1.0" encoding=" | <?xml version="1.0" encoding="UTF-8"?> | ||
<PropertyList> | <PropertyList> | ||
| Line 350: | Line 350: | ||
</parameters> | </parameters> | ||
</PropertyList> | </PropertyList> | ||
</ | </syntaxhighlight> | ||
| Line 359: | Line 359: | ||
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 | 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 | ||
< | <code>/rendering/scene/diffuse/red</code> | ||
and used this to scale all color values. | and used this to scale all color values. | ||
{{note|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 == | ||