Game Development Community

[Beta 3 Bug RESOLVED] Flickering light flare in first-person

by Bryan Morgan · in Torque 3D Professional · 06/26/2009 (2:35 pm) · 5 replies

It took me a while to notice this as I've spent much of my time using T3D with the 3rd person camera but when using a lightflare or sunflare in the 1st person camera it flickers when the player moves around the level. In the case of the sunflare after uncommenting the necessary code to enable it, the sunflare only flickers if the player is moving, but in the case of the lightflare the flare is usually completely invisible until the player starts to move and then it flickers pretty close to every other frame or two. I'm surprised nobody else has noticed this bug but I've not touched the scripts or anything which would mess it up so I'm not really sure what would cause it other then perhaps some Z-fighting which might only be occurring on my graphics card.

Hardware Specifications:
GFX: ATI Radeon HD 4800
RAM: 4GB
CPU: 3.16GHz Intel Core 2
OS: 64-bit Windows Vista

#1
06/26/2009 (5:34 pm)
Good catch - I have a fix for this.

The problem is that the raycast which tests if the light/flare should be visible is hitting the player!

So the quick fix is to modify the U32 losMask that is defined in LightFlareData.cpp line 208 by removing the PlayerObjectType.
#2
06/26/2009 (5:42 pm)
Well that is the problem but my fix did not work, I'll post back in a sec.
#3
06/26/2009 (6:03 pm)
Ok, immediately after this part in lightFlareData.cpp line 208...
U32 losMask =	STATIC_COLLISION_MASK |
                  ShapeBaseObjectType |
                  StaticTSObjectType |
                  ItemObjectType |
                  PlayerObjectType;
Add this...
GameConnection *conn = GameConnection::getConnectionToServer();
   if ( !conn )
      return;

   bool fps = conn->isFirstPerson();

   GameBase *control = conn->getControlObject();
   if ( control && fps )
      control->disableCollision();

   RayInfo rayInfo;

   if ( gClientContainer.castRayRendered( camPos, lightPos, losMask, &rayInfo ) )
      lightVisible = false;

   if ( control && fps )
      control->enableCollision();

You also need to add this include at the top...
#include "T3D/gameConnection.h"
#4
06/26/2009 (6:50 pm)
Works like a charm. It's always something simple.
#5
06/29/2009 (11:56 am)
Logged as THREED-542