XEffects - shadows

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
badday
Posts: 102
Joined: Mon Aug 16, 2010 1:14 pm

XEffects - shadows

Post by badday »

Hi,

I´m currently trying to create shadows with XEffects, but I think I missed something as I can´t see any shadow. So here is what I do:

Code: Select all

effect = new EffectHandler(Device, Driver->getScreenSize(), true, true);
        effect->setClearColour(SColor(255, 0, 0, 0));
        effect->setAmbientColor(SColor(150, 200, 200, 200));
        E_FILTER_TYPE filterType = E_FILTER_TYPE::EFT_8PCF;
        effect->addShadowLight(SShadowLight(512, core::vector3df(0, 400, 0), core::vector3df(50, 0, 50),  irr::video::SColor(150, 255, 255, 255), 200, 500));
        effect->addShadowLight(SShadowLight(512, core::vector3df(1024, 200, 1024), core::vector3df(100, 0, 200), irr::video::SColor(100, 255, 255, 255), 200, 500, 90.0*irr::core::DEGTORAD64, true));
        effect->addShadowToNode(terrain, filterType);
        effect->addShadowToNode(model, filterType);
and in the loop:

Code: Select all

 effect->update();
Is there anything I missed?


Thanks,

badday
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: XEffects - shadows

Post by mongoose7 »

You need light.

Xeffects cannot add light to a surface. It *subtracts* light. So either create a *normal* light and use lighting, or turn off lighting on all your materials.

I can't tell you how disappointed I was when I set up my *shadow* lights expecting each to add more light.
badday
Posts: 102
Joined: Mon Aug 16, 2010 1:14 pm

Re: XEffects - shadows

Post by badday »

OK, you´re right about the light.

However, the shadows I have currently are hardly visible. What parameters have effect on this? I made two irrlicht lights, one ELT_SPOT and one ELT_DIRECTIONAL. What are those XEffects shadow lights good for?
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: XEffects - shadows

Post by mongoose7 »

Well, just forget about XEffects and create a lighted scene. Now, if you place a Shadow Light where you have a real light, it will remove the light from the real light where it would normally cast a shadow.

If you have a cube in front of a wall, and a light in front of the cube, the cube will not cast a shadow on the wall. Create a Shadow Light where the real light is and it will remove the light on the wall behind the cube. Voila, a shadow!

But I just can't help thinking, with the effort it took for this fake effect, to have used the Shadow Lights as real lights. Then we could have shadows *and* infinitely many lights.
badday
Posts: 102
Joined: Mon Aug 16, 2010 1:14 pm

Re: XEffects - shadows

Post by badday »

Well, as I use only one light, this is not that a huge problem for me, though I would still like to have a higher contrast, do you know with which parameter this can be influenced?

Thanks,

badday
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: XEffects - shadows

Post by mongoose7 »

Do you mean, in the scene, like postprocessing? Just define a RTT before calling smgr->drawAll(). You now have the output in a texture, so you can apply effects like in Photoshop while you use a shader to render it to a quad.

If you are talking about XEffects, well, all that XEffects does is calculate the area exposed by the shadow lights and "multiplies" this by the rendered scene, just like in Photoshop. So, no, you can't affect the contrast. XEffects just darkens the scene in a specific way, but it does darken it.
Post Reply