Jump to: navigation, search

Howto:Shader programming in FlightGear

925 bytes added, 21:22, 12 October 2014
no edit summary
The ALS Landing Lights/Spotlight 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.
===Program Flow Simplified===
Preferences/Nasal/XML >> Property Tree >> Effect File >> Shader >> Rendered to Screen
===Preferences/Nasal/XML===Any combination of Preferences, Nasal or XML manipulates data in the property tree. In this case the switch to turn on the landing or spot light and a couple other needed data containers are defined in $FG_ROOT/preferences.xml with the following lines. <als-secondary-lights> <use-searchlight type="bool">false</use-searchlight> <use-landing-light type="bool">false</use-landing-light> <use-alt-landing-light type="bool">false</use-alt-landing-light> <landing-light1-offset-deg type="float">0.0</landing-light1-offset-deg> <landing-light2-offset-deg type="float">0.0</landing-light2-offset-deg> </als-secondary-lights> ===Effects File==={{Note|add pipeline flow need link to Effects Doc here}}*ParametersParameters *Shader Program *Uniforms ===Shader Program===*Uniform Input *Variable Assignments *Main Program
*** fragment water-ALS-high.frag & secondary_lights.frag
** adds uniforms (technique 2)

Navigation menu