Changes

Jump to: navigation, search

Howto:Shader programming in FlightGear

329 bytes added, 05:40, 13 October 2014
no edit summary
== ALS Landing Lights - Spotlight ==
[[File:als secondary lightALS Secondary Light Proof of Concept.png|640px|thumbnail320px|ALS Secondary Light Proof of Concept]]The ALS Landing Lights-Spotlight (we'll call it ALS Lights from now on) is a good example for showing how to incorporate a shader effect into [[Flightgear]] as it touches many parts of the visuals we see and many parts of the coding pipeline.
In the case of ALS Lights, you have to add the effect to every visual item rendered on the screen that you want to see a light shining on. If you want it to be capable of shining on everything, you have to account for each separate item and how that item is rendered. That is a lot of code to touch.
They show up in the Property Tree under sim/rendering/als-secondary-lights and can be activated or manipulated by normal Nasal calls or XML.
[[File:als_secondary_lights_fog.jpg|1024px|thumbnail|ALS Landing Lights combined with Fog Effect]]
=== Effects File ===
{{Note|need link to Effects Doc here to explain the details of the effects file}}
</uniform></small>
Note the name, "use_searchlight", which was originally defined in preferences.xml and then became an entry in parameters is now being passed to the program shader by the uniform. Below in the "Shader Program" section, we will show you how the shader receives the uniform's data.
 
[[File:Als Secondary Lights combined with Fog Effect.jpg|1024px|Weather settings to produce fog and ALS Landing Lights on a runway.]]
=== Shader Programs ===
else return vec3 (0.0,0.0,0.0);
}
 
[[File:Model on Water and Trees on Land.jpg|thumb|Model on Water and Trees on Land ALS Lights Effect]]
=== tree-ALS.frag ===
Note how "use_searchlight" is used in the main function to determine if the property defined in preferences.xml and manipulated in the property tree is set to true or 1.
Some of the variable data contained in the shader program is used for other purposes and is introduced into the shader program from other property, parameter and uniform definitions not pertaining to ALS Lights.
 
[[File:Model on Water.jpg|thumb|ALS Lights Effect over model and water.]]
==== File List ====
*** fragment water-ALS-high.frag & secondary_lights.frag
** adds uniforms (technique 2)
 
[[File:ALS Lights over Model and Terrain.jpg|640px|ALS Lights over Model and Terrain]]
== General Comments from Forum Discussion ==
258
edits

Navigation menu