Lightning problem

Grab your favourite IDE and tinker with the innards of game engines

Lightning problem

Postby haraldsegliens on Fri Jun 24, 2011 7:09 am

Hello

The problem is that the dynamic light doesn't light brush entities, but it lights only model entities.

The code where the lighting is:

Code: Select all
int C_FireBall::DrawModel( int flags )
{
   if ( gpGlobals->frametime > 0.0f && !m_bUpdated)
   {
      m_bUpdated = true;
      m_vecLastOrigin = GetAbsOrigin();
   }
   pEffect->StartEmission();
   pEffect->StartRender(VMatrix(Vector(0,0,0),Vector(0,0,0),Vector(0,0,0)));//x,y,z

   if ( m_bLight )
   {
      dlight_t *dl = effects->CL_AllocDlight( index );
      dl->origin = m_vecLastOrigin // moving orgin;
      dl->radius = fire_lightradius.GetInt()//it's 2000;
      dl->decay = dl->radius / 0.05f;
      dl->color.r = 255;
      dl->color.g = 192;
      dl->color.b = 64;

      dlight_t *el= effects->CL_AllocElight( index );

      el->origin = m_vecLastOrigin;
      el->color.r = 255;
      el->color.r = 255;
      el->color.g = 192;
      el->color.b = 64;   
      el->radius = fire_lightradius.GetInt();
   }
   return 1;
}


Please help me. :(
haraldsegliens
Just Joined
Just Joined
 
Joined: Sat Apr 09, 2011 6:15 am

Re: Lightning problem

Postby gladers on Tue Jun 28, 2011 12:24 pm

You could add a very small model to the world, change its alpha color so that its invisible and set the dlight on that model and then adjusts its possition to match the fireball.

Ive experimented with the d-lights, its a performance drain. I didnt notice it on my i7 dev machine but the testers would experience massive fps drop.
Its also bleeds through walls and floors, they are really not worth it in my opinion. They use up lots of your precious development time and cause lots of frustration :)
gladers
Member
Member
 
Joined: Sat Feb 27, 2010 2:53 pm

Re: Lightning problem

Postby Gary on Tue Jun 28, 2011 4:50 pm

We need some deferred shading, I'm pretty sure that's what the UDK uses and it says it can support hundreds of dynamic lights.(Not shadow casting which I think requires the forward rendering approach)
Have a question related to modding or something I posted? Something that needs staff attention? I haven't been active lately, but feel free to PM me or message me on Steam(link below)

User avatar
Gary
Interlopers Staff
Interlopers Staff
 
Joined: Wed Dec 16, 2009 12:40 am
Location: USA, FL

Re: Lightning problem

Postby Sorrow on Wed Jun 29, 2011 12:09 pm

Trust me when I say you do not want "hundreds" of dynamic lights in UDK.

CryEngine 2 has deferred lighting.
User avatar
Sorrow
Veteran
Veteran
 
Joined: Sat Apr 29, 2006 2:36 pm
Location: The Netherlands

Re: Lightning problem

Postby Gary on Wed Jun 29, 2011 4:21 pm

Incorrect: http://udn.epicgames.com/Three/DeferredShadingDX11.html
Though, hundreds was not completely true. As that demo had 123 dynamic lights.


Also, you mean CryEngine 3. [Crysis = CE2] [Crysis 2 = CE3]
Have a question related to modding or something I posted? Something that needs staff attention? I haven't been active lately, but feel free to PM me or message me on Steam(link below)

User avatar
Gary
Interlopers Staff
Interlopers Staff
 
Joined: Wed Dec 16, 2009 12:40 am
Location: USA, FL

Return to Programming

Who is online

Users browsing this forum: No registered users