160
edits
Red Leader (talk | contribs) m (typo; add syntaxhighlight) |
(Overhaul: Remove references to reflect.eff and add information about the latest version of Fuselagereflect.eff) |
||
Line 1: | Line 1: | ||
{{stub}} | {{stub}} | ||
{{forum|47|Effects & Shaders}} | {{forum|47|Effects & Shaders}} | ||
[[File:B29 shader.jpg|thumb|270px|Reflection Shader applied to the [[Boeing B-29 Superfortress|B-29]]. It shows a shiny, high-reflective blank metal.]] | [[File:B29 shader.jpg|thumb|270px|Reflection Shader applied to the [[Boeing B-29 Superfortress|B-29]]. It shows a shiny, high-reflective blank metal.]] | ||
Line 11: | Line 6: | ||
== Reflection-Shaders - history and description == | == Reflection-Shaders - history and description == | ||
=== model-combined.eff and model-combined-deferred.eff === | |||
You have now: reflections, normalmap and specularity map, dirt, lightmaps with 4 simulated lights per object in Default and [[Project Rembrandt|Rembrandt]]. In [[Atmospheric light scattering FAQ|ALS]] you will get in addition also a grain/ rain effect and the darkmap. This shader works only on UVmapped surfaces! | |||
=== model-combined | |||
This shader inherits from [[Model-combined_effect|model-combined.eff]], an effect which should never be directly used, since it holds only the definition of the common parts of the two effects. | This shader inherits from [[Model-combined_effect|model-combined.eff]], an effect which should never be directly used, since it holds only the definition of the common parts of the two effects. | ||
The model-combined-transparent.eff has the same features but has the necessary changes to correctly support transparent objects which represents transparent surfaces like glass. | The model-combined-transparent.eff has the same features but has the necessary changes to correctly support transparent objects which represents transparent surfaces like glass. | ||
Line 35: | Line 16: | ||
All of these effects use Cubemaps and Cubecrosses from data/Aircraft/Generic/Effects which contains the image of the environment which will be visible as Reflection. Depending on which you choose, the appearance of the model will later change dramatically. | All of these effects use Cubemaps and Cubecrosses from data/Aircraft/Generic/Effects which contains the image of the environment which will be visible as Reflection. Depending on which you choose, the appearance of the model will later change dramatically. | ||
== How to implement the simple ReflectionShader: | == How to implement the simple ReflectionShader: == | ||
=== The simple and quick method === | === The simple and quick method === | ||
Inside the <tt>Aircraft/AircraftName/Models</tt> folder, there should be a main xml file, which usually is <tt>AircraftName.xml</tt>. This file should be the one holding all information on visuals used in the aircraft. As such, we need to indicate which are to be reflectable! | Inside the <tt>Aircraft/AircraftName/Models</tt> folder, there should be a main xml file, which usually is <tt>AircraftName.xml</tt>. This file should be the one holding all information on visuals used in the aircraft. As such, we need to indicate which are to be reflectable! | ||
Inside the <tt>AircraftName.xml</tt>, we need to put the following lines of code, shortly after or before other <animation> tag entries: | Inside the aircraft model configuration file (<tt>AircraftName.xml)</tt>, we need to put the following lines of code, shortly after or before other <animation> tag entries: | ||
<syntaxhighlight lang="xml"> | <syntaxhighlight lang="xml"> | ||
<nowiki><!-- REFLECTION --></nowiki> | <nowiki><!-- REFLECTION --></nowiki> | ||
Line 67: | Line 44: | ||
Note that for each <object-name> tag, you need to indicate the aircraft's objects. If you are not the original aircraft author and do not know which parts to enter, or how they are named, use the other animations tags object names which indicate the pieces you require to be reflected (such as <object-name>fuselage</object-name> is an obvious one). Obviously do not enter things which you don't want to be reflected! | Note that for each <object-name> tag, you need to indicate the aircraft's objects. If you are not the original aircraft author and do not know which parts to enter, or how they are named, use the other animations tags object names which indicate the pieces you require to be reflected (such as <object-name>fuselage</object-name> is an obvious one). Obviously do not enter things which you don't want to be reflected! | ||
This method has a few parameters to influence how the reflection appears which can be set for every livery configuration: | |||
* sim/model/civilian - a boolean to enable or disable the reflection. | |||
** Civilian aircraft are usually glossy but military aircraft are not. | |||
* sim/model/livery/shininess - a floating point value to specify the reflection factor. | |||
** The range is between -1.0 and 0.0 | |||
* sim/model/livery/fresnel - a floating point value to specify the Fresnel factor. | |||
** The range is between 0.0 and 1.0 | |||
These parameters can all be defined within a livery configuration file:<syntaxhighlight lang="xml"> | |||
<syntaxhighlight lang="xml" | |||
<PropertyList> | <PropertyList> | ||
<sim> | |||
<model> | |||
<civilian type="bool">true</civilian> | |||
<livery> | |||
<name type="string">Factory Demonstrator</name> | |||
<texture>Liveries/factory.png</texture> | |||
<shininess type="float">-0.5</shininess> | |||
<fresnel type="float">0.7</fresnel> | |||
</livery> | |||
</model> | |||
</sim> | |||
</PropertyList> | |||
</syntaxhighlight> | </syntaxhighlight> | ||
==== Adding a normal-map ==== | |||
It is also quite simple to to add a normal-map texture by expanding the section in the aircraft model configuration file:<syntaxhighlight lang="xml"> | |||
<effect> | |||
<name>Effects/normalmap-reflection</name> | |||
<inherits-from>Aircraft/Generic/Effects/Fuselagereflect</inherits-from> | |||
<object-name>fuselage</object-name> | |||
<object-name>wing</object-name> | |||
<parameters> | |||
<texture n="2"> | |||
<image>Aircraft/AircraftName/Models/normalmap.png</image> | |||
</texture> | |||
</parameters> | |||
</effect> | |||
</syntaxhighlight>To see them in sim, ensure your View > Rendering options > Effects & shaders options are checked. | |||
As an example the C160 Transall by helijah makes use of this simple method. | |||
==== Customizing the reflection shader ==== | |||
To further customize the reflection shader take a look at the [[ALS technical notes]] | |||
[[Category:Shaders]] | [[Category:Shaders]] | ||
[[Category:Aircraft enhancement|Aircraft Reflection Shader]] | [[Category:Aircraft enhancement|Aircraft Reflection Shader]] | ||
[[Category:Howto|Aircraft Reflection Shader]] | [[Category:Howto|Aircraft Reflection Shader]] |
edits