How to write a Material File

From Iris2

Jump to: navigation, search
(Import the materia-templates.material)
 
Line 1: Line 1:
-
Material Templates
+
=Editing the File=
 +
==Import the materia-templates.material==
-
// see http://www.ogre3d.org/docs/manual/manual_28.html#SEC145
+
Open a file and rename it to the name of the material in your mesh file. For example "basefloortile.material" for the "respective basefloortile.mesh".
-
// can be used by
+
Begin the file with the following file without the slashes. The slashes are normally for comments.
-
// import * from "material-templates.material"
 
-
// --------------- THESE ARE THE ATLAS STANDARD MATERIALS ----------------------
+
<pre>import * from "material-templates.material"</pre>
-
// MESH BASE MATERIAL TEMPLATE
 
-
material atlas_base
+
This will import the templates and the artist does not have to type very much.
-
{
+
==Defining the Template and Texture==
-
receive_shadows off
+
-
technique default
+
Then type this and replace the "diffuse_template" with your chosen template and "tex_basefloortile.png" with the texture which you want to use.
-
{
+
<pre>
-
pass
+
material basefloortile : diffuse_template
-
 
+
{  
-
{
+
  set_texture_alias ambient_tex tex_basefloortile.png
-
lighting on
+
  set_texture_alias diffuse_tex tex_basefloortile.png
-
 
+
-
ambient vertexcolour
+
-
 
+
-
diffuse vertexcolour
+
-
+
-
texture_unit MainTexture
+
-
{
+
-
filtering anisotropic
+
-
 
+
-
max_anisotropy 8
+
-
 
+
-
texture checker.png
+
-
 
+
-
texture_alias MainTexture
+
-
 
+
-
tex_address_mode clamp
+
-
}
+
-
}
+
-
}
+
}
}
 +
</pre>
-
// MESH BASE ALPHA MATERIAL TEMPLATE
+
Diffuse is the texture for normal light and ambient is what happens if there is no light.
-
material atlas_base_alpha : atlas_base
+
=Templates=
-
{
+
==diffuse_template==
-
technique default
+
-
{
+
For normal Tiles without transparency but still having their own shadow.
-
pass Decal
+
-
{
+
==diffuse_template_alpha==
-
lighting on
+
-
ambient vertexcolour
+
This is good for tiles with transparent textures but still having shadows.
-
diffuse vertexcolour
+
:Advantage: Does not need a lot of performance
 +
:Disadvantage Not so nice frames and is good for everything with transparency
-
alpha_rejection greater_equal 128
+
==diffuse_template_sceneblend==
-
alpha_to_coverage on
+
You can take that if the object should not have shadows but still is alpha transparent.
-
}
+
: Advantage: It has very nice frames. Good for grasses.
 +
: Disadvantage: No real "Tiefensortierung". It is only apparent if you look at it and another mesh also having sceneblend.
-
}
+
==diffuse_template_foliage==
-
}
+
For objects having models and is alpha transparent.
-
// --------------- THESE ARE THE STANDARD NON-ATLAS MATERIALS ----------------------
+
: Advantage: Object has shadows
 +
: Disadvantage: Object unfortunately does not have nice frames. Good for flowers and trees.Objekt hat nicht so schöne Ränder (geeignet für Blumen oder Bäume)
-
material diffuse_template
+
=Beware=
-
{
+
To test the meshes, material and texture by taking a look on it with the help of [http://www.ogre3d.org/tikiwiki/Ogre+Meshy Ogre Meshy]. You have to copy the "material-templates.material" in the same folder.
-
receive_shadows off
+
=Links=
-
technique default
+
[http://www.ogre3d.org/tikiwiki/Materials Tutorials]
-
 
+
-
{
+
-
 
+
-
pass Decal
+
-
 
+
-
{
+
-
lighting on
+
-
 
+
-
ambient vertexcolour
+
-
 
+
-
diffuse vertexcolour
+
-
+
-
texture_unit
+
-
 
+
-
{
+
-
filtering anisotropic
+
-
 
+
-
max_anisotropy 8
+
-
 
+
-
texture checker.png
+
-
 
+
-
texture_alias diffuse_tex
+
-
 
+
-
tex_address_mode clamp
+
-
 
+
-
}
+
-
 
+
-
}
+
-
 
+
-
}
+
-
 
+
-
}
+
-
 
+
-
// MESH BASE ALPHA MATERIAL TEMPLATE
+
-
 
+
-
material diffuse_template_alpha : diffuse_template
+
-
 
+
-
{
+
-
 
+
-
technique default
+
-
 
+
-
{
+
-
 
+
-
pass Decal
+
-
 
+
-
{
+
-
 
+
-
lighting on
+
-
 
+
-
ambient vertexcolour
+
-
 
+
-
diffuse vertexcolour
+
-
 
+
-
alpha_rejection greater_equal 128
+
-
 
+
-
alpha_to_coverage on
+
-
 
+
-
}
+
-
 
+
-
}
+
-
 
+
-
}
+
-
 
+
-
material diffuse_template_foliage : diffuse_template
+
-
 
+
-
{
+
-
 
+
-
technique default
+
-
 
+
-
{
+
-
pass Decal
+
-
{
+
-
lighting on
+
-
 
+
-
ambient vertexcolour
+
-
diffuse vertexcolour
+
-
 
+
-
cull_hardware none
+
-
cull_software none
+
-
+
-
alpha_rejection greater_equal 128
+
-
alpha_to_coverage on
+
-
 
+
-
texture_unit
+
-
{
+
-
filtering anisotropic
+
-
max_anisotropy 8
+
-
texture checker.png
+
-
texture_alias diffuse_tex
+
-
tex_address_mode wrap
+
-
}
+
-
}
+
-
}
+
-
}
+
-
 
+
-
material diffuse_template_sceneblend : diffuse_template
+
-
{
+
-
technique default
+
-
{
+
-
pass Decal
+
-
{
+
-
lighting on
+
-
 
+
-
ambient vertexcolour
+
-
diffuse vertexcolour
+
-
 
+
-
cull_hardware none
+
-
cull_software none
+
-
 
+
-
scene_blend alpha_blend
+
-
depth_write off
+
-
depth_check on
+
-
}
+
-
}
+
-
}
+

Current revision as of 16:01, 19 December 2011

Personal tools