Lightmap generator bug hunting

To do some real world tests and improve the lightmap generator of irrEdit a bit, I modeled a small test level and placed a lot of lights into it. Unfortunately after about the 10th import of 3D data and the 20th added light, all new lights started to get 'dark' somehow. But only when using Direct Lighting, lighting without shadows had no problems. It looked like this, the light in the middle has the same brightness as the two in the background, but it influenced the scene only very subtile.

That was pretty strange. Because the level was quite huge already, and in the last 3D data import I had seen some very degenerated triangles in the geometry which I didn't create, I suspected some weired geometry to make the irrEdit collision engine (simply a collision manager optimized for raycasting) go mad. So I plugged it out and replaced it with the irrlicht buit in collision manager. The result needed some more seconds to calculate, but it was the same. Strange.
Then I reduced the test scenario by creating a new scene, importing the part of the mesh where the problem happened, placing lights at that positions and retried. The problem disappeared. Confusion. I loaded the original scene, reduced it to the same test scene by deleting not used parts but the problem still was there. More confusion.
Ok. So, why the hell didn't the light rays of that single light reach the walls? Idea: Because fortunately we are using a very flexible 3D engine under the hood and this is possible by adding only one line of code, lets just create a small white cube at the vertices of every triangle hit by the light. Just to see where the light will stop. Result:

Do you see it? All light rays stopped directly near the light! And even more strange: They form the shape of a cube! I mean, I would have understood it if the white cubes where arranged like a sphere or something similar, but a cube exactly enclosing the light? Unlikely.
And now I knew. The problem was not a bug. It was a feature of irrEdit. Stupid me. And somehow I had clicked and enabled it for that light:

In irrEdit it is possible for every object to occlude the light. And 'all objects' of course also includes lights. Which is pretty senseless, a light occluding itself makes it a bit.. ahem, dark. Shadows in irrEdit with directLighting have an adjustable opacity value, and it's at 0.8f by default, which caused that light not to be 100% dark but lighted the scene very subtile.

Conclusion: Cool, I don't even know all the features of the product I wrote myself. To prevent such a situation for users and for my stupid self in the future, and because it doesn't make a lot of sense I now disabled the possibility to enable this feature for lights.

twelve comments, already:

Perfect example for “it’s not a bug, it’s a feature”.
juhut - 07 10 06 - 10:42

Don’t you think it would be better instead of removing that feature to give a warning (which can be disabled)?
wolfgke - 07 10 06 - 12:18

Hi niko, do you have any plan to release irrEdit on Linux too?
Giacomo Graziosi () (link) - 07 10 06 - 12:22

Good idea to remove this feature… ;-)
cmoibenlepro - 08 10 06 - 16:53

I don’t know about remove, maybe just turn it off for lights by default. You never know what strange features people may want, even this.
HybridMenace () (link) - 08 10 06 - 19:11

I would go with removing that “feature” since it’s useless, confusing, and frustating (if you don’t know it exist, and you get the same “bug”...)

BTW, since Irredit is opensource, if somebody ever want to use this feature, he could always enable it himself in the source code and recompile it.
cmoibenlepro - 09 10 06 - 04:51

cmoibenlepro, irrEdit is not open source.
Ichimaru Gin - 09 10 06 - 15:29

In 3d-studio the light icon turns black when you disable a light, so you can easily see what lights are active.

It can actually be quite handy to be able to temporarily switch off lights when working in a scene (but of course there is a big difference between not emitting light and and occluding a light).
David - 09 10 06 - 15:55

IrrEdit on Linux: planned. I thought about a warning, but because the feature doesn’t make any sense, I like the disable option better. Nice idea about making the light black, btw.
niko - 09 10 06 - 18:01

:) i would like to create featured bugs too, you’re lucky :p
Irredit is open-source? Where is the code?

P.S. I mailed you some weeks ago about french community and i get no reply ???
izguit (link) - 09 10 06 - 18:48

hm, I think I answered your mail. strange. I’ll have a look.
niko - 09 10 06 - 19:43

oops, my bad.
irredit isn’t opensource (yet), only irrlicht and irrxml are.
cmoibenlepro - 09 10 06 - 23:29

Remember personal info?
Email (optional):
URL (optional):
Enter "layered" (antispam):
Comment:Emoticons / Textile

  ( Register your username / Log in )

Notify: Yes, send me email when someone replies.  

Small print: All html tags except <b> and <i> will be removed from your comment. You can make links by just typing the url or mail-address.
Note: If you type in your email adress above, it will be visible to other visitors, although it will be hidden for bots using javaScript.