I ran into an issue with terrain heightmaps. I'm using the official 1.5 release. I have made no changes or even recompiled it. One edge of the terrain is always distorted. It doesn't matter what size the heightmap is. I tried 129, 128 and even the default heightmap that comes with Irrlicht (You can see an error in one of the corners). You can easily reproduce this error by making the heightmap a single solid color.
256x256
129x129
Hope this helps.
[fixed] Terrain heightmap bug in 1.5
-
- Admin
- Posts: 3590
- Joined: Mon Oct 09, 2006 9:36 am
- Location: Scotland - gonnae no slag aff mah Engleesh
- Contact:
I can't replicate this in the latest 1.5 branch source. Perhaps hybrid has already fixed it?
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Wasn't there a bug a while back that made the side of the map average between the height given on the previous indice and 0? I think it had something to do with maps that were too big or something similar. Might want to check there. If not, maybe finding that fix will give you a lead, as the deformation seems strangely similar to the one seen then.
Yes, I'll do the search in a second, but why would this happen? I mean, it's all standard .. the 1.5 release, running the example without any changes. I tried the official 1.4.2 release with the same plain heightmap and it works fine. So it must be something between these releases .. it can't be just me, can it?
I found a fix to the problem.
In CTerrainSceneNode::loadHeightMap I had to replace
with
Now all heightmaps work as they are supposed to. I makes sense because when using 129x129 heightmap eg., it would try to read a pixel 129 when x is 0 and since it doesn't exist, it reads it as 0.
In CTerrainSceneNode::loadHeightMap I had to replace
Code: Select all
vertex.Pos.Y = (f32) heightMap->getPixel(TerrainData.Size-x,z).getLuminance();
Code: Select all
vertex.Pos.Y = (f32) heightMap->getPixel((TerrainData.Size-1)-x,z).getLuminance();
-
- Admin
- Posts: 3590
- Joined: Mon Oct 09, 2006 9:36 am
- Location: Scotland - gonnae no slag aff mah Engleesh
- Contact:
Super, thanks very much for looking into this. I'll give that a try. Tracking.
Damn, hybrid beat me to it! Curse my 12-year-old-single-malt addled reflexes.
Damn, hybrid beat me to it! Curse my 12-year-old-single-malt addled reflexes.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way