Lighting problems, what am I missing?

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
Post Reply
Interrupt
Halfling
Posts: 83
Joined: Wed Jun 29, 2005 8:15 am

Lighting problems, what am I missing?

Post by Interrupt »

Things are progressing quite well in my project, but the lighting doesn't look like it should at all, the screenshots below show it. It looks like even though two models are right next to eachother, one gets lit and the other doesn't. My second problem is that none of the sprites I add get lit by lights, even if I set them to be.


Wrongly lit hallway, and sprite

More lighting errors

Is there something I can do to get Sprites to be lit by lights, and avoid the errors I'm having when lighting the models?
User avatar
Mr.Bloodworth
Halfling
Posts: 91
Joined: Fri Mar 25, 2005 3:19 am

Post by Mr.Bloodworth »

What are you using to make the scene?

BSP? If so what editor?
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 67
Contact:

Post by sinbad »

Billboards are 2D and thus have no normals, and no lighting information.
Interrupt
Halfling
Posts: 83
Joined: Wed Jun 29, 2005 8:15 am

Post by Interrupt »

The scene is being made up of seperate models that are being added into a Static Geometry object.

I'm creating it like this:

Code: Select all

StaticGeometry* sMeshes = mSceneMgr->createStaticGeometry("DungeonBlock");
sMeshes->setRegionDimensions(Vector3(2500,2500,2500));
sMeshes->setOrigin(Vector3(0,0,0));
I add a model into it by attaching it into a Scene Node:
sMeshes->addSceneNode(thisSceneNode);

Making the lights:

Code: Select all

Light* pLight = mSceneMgr->createLight(lightName);
pLight->setType( Light::LT_POINT);
pLight->setAttenuation(900, 1.0, 0.00016, 0.00000012);
pLight->setDiffuseColour(ColourValue(0.9,0.6,0,1));
Maybe that will help things.
About Billboards, what would be the best way to light them? I'd like to light them dynamically, but I could compute their color by iterating through the lights near them if nothing else.
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 67
Contact:

Post by sinbad »

The lighting errors on your static geometry are likely to be caused by incorrect normals. Easiest way to prove this is to remove the static geometry influence for the moment and just add your blocks as entities - do they get lit the same way then?

About billboards - the simplest way would be to write a vertex shader which lights the billboard based on distance rather than vertex normal. Otherwise, you pretty much are limited to calculating it yourself in code, since no choice of normal will look quite right.
Post Reply