Howto:Shader programming in FlightGear: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 350: Line 350:
[[File:als secondary light.png|640px|thumbnail|Proof of Concept]]
[[File:als secondary light.png|640px|thumbnail|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.
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.
You have  ALS Lights effect you have to 
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.
The list might include
*runway
*terrain
*models
**ai
**aircraft
**tree
*weather
**fog
**clouds
**hazes
*water
The example highlighted in this articular is was was added to model-defaut.eff


=== Program Flow Simplified ===
=== Program Flow Simplified ===
Line 388: Line 404:


Some of this data may play a duel role inside the shader program. In other words it might be used to control other functions in addition to ALS Lights.
Some of this data may play a duel role inside the shader program. In other words it might be used to control other functions in addition to ALS Lights.
There will also be other parameter entries that have nothing to do with ALS Lights. They might be used for other actions or effects the shader is handling.
   
   
==== Shader Program ====
==== Shader Program ====
Next comes the entry to define what Shader Program the parameters data is going to be passed to.
<program>
  <fragment-shader>Shaders/model-ALS-base.frag</fragment-shader>
  <fragment-shader>Shaders/secondary_lights.frag</fragment-shader>
</program>


==== Uniforms ====
==== Uniforms ====
330

edits