Howto:Shader programming in FlightGear: Difference between revisions

Jump to navigation Jump to search
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.
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.
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
The list might include
*runway
*runway
Line 364: Line 366:
*water
*water


The example highlighted in this articular is was was added to model-defaut.eff
The example highlighted in this article is what was added to tree.eff to shine the lights on trees.


=== Program Flow Simplified ===
=== Program Flow Simplified ===
Line 408: Line 410:
Next comes the entry to define what Shader Program the parameters data is going to be passed to.
Next comes the entry to define what Shader Program the parameters data is going to be passed to.
  <program>
  <program>
   <fragment-shader>Shaders/model-ALS-base.frag</fragment-shader>
   <fragment-shader>Shaders/tree-ALS.frag</fragment-shader>
   <fragment-shader>Shaders/secondary_lights.frag</fragment-shader>
   <fragment-shader>Shaders/secondary_lights.frag</fragment-shader>
  </program>
  </program>
330

edits

Navigation menu