Statement for including common shader code from the external
that is separated into different sections. This way functions
or variable declaration shared by all shaders are placed in an external file.
The file default.fx contains
often-used shader variables and functions for lighting, fog, and transformations.
Statement for including code from an external file. The file name must end with ".fx" and contain the relative or absolute path to the file.
You can copy the default.fx file into your work folder
and modify it if desired. It is a customizable script. For defining a
new section in the default.fx file,
enter a section comment tag, like "//section:
sectionname". The "#include
<sectionname>" statement will then include this section
in the shader code, up to the next section. The following include sections
are currently available:
- <transform> - contains the DoTransform function
for transforming and projecting vertex coordinates.
- <sun> - contains the DoSun function for adding sun light.
- <light> - contains the DoLight function for adding dynamic lights.
- <fog> - contains the DoFog function for adding fog.
- <pos> - contains the DoPos function for transforming
the vertex position to world coordinates.
- <normal> - contains the DoNormal function for transforming
the vertex normal orientation to world coordinates.
<view> - contains the DoView function for transforming
a vertex position to view space.
<tangent> - contains CreateTangents for creating a tangent
matrix, and DoTangent for converting a vector to tangent space.
- <vecskill> - set vecSkill41 to default values from the entity skills1..4.
- <bump_vs> - a standard bumpmapping function for two lights.
for shaders with included sections can be found in the
Although the common code will make shader programming easier, understanding
shader code is still required.
Example (shader code)
out.Pos = DoTransform(in.Pos);
out.Fog = DoFog(in.Pos);
MATERIAL, shaders, effect