Game Development Community

reflective objects running slowly?

by Andy Schatz · in Torque 3D Professional · 06/23/2009 (11:34 am) · 7 replies

Is it me or did reflective objects perform better about a month ago? I remember some reflectionManager code going in about the same time I saw a performance drop. In particular I've got a number of rivers in my level, though even in places where only one is visible, I seem to be getting a performance drop per river in existence.

Incidentally, there's a bug in the material editor that leaves the render target resolution at the size of the material preview, which causes the reflections to render small, which (for me) doubles fps. :)

#1
06/23/2009 (2:44 pm)
I can't say i've seen a performance drop with the reflection manager in place.

Before on every frame Torque would update reflections but each was independent of each other. So although the WaterBlock was set to updated at 64ms intervals for instance... all the WaterBlocks in the scene would update on the same frame as they didn't know to stagger their updates.

The reflection manager organizes the reflection updates so that we can ensure to properly prioritize and limit the total frame time used on reflections.

In beta 3 we've further abstracted the reflection manager to support cubemap reflections and the old planar reflections in DIFs. In Torque 3D you can have 100s of reflective objects where as in TGEA you were lucky to have 2.

For beta 4 we want to look at adjusting DTS lod in reflections so that you can more aggressively cull objects that are tiny in the final reflection textures.

Quote:Incidentally, there's a bug in the material editor that leaves the render target resolution at the size of the material preview
We noticed that ourselves... its a serious issue that we're looking into for beta 4.
#2
06/24/2009 (1:11 pm)
Partly what I don't understand is why we're rendering reflections at all when the object isn't visible. Would there be a way to keep it from updating if the object isn't visible?

I don't understand why I should see an fps increase when I delete water objects that aren't even being rendered.
#3
06/24/2009 (2:20 pm)
We're not rendering reflections on objects that are not visible.

What has happened is there is a bug in the beta 3 code.

In ReflectionManager::update() uncomment these lines:

for ( ; reflectorIter != mReflectors.end(); reflectorIter++ )
   {      
      ReflectorBase *pReflector = (*reflectorIter);

      if ( pReflector->score < 0.0f )  // UNCOMMENT ME!
         break;  // UNCOMMENT ME!
         
      pReflector->updateReflection( refparams );

      pReflector->lastUpdateMs = startOfUpdateMs;

      numUpdated++;

      if ( mTimer->getElapsedMs() > mMaxUpdateDuration ) // UNCOMMENT ME!
         break; // UNCOMMENT ME!
   }

Seems someone was testing reflection updates and checked these in commented out which would totally screw you if you had more than one reflective object in the scene.
#4
06/24/2009 (2:34 pm)
James Ford I got my eye on you 0_o :)
#5
06/24/2009 (2:38 pm)
And thanks Tom ;) I've got advanced lighting with postfx actually testable now, and basic lighting is playable on my GeForce7600. Mission accomplished.
#6
06/24/2009 (5:45 pm)
I think we have alot more mission to accomplish... but its getting there. :)
#7
06/30/2009 (3:30 pm)
This was indeed a performance issue for us in B3. Things are back to normal once this was applied. FYI for other.