I have an Ogre material script that defines 4 rendering techniques. 1 using GLSL shaders, then 3 others that just use textures of different resolutions.
I want to use the GLSL shader unconditionally if the graphics card supports it, and the other 3 textures depending on camera distance.
At the moment my script is;
material foo
{
lod_distances 1600 2000
technique shaders
{
lod_index 0
lod_index 1
lod_index 2
//various passes here
}
technique high_res {
lod_index 0
//various passes here
}
technique medium_res {
lod_index 1
//various passes here
}
technique low_res {
lod_index 2
//various passes here
}
Extra information
The Ogre manual says;
Increasing indexes denote lower levels of detail
You can (and often will) assign more than one technique to the same LOD index, what this means is that OGRE will pick the best technique of the ones listed at the same LOD index.
OGRE determines which one is 'best' by which one is listed first.
Currently, on a machine supporting the GLSL version I am using, the script behaves as follows;
- Camera > 2000 : Shader technique
- Camera >1600 <= 2000 : Medium
- Camera <= 1600 : High
If I change the lod order in shader technique to
{
lod_index 2
lod_index 1
lod_index 0
}
The behaviour becomes;
- Camera > 2000 : Low
- Camera >1600 <= 2000 : Medium
- Camera <= 1600 : Shader
implying only the latest lod_index is used.
If I change it to
lod_index 0 1 2
It shouts at me
Compiler error: fewer parameters expected in foo.material(#): lod_index only supports 1 argument
So how do I specify a technique to have 3 lod_indexes?
Duplication works;
technique shaders
{
lod_index 0
//various passes here
}
technique shaders1
{
lod_index 1
//passes repeated here
}
technique shaders2
{
lod_index 2
//passes repeated here
}
...but it's ugly.