Spot Lights Rotation Problem

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
Post Reply
OGREHEAD
Goblin
Posts: 260
Joined: Tue Feb 02, 2010 6:25 pm
x 2

Spot Lights Rotation Problem

Post by OGREHEAD »

I am trying to get the shader jguerra made to work...
http://www.ogre3d.org/forums/viewtopic. ... ng#p355011

The shader is working OK, but I have a problem with the spot lights direction.
When I start rotating a spot light it immediately gets strange, like it jumps to some 90 degree angle.

I have created a spot light like this...

Code: Select all

Light* spotLight = sm->createLight("SpotLight");
spotLight->setDiffuseColour(1.0, 1.0, 1.0);
spotLight->setSpecularColour(1.0, 1.0, 1.0);
spotLight->setType(Ogre::Light::LT_SPOTLIGHT);
spotLight->setDirection(0, 0, -1);
spotLight->setAttenuation(5000, 1.0, 0.001, 0.0);
spotLight->setPowerScale( 1.0f );
spotLight->setSpotlightRange( Degree( 10 ), Degree( 70 ) );
SceneNode* SpotNew = sm->getRootSceneNode()->createChildSceneNode("spotNew");
SpotNew->attachObject( spotLight );
SpotNew->setPosition(Ogre::Vector3(20, 20, 20));
As soon as I rotate the spot a bit or much light jumps and still rotates around, but it is like the light direction is stuck or resets itself to a certain direction and it does not follow the rotation of the scenenode.

I rotate the spot light like this

Code: Select all

sm->getSceneNode( "spotNew" )->yaw( Radian( -0.001 ) );
What am I missing or doing wrong?
Perhaps the problem is with the shader?
Post Reply