Howto:Shader programming in FlightGear: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 391: Line 391:
=== Effects File ===
=== Effects File ===
{{Note|need link to Effects Doc here to explain the details of the effects file}}
{{Note|need link to Effects Doc here to explain the details of the effects file}}
==== 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.
Line 413: Line 414:


==== Technique ====
==== Technique ====
In general, the shader program and the uniforms are handled in between the technique tags. The technique is  
In general, the shader program and the uniforms are defined in between the technique tags. The technique is assigned an index to distinguish one technique from another (technique n="1"). As is the case with tree.eff, sometimes the shader program and its uniforms are defined and needed in more than one technique. In the case of tree.eff it is used in technique 4 and 5. Which means in [[Flightgear]], the tree shader set to either of the the highest two shader settings still produces ALS Lights when activated.
 
==== Shader Program ====
==== Shader Program ====
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.
Line 664: Line 666:


texel color - what is the base color of the pixel fully lit and unfogged
texel color - what is the base color of the pixel fully lit and unfogged
lighting - how is this color changed by the light falling onto that pixel, usually the relation is something like fragColor = texel times light
lighting - how is this color changed by the light falling onto that pixel, usually the relation is something like fragColor equals texel times light
fogging - how much is the color hidden by haze, usually the relation is something like gl_FragColor = mix(fragColor, hazeColor, transmission_factor);
fogging - how much is the color hidden by haze, usually the relation is something like gl_FragColor = mix(fragColor, hazeColor, transmission_factor);
what is displayed on the screen in the end is whatever gl_FragColor is set to
what is displayed on the screen in the end is whatever gl_FragColor is set to
330

edits

Navigation menu