Page 1 of 1

[2.1] Point/Spotlight not lighting

Posted: Mon Dec 03, 2018 3:34 pm
by gabbsson
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!

Re: [2.1] Point/Spotlight not lighting

Posted: Mon Dec 03, 2018 4:06 pm
by dark_sylinc
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)

Re: [2.1] Point/Spotlight not lighting

Posted: Mon Dec 03, 2018 4:10 pm
by gabbsson
Thank you! Didn't dawn on me to check the FAQ, sorry!