It is currently Wed Nov 22, 2017 10:30 pm

All times are UTC - 5 hours




 Page 1 of 1 [ 8 posts ] 
Author Message
 Post subject:
PostPosted: Wed May 02, 2007 6:30 am 
Site Admin

Joined: Sun Feb 11, 2007 8:59 am
Posts: 1105
Location: Ontario Canada
This new class lets you attached light sources to transform nodes in the scenegraph. This ability allows you to easily control the position & orientation of the light source when it is attached to an object in the scene. ie Headlights of a moving car.


Offline
 Profile  
 
 Post subject: Re: GameDev VMK 30 - Node Light Class
PostPosted: Wed May 02, 2007 6:36 am 
Site Admin

Joined: Sun Feb 11, 2007 8:59 am
Posts: 1105
Location: Ontario Canada
After releasing this video I found out what was the problem with the spot light attached to the cylinder. It turns out that I attached the light node in the sample at the end of the video to the wrong transform node. As a result the spot light isn't pointing down in the world, it is actually pointing in the z direction!


Offline
 Profile  
 
 Post subject:
PostPosted: Mon Feb 04, 2008 12:48 pm 

Joined: Sat Jun 23, 2007 7:56 pm
Posts: 145
I have a question on Lighting in OpenGL.
We do, 2 passes. On the 1st pass we are saving the transformation of the light node.
On the 2nd pass, we then use the saved transformation matrix and enable the light and apply its lighting.

My question is - On the first pass, the objects that are rendered (solid objects) are still shaded correctly, even though we only apply the lighting on the 2nd pass. How is this possible? (I have a feeling am not understanding something)
When does openGL shade the objects(pixels)?


Offline
 Profile  
 
 Post subject:
PostPosted: Mon Feb 04, 2008 8:48 pm 
Site Admin

Joined: Sun Feb 11, 2007 8:59 am
Posts: 1105
Location: Ontario Canada
The two render passes don't have anything to do with lighting. Lights are turned on when we call lightsEnabled() before doing the first pass. Everything that gets rendered next (both on the first and second pass) will have the correct light shading applied.

The first render pass is used to render all opaque (solid) objects.
The second render pass is used to render all translucent or partially transparent objects.


Offline
 Profile  
 
 Post subject: VMK30.Node Light. Two matrix = too much.
PostPosted: Sat Dec 20, 2008 6:53 am 

Joined: Wed Aug 06, 2008 7:53 pm
Posts: 182
Location: Russia
The only piece of code I would change in this VMK relates to the matrices. IMHO, there is no point to keep the 4x4 matrix in both places - in NodeLight and in Light. I left the (model view) matrix only inside class Light to rid of extra copying ( NodeLight::m_matrix to Light::m_matrix ).
NodeLight::Render( .. ) {

    glGetFloatv( GL_MODELVIEW_MATRIX, m_light->GetMatrix() );

//  m_light->SetMatrix( m_matrix ); // <-- YOU ARE OBSOLETE, MAN!

    :
}

inline float * Light::GetMatrix() { return m_matrix; } // returns the pointer

Light::Light() { // ctor
   :
   LoadIdentity( m_matrix );
   :
}


Not a big deal, but why not. Everything else works just fine.


Offline
 Profile  
 
 Post subject: Re: GameDev VMK 30 - Node Light Class
PostPosted: Sun Oct 02, 2011 7:46 am 

Joined: Sun Oct 02, 2011 7:20 am
Posts: 2
Hello,

after i'am doing this VMK i've got a strange problem with the headlight every time i toogle it on/off.
The engine starts with headlight on and it behaves like it should, after i toogle it off and then on, its position
seems to be wrong ( beside the player ). After a few tooglecycles it is completely out of sight.
I've triplechecked the toogle function and the LightPoint class down to the base Light class to figure it out, but
had no luck.
If i change the headlight ( first light in Scene::initialize ) to be a spotlight, like the one which
is attached to the barrel, its seems to be ok. It also seems to work if i made both lights to be
a LightPoint.
Is it a known problem or is it a bug in my brain ? :)


Offline
 Profile  
 
 Post subject: Re: GameDev VMK 30 - Node Light Class
PostPosted: Sun Oct 02, 2011 2:23 pm 
Site Admin

Joined: Sun Feb 11, 2007 8:59 am
Posts: 1105
Location: Ontario Canada
this sounds like a bug in your code, possibly somewhere around where you are handling the matrix stacks. You may be pushing something onto the stack but forgetting to pop it off thus giving you an offset that continually compounds.

I suggest you use the debugger to break your execution and monitor your light position and make sure it matches what you expect. Also check your matrix values to make sure they are correct.


Offline
 Profile  
 
 Post subject: Re: GameDev VMK 30 - Node Light Class
PostPosted: Mon Oct 03, 2011 8:21 am 

Joined: Sun Oct 02, 2011 7:20 am
Posts: 2
I have found this little ugly bug.

Cause the problem always comes up after i ve toogled the headlight off/on,
so i ve checked the LightsEnabled function and there it was.
Instead of "pLight->Render( m_iLightCounter );" i ve called
"pLight->Render( m_iLightCounter++ )" and forgot to increment it
after the if statement.

Little ugly (self-made) bugs makes the life much more liveable.


Offline
 Profile  
 
Display posts from previous:  Sort by  
 Page 1 of 1 [ 8 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Jump to:  

cron