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 otherwise.
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 // Here it is chosing my "texture" technique instead of the shader
- Camera <= 1600 : High //
If I change the lod order in shader technique to
{
lod_index 2
lod_index 1
lod_index 0
}
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
//Shader passes here
}
technique shaders1
{
lod_index 1
//DUPLICATE of shader passses in lod 0
}
technique shaders2
{
lod_index 2
//DUPLICATE of shader passses in lod 0
}
...but it s ugly.