[2.1] Point/Spotlight not lighting Topic is solved

Problems building or running the engine, queries about how to use features etc.
Post Reply
gabbsson
Kobold
Posts: 39
Joined: Wed Aug 08, 2018 9:03 am
x 4

[2.1] Point/Spotlight not lighting

Post by gabbsson » Mon Dec 03, 2018 3:34 pm

Hello!

I can't seem to figure out how to use point- and spotlights. Directional works fine with zero issues.
As far as I can tell the difference should not be that big? Other than needing a position (instead of direction for point, and both for spot).

So to be clear: I have a single light in my scene, i set the type to LT_POINT (for example) and everything is black as if there was no light at all.

Here is an example of trying to set up a point light, inspired by the sample InstantRadiosty:

Code: Select all

    {
    	...
        // Create Light
        Ogre::Light* light = sm->createLight();
        Ogre::SceneNode* sunNode = sm->getRootSceneNode()->createChildSceneNode();
        sunNode->attachObject(light);
        sunNode->setDirection(Ogre::Vector3(1, 0.0f, 0.0f)); // For when it isnt a point light
        sunNode->translate(5, 0, 0);
        light->setType(Ogre::Light::LT_POINT);
        light->setPowerScale(Ogre::Math::PI / 2);
        light->setAttenuation(32.0f, 1.0f, 0.14f, 0.07f);
        ...
    }
Is there something I need other than the light?

As mentioned earlier I have tried to look through the samples but I can't figure out whats different.
I feel like I've missed something really simple, but for now I really can't see why it doesn't work. Any help would be appreciated!
0 x

User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 3949
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 172
Contact:

Re: [2.1] Point/Spotlight not lighting

Post by dark_sylinc » Mon Dec 03, 2018 4:06 pm

See I've added a Point/Spot light but it won't show up.

You most likely are missing (either one or the other):
  • A call to SceneManager::setForwardClustered
  • A compositor script that adds shadows to the point light (see ShadowMapDebugging.compositor or StaticShadowMaps.compositor; or the ShadowMapFromCode sample if you want to create it programmatically)
0 x

gabbsson
Kobold
Posts: 39
Joined: Wed Aug 08, 2018 9:03 am
x 4

Re: [2.1] Point/Spotlight not lighting

Post by gabbsson » Mon Dec 03, 2018 4:10 pm

Thank you! Didn't dawn on me to check the FAQ, sorry!
0 x

Post Reply