Lightmap generator bug hunting

Posted on:October 07 2006

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.





Comments:


Perfect example for "it's not a bug, it's a feature".
juhut
Quote
2006-10-07 10:42:00


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


Hi niko, do you have any plan to release irrEdit on Linux too?
Giacomo Graziosi
Quote
2006-10-07 12:22:00


Good idea to remove this feature... ;-)
cmoibenlepro
Quote
2006-10-08 16:53:00


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
Quote
2006-10-08 19:11:00


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
Quote
2006-10-09 04:51:00


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


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
Quote
2006-10-09 15:55:00


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
Quote
2006-10-09 18:01:00


:) 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
Quote
2006-10-09 18:48:00


hm, I think I answered your mail. strange. I'll have a look.
niko
Quote
2006-10-09 19:43:00


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


Add comment:


Posted by:


Enter the missing letter in: "I?ternational"


Text:

 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons