Game Development Community

Mip Map Madness

by Andy Hawkins · in Torque Game Engine · 08/13/2005 (6:26 pm) · 7 replies

I've noticed that the mip mapping on some objects leaves a lot to be desired.

As an example check out the HealthKit in the starter.fps

It's switches over to the higher texture map way too late and has no intermediate level of detail to interpolate from. In fact it's not interpolating, it's popping.

1) Is there anyway to make it interpolate? (DirectX does this out of the box)

2) Is there anyway to change the distance at which it switches to the original texture? I find that at the moment it changes to hires too late.

This is also noticeable on my DIF's as well. I approach a maze section from the outside and it isn't until I'm right ontop of it that it suddently POPS! up the hires textures.

Maybe this is a LOD issue as well? Any help would be appreciated :)

#1
08/13/2005 (6:48 pm)
2) Ya. It's a very small change. Look for setSmallTexturesActive in shapebase.cc (I think it was shapebase)
#2
08/13/2005 (9:14 pm)
Will be fixed in 1.4, of course.

It's not a mipmapping issue, actually; what happens is that Torque likes to swap out textures for smaller versions of themselves when it thinks you won't notice. Unfortunately, it's not quite accurate in figuring that out. ;)
#3
08/13/2005 (10:21 pm)
@Ben - so will the texture be a smooth blend in 1.4? Like will it cross sample through various mip maps across a polygon?
#4
08/14/2005 (2:31 am)
It already mips properly. Small textures is a different issue.
#5
08/14/2005 (3:32 am)
Cheers - found it. I'll hack it around (says it's a hack already) - maybe I should assign it a variable or something? Can anyone point me in the right direction to make this controllable via scripts please?

I assume I add a member to ShapeBase or TextureManager, then bind a console command to it? Sound about right?

Maybe the smart thing to do is make the range values variable, say members of ShapeBase so when it does the test below I can adjust it / override it per object.

F32 axis = (getObjBox().len_x() + getObjBox().len_y() + getObjBox().len_z()) / VALUE_A;
   F32 dist = (getRenderWorldBox().getClosestPoint(state->getCameraPosition()) - state->getCameraPosition()).len();
   if (dist != 0)
   {
      F32 projected = dglProjectRadius(dist, axis) / VALUE_B;
      if (projected < ( VALUE_C ))
      {
         TextureManager::setSmallTexturesActive(true);
      }
   }
#6
08/14/2005 (5:00 am)
I removed it altogether. Didn't see much of a difference FPS-wise. You could also set VALUE_B manually, to the range you prefer.
#7
08/14/2005 (5:23 am)
I set it to 60.0f

Seems pretty good at that range.