Hello again,
I want to make use of Ogre's material lod system for cheaper render to texture effects. As a test I set up a material with two techniques assigning lod indices (lod_index 0 for the 'real' technique, lod_index 1 for the stripped down one). When updating the render texture, I tried to assign a lod bias value of 0.5 to the camera the render texture uses, but this had no effect.
I played with the lod bias value (trying sth. between 0.001 and 10), but there is no difference (the technique used is always the one with lod_index 0). I also tried and set up lod distances for the material, but this seems to have no effect either.
Some time ago I tried mesh lod (with autogenerated lod levels) and it worked at once...
Can anyone help me?
Getting material lod to work
-
Injector
- Gremlin
- Posts: 174
- Joined: Wed Jan 21, 2004 2:42 pm
- Location: Frankfurt, Germany
-
sinbad
- OGRE Retired Team Member

- Posts: 19269
- Joined: Sun Oct 06, 2002 11:19 pm
- Location: Guernsey, Channel Islands
- x 67
-
Injector
- Gremlin
- Posts: 174
- Joined: Wed Jan 21, 2004 2:42 pm
- Location: Frankfurt, Germany
Maybe someone can take a look at my material script. We interprete world units as cm, so the distances are 2m, 4m and 6m. The material always uses the glass_grey.tga texture, i.e. lod_index 0. So I have got no problems with the bias, but with lod in general.
Maybe I have to 'globally enable' material lod and I missed it in the docs?
Ogre silently and happily parses the file without errors.
Maybe I have to 'globally enable' material lod and I missed it in the docs?
Code: Select all
material glass_grey
{
lod_distances 200 400 600
technique
{
lod_index 0
pass
{
texture_unit
{
texture glass_grey.tga
}
}
}
technique
{
lod_index 1
pass
{
texture_unit
{
texture floor_stone_square_terracotta.tga
}
}
}
technique
{
lod_index 2
pass
{
texture_unit
{
texture backpack.tga
}
}
}
technique
{
lod_index 3
pass
{
texture_unit
{
texture fabric_wool_white.tga
}
}
}
}
-
sinbad
- OGRE Retired Team Member

- Posts: 19269
- Joined: Sun Oct 06, 2002 11:19 pm
- Location: Guernsey, Channel Islands
- x 67
Well, Entity LOD is calculated in Entity::_notifyCurrentCamera, and then used in SubEntity::getTechnique. I've tried this out in the past and it definitely worked, and I've heard from others who used it too.
This of course won't work if you're using your own custom renderables. Renderable has a getTechnique method that must take into account material LOD if it want's to use it.
This of course won't work if you're using your own custom renderables. Renderable has a getTechnique method that must take into account material LOD if it want's to use it.
-
Injector
- Gremlin
- Posts: 174
- Joined: Wed Jan 21, 2004 2:42 pm
- Location: Frankfurt, Germany