It took a lot of time to get all that crap working. Code that I had absolute faith in failed me, while code that I was certain to cause trouble worked as it should right from the start, with bugs not in core areas (although one of them was still very annoying).
By the way, the strange point of view from my last post was caused by me setting wrong values for the points the camera looks at. So what I saw what was I specified, though not what I meant.
Now the stuff that I’ve did since I got JS working. First of all, the textures for the landscape stopped working since I changed the rendering code there. The problem was that the coordinates where the texture was supposed to show up were all zero. To debug, I just set those values randomly. This gave me interesting results.
After the bug was fixed, everything looked normal again.
The next problem was “frustum culling”. This is an optimization that should make sure only those parts of the scene that are possibly visible are rendered. If this was working correctly, it should improve performance a lot, because not rendering stuff that isn’t visible is always faster than rendering stuff that isn’t visible. Of course, it did not work for me:
For testing, I changed the code so that stuff that is apparently not visible was renderd in yellow and red instead of not at all.
If you look closely, you might realize that my code wasn’t working properly at all. What was the reason for this? That I am stupid, of course. For the landscape I use so-called heightmaps. That is a grey-scale image, where the height of every pixel gives me the height at every point of the map. The distance between these points can be choosen at will, I opted for five meters (at least in this map). Sadly, I forgot to tell this to some parts of my code, so the various sectors of my map thought that they were much smaller than they actually were, even though they were rendered correctly. Now, that I’ve corrected this, everything is back to normal, although the difference with the opimization isn’t very large.
Written on May 26th, 2006 at 11:52 am