Hi!
I am experiencing this unpleasantness:
I am using irrlicht 1.8.3-2, running on archlinux, integrated intel gfx on i7.
Note that the single light is not moving. I have not attached a screen of when the character is facing downwards, because the light is on the back of it's head so we can't see it at all.
The scene node is an animated exported b3d from blender.
Any ideas? Thanks in advance.
Lighting direction changes when a node rotates
Lighting direction changes when a node rotates
Dreaming of folk-art at http://www.ambersky.cz
Re: Lighting direction changes when a node rotates
What do you use for lighing? The fixed function pipeline (aka the usual) or are you using some shader for light-calculations?
edit: If you scale the node then ensure that the material has set NormalizeNormals = true
edit2: I made a very quick test (with earth.x from media folder), but couldn't reproduce it. So if setting NormalizeNormals to true is not enough, then we need some code/models to reproduce the problem.
edit3: Also ensure it's really the rotation (rotate on of the objects where it is right now). Because from your screenshot it looks to me like the light is just very high, at center, x and slightly to the lower part of the screen - in that case all 3 models would be lighted correctly.
edit: If you scale the node then ensure that the material has set NormalizeNormals = true
edit2: I made a very quick test (with earth.x from media folder), but couldn't reproduce it. So if setting NormalizeNormals to true is not enough, then we need some code/models to reproduce the problem.
edit3: Also ensure it's really the rotation (rotate on of the objects where it is right now). Because from your screenshot it looks to me like the light is just very high, at center, x and slightly to the lower part of the screen - in that case all 3 models would be lighted correctly.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Re: Lighting direction changes when a node rotates
I am using a standard irrlicht scene light.
Also, i forgot to note that this is a series of three individual screenshots, all of the same character (same node instance), just rotated three times.
edit: normalizing normals after scaling makes no difference
Also, i forgot to note that this is a series of three individual screenshots, all of the same character (same node instance), just rotated three times.
edit: normalizing normals after scaling makes no difference
Dreaming of folk-art at http://www.ambersky.cz
Re: Lighting direction changes when a node rotates
Hm, sorry, can't tell then anything without a test-case to reproduce this. As mentioned - it worked in the quick test I coded (adding an rotation animator to the earth.x model).
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Re: Lighting direction changes when a node rotates
Could you try reproducing it with this model? (the one in the screenshot)
http://5.196.199.126/download/robot.zip
http://5.196.199.126/download/robot.zip
Dreaming of folk-art at http://www.ambersky.cz
-
- Competition winner
- Posts: 688
- Joined: Mon Sep 10, 2012 8:51 am
Re: Lighting direction changes when a node rotates
Light updtating was fixed in later versions since updateAbsolutePosition() was not performed on lights early enough for changes in transformation (as things like animators would require). Try updating to the latest version. If you insist on using the older one, updating the position and target requires:andreee wrote:I am using irrlicht 1.8.3-2, running on archlinux, integrated intel gfx on i7.
Code: Select all
ILightSceneNode* i = my_light_scene_node;
i->setRadius( i->getLightData().Radius );
edit: Wait... What kind of light are you using (point, directional, or spot)? If the light is attached to the scene node and the light is directional, then it will rotate with its parent node.
edit: Oh. Point lights are standard, I see. The position moves at least.
Re: Lighting direction changes when a node rotates
Hm, there was that problem, but if he has light and models always in the same positions it shouldn't be that I suppose. Sorry, didn't test the model yet.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
-
- Competition winner
- Posts: 688
- Joined: Mon Sep 10, 2012 8:51 am
Re: Lighting direction changes when a node rotates
Yeah, I started second-guessing myself, but I don't know what he's doing without seeing the code. And if you're not experiencing the issue and the only thing that changed for light scene nodes was that update, then where else would the problem be (at least on irrlicht's end)?
Notably, in doLightRecalc(), line 185 of CLightSceneNode causes directional lights' direction to be rotated according to its absolute transformation, which is, of course, modified by its relative rotation, which just so happens to be dependent on the node's parent's rotation.
But isn't that the expected behavior? If you put headlights (directional lights) on the front of a car, you would expect the lights to rotate with the rotation of the car, even if the car stays in the same location. Ironically, it sounds like the OP doesn't want this. He could just reset the light direction (save over it with the desired value after the rotation is performed).
Notably, in doLightRecalc(), line 185 of CLightSceneNode causes directional lights' direction to be rotated according to its absolute transformation, which is, of course, modified by its relative rotation, which just so happens to be dependent on the node's parent's rotation.
But isn't that the expected behavior? If you put headlights (directional lights) on the front of a car, you would expect the lights to rotate with the rotation of the car, even if the car stays in the same location. Ironically, it sounds like the OP doesn't want this. He could just reset the light direction (save over it with the desired value after the rotation is performed).
Re: Lighting direction changes when a node rotates
Sorry for late response.
The light node is not the child of the character node, or vice-versa.
The light node is not moving anywhere, only characterNode->setRotation and then characterNode->updateAbsolutePosition is happening.
The purpose of this light is to be attached to the camera (which it normally is, but even when, not the problem persists - i detached the light from the camera to test this)
Today I will produce a small code which demonstrates this, thank you all for your help in the meantime.
Andre
The light node is not the child of the character node, or vice-versa.
The light node is not moving anywhere, only characterNode->setRotation and then characterNode->updateAbsolutePosition is happening.
The purpose of this light is to be attached to the camera (which it normally is, but even when, not the problem persists - i detached the light from the camera to test this)
Today I will produce a small code which demonstrates this, thank you all for your help in the meantime.
Andre
Dreaming of folk-art at http://www.ambersky.cz