Howto:Shader programming in FlightGear: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 351: Line 351:
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.


===Program Flow Simplified===
=== Program Flow Simplified ===
Preferences/Nasal/XML >> Property Tree >> Effect File >> Shader >> Rendered to Screen
Preferences/Nasal/XML >> Property Tree >> Effect File >> Shader >> Rendered to Screen


===Preferences/Nasal/XML===
=== Preferences/Nasal/XML ===
{{Note|need link to Preferences, Nasal and XML Docs here}}
{{Note|need link to Preferences, Nasal and XML Docs here}}
Any combination of Preferences, Nasal or XML manipulates data in the property tree.  
Any combination of Preferences, Nasal or XML manipulates data in the property tree.  
Line 367: Line 367:
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.
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.


===Effects File===
=== Effects File ===
{{Note|need link to Effects Doc here}}
{{Note|need link to Effects Doc here}}
*Parameters
==== Parameters ====
Parameter entries defined in the Effect file correspond to a property tree data container (static or variable). They will contain the data needed by the shader program to perform its magic. The type of information contained in the property tree might be program control data or variable/static data that the shader program can manipulate prior to sending on to render.
Parameter entries defined in the Effect file correspond to a property tree data container (static or variable). They will contain the data needed by the shader program to perform its magic. The type of information contained in the property tree might be program control data or variable/static data that the shader program can manipulate prior to sending on to render.
In the case of ALS Lights, below is some of the data passed to, and used by, the shader.
In the case of ALS Lights, below is some of the data passed to, and used by, the shader.
Line 389: Line 389:
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.
   
   
*Shader Program
==== Shader Program ====


*Uniforms
==== Uniforms ====


===Shader Program===
=== Shader Program ===
*Uniform Input
==== Uniform Input ====


*Variable Assignments
==== Variable Assignments ====


*Main Program
==== Main Program ====




330

edits