Lightning with directx9?

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
Dragfang
Posts: 21
Joined: Tue Mar 02, 2010 4:08 pm

Lightning with directx9?

Post by Dragfang »

So I've always been using openGL with irrlicht and it gives a good smooth lightning that slowly fades into dark.
Recently I started using directX9 instead since I found this cool water-code snippet on this forum that required directx9 instead.
Now the lightning kinda gives full 100% light with a certain reach. And after that it's completely 100% dark. How do I get smooth lightning with dx?

I found the setAmbientLight function and it helped a little with dx, but the light-points themselves still behave the same way. And somehow ambient light only worked on my terrains, not on the characters. So the characters were pitch-dark with only ambient light.

DX9 without ambient

Code: Select all

scene::ILightSceneNode* light = device->getSceneManager()->addLightSceneNode(0, core::vector3df(400,350,400),video::SColorf(1.0f,1.0f,1.0f,1.0f), 400.0f);
Image

DX9 with ambient

Code: Select all

device->getSceneManager()->setAmbientLight(video::SColorf(128, 128, 128, 1));
scene::ILightSceneNode* light = device->getSceneManager()->addLightSceneNode(0, core::vector3df(400,350,400),video::SColorf(1.0f,1.0f,1.0f,1.0f), 400.0f);
Image

OpenGL

Code: Select all

scene::ILightSceneNode* light = device->getSceneManager()->addLightSceneNode(0, core::vector3df(400,350,400),video::SColorf(1.0f,1.0f,1.0f,1.0f), 250.0f);
Image
tonic
Posts: 69
Joined: Mon Dec 10, 2007 6:18 pm
Contact:

Post by tonic »

Lights have a range which is effective only on D3D, try increasing it.

Regarding the differing attenuation, I don't know why there are differences like that between gl/d3d. I have had some similar problems in the past, not sure if it was a similar situation with yours though - but differing results between the two anyway (which were not just about the light range).
Post Reply