Lights out!

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
Raumkraut
Posts: 31
Joined: Fri Aug 22, 2003 9:41 am
Location: The North, UK

Lights out!

Post by Raumkraut »

I'm still having the problem with lights - not working at all. :(
Here's the relevant bits of my code:

Code: Select all

IAnimatedMeshSceneNode* player = scene->addAnimatedMeshSceneNode (player_mesh);
...
player->setMaterialTexture (0, driver->getTexture ("textures/pointy_test.bmp"));
player->setMaterialFlag (EMF_LIGHTING, true);
player->setMaterialType (EMT_SOLID);
...
ILightSceneNode* light_base =
scene->addLightSceneNode (player, vector3df (10.0f, 0.0f, 10.0f), SColorf (1.0f, 0.2f, 0.2f), 1000.0f, -1);
...
And the light doesn't seem to have any effect, no matter what I set the various parameters to.

Interesting bug though; under Windows the scene is completely black, while under Linux there is apparently 50% ambient lighting? (the white parts of the texture are mid-grey)
[dx/x]=HUNT3R
Posts: 271
Joined: Sat Aug 23, 2003 5:52 pm
Location: Hurricane Central, Florida

Post by [dx/x]=HUNT3R »

Instead of:
ILightSceneNode* light_base = scene->addLightSceneNode (player, vector3df (10.0f, 0.0f, 10.0f), SColorf (1.0f, 0.2f, 0.2f), 1000.0f, -1);

Try this:
ILightSceneNode* light_base = device->getSceneManager()->addLightSceneNode(0, core::vector3d<float>(0,0,50), video::SColor(255, 255, 255, 255), 200.0f);

You can of course add the id value in at the end if you want and not type cast the float like I'm doing, but that doesn't matter. Try it unmodified first and see if it works. Of course, you won't see the light itself, just the light that is cast on objects. You will have to apply a texture to the light to make it look like a shiny light.
Raumkraut
Posts: 31
Joined: Fri Aug 22, 2003 9:41 am
Location: The North, UK

Post by Raumkraut »

No joy.
I tried the line as you wrote, and it made diddly difference. :(
Tried tweaking it and allsorts and still, not a sausage.
(btw scene is a pointer to the scene manager)

Is there any basic lighting stuff in any of the tutorials?


I'm still confused about the mysterious ambient lighting under linux...
niko
Site Admin
Posts: 1759
Joined: Fri Aug 22, 2003 4:44 am
Location: Vienna, Austria
Contact:

Post by niko »

Maybe your model has no or wrong normals? Is it working with a mesh from the Irrlicht SDK, for example one of the .md2 files?
Raumkraut
Posts: 31
Joined: Fri Aug 22, 2003 9:41 am
Location: The North, UK

Post by Raumkraut »

HAH!
And there's me assuming the engine's broken! ;)

Okay, here's the dealy:
I'm using Lightwave's export to .obj, then I'm using UVmapper to create the UV texture map.
I know there's some options about normals in the UVmapper options - I'll have to do some messing about with the settings.

Danke schon
niko
Site Admin
Posts: 1759
Joined: Fri Aug 22, 2003 4:44 am
Location: Vienna, Austria
Contact:

Post by niko »

Or you'll wait one or two days for Irrlicht 0.4, there is a option for creating normals for wrong exported meshes in it. :)
Raumkraut
Posts: 31
Joined: Fri Aug 22, 2003 9:41 am
Location: The North, UK

Post by Raumkraut »

Wait one or two days? Are you trippin'? I'm downloading right now! :D

Still, I'd like to know how you export obj files with normals from Lightwave, if it's possible at all...
Anyone else used LW successfully?
niko
Site Admin
Posts: 1759
Joined: Fri Aug 22, 2003 4:44 am
Location: Vienna, Austria
Contact:

Post by niko »

Raumkraut wrote:Wait one or two days? Are you trippin'? I'm downloading right now! :D
Yeah, I didn't know how fast I would be. :wink:
Post Reply