terrain hightmap loader
-
Markus Bergqvist
terrain hightmap loader
when I load a hightmap of for example size 64x64 the terrain node does not create a mesh of 64x64 vertices, it only loads 48x48 (the last patch row and column are missing). When I load a hightmap of size 65x65 it loads all patches but crashes when recalculating LOD.
Is this a bug? If not, how should I load a 64x64 map correctly?
/Thanks
Is this a bug? If not, how should I load a 64x64 map correctly?
/Thanks
-
Markus Bergqvist
ok, i thought it would be 2^n, in the tutorial there is a 256x256 map =)
I tested to switch the tutorial hightmap with mine (65x65) and I run the compiled tutorial, TerrainRendering.exe, included with irrlicht 0.12 source and it crashes when i move the camera in to the center of the terrain. It's not the collision rutines the crashes because i dont move the camera that close and when i remove collisions in my program it crashes anyway.
I think it's something with my hightmap, or the way i created it. The way I did create it was as following: I opened the tutorial hightmap in photoshop, resized canvas to 65x65 and saved it as .bmp 32 bit. Should i do it another way?
Thanks
Here is my hightmap if you want to test it: http://www.kpforum.com/uploaded/mymap.bmp
I tested to switch the tutorial hightmap with mine (65x65) and I run the compiled tutorial, TerrainRendering.exe, included with irrlicht 0.12 source and it crashes when i move the camera in to the center of the terrain. It's not the collision rutines the crashes because i dont move the camera that close and when i remove collisions in my program it crashes anyway.
I think it's something with my hightmap, or the way i created it. The way I did create it was as following: I opened the tutorial hightmap in photoshop, resized canvas to 65x65 and saved it as .bmp 32 bit. Should i do it another way?
Thanks
Here is my hightmap if you want to test it: http://www.kpforum.com/uploaded/mymap.bmp
-
Markus Bergqvist
-
Markus Bergqvist
ah, so thats the problem, well i should have read the documents more in depth
But then I have a suggestion, if its possible, cant we get a error message insted of a crash? I surpose that the loading rutines only have to check if terrain.size == 33 && MaxLOD == 3 (of course with an algoritm that applies to all sizes but i'am not so good at math so i cant write one).
Thanks for all help!
But then I have a suggestion, if its possible, cant we get a error message insted of a crash? I surpose that the loading rutines only have to check if terrain.size == 33 && MaxLOD == 3 (of course with an algoritm that applies to all sizes but i'am not so good at math so i cant write one).
Thanks for all help!
-
pfo
- Posts: 370
- Joined: Mon Aug 29, 2005 10:54 pm
- Location: http://web.utk.edu/~pfox1
Ahha!
So that's why my app was crashing before!
Yeah, you should make a note of that in the documentation and flag an error message when LOD is not set properly.
A better idea might be for the algorithm to set maxLOD based on the dimensions of the map, and / or have the algorithm reject bad maps with an error message. Some of us know how obnoxious it is to have their app crash every 3 seconds b/c the terrain made a mistake
So that's why my app was crashing before!
Yeah, you should make a note of that in the documentation and flag an error message when LOD is not set properly.
A better idea might be for the algorithm to set maxLOD based on the dimensions of the map, and / or have the algorithm reject bad maps with an error message. Some of us know how obnoxious it is to have their app crash every 3 seconds b/c the terrain made a mistake
-
delscorcho
- Posts: 12
- Joined: Tue Aug 23, 2005 10:26 pm
Hi Spintz,
I'm having an issue that perhaps you can shed some light on. My heightmap is fairly large, 512x512. From what I read here, it needs to be 513x513. Is this correct?
Here's the bigger issue (which may be related). I'm loading my terrain fine, with 5 max LOD. I scale the terrain by 4xz, so I basically have a 2km*2km mesh (1 unit=meter). I then tried to override the LOD values so things are popping in and out so obviously.
0: 500
1: 1000
2: 2000
3: 4000
4: 6000
When I do this, I get a crash at one of the...
RenderBuffer.Vertices[VerticesToRender++] = vertices[...]
... calls. It appears as if VerticesToRender, at that point, is beyond the space available in RenderBuffer.Vertices. I'm going to try and debug it myself, but I'm curious if you've ever had this problem.
Thanks
EDIT: While on the subject, I'm making some optimizations to irrlicht, particularly by handling locked vertex buffers, in order to use DrawIndexedPrimitive instead of DrawIndexedPrimitiveUP. Have you tested this with your terrain system at all and seen any performance boosts?
I'm having an issue that perhaps you can shed some light on. My heightmap is fairly large, 512x512. From what I read here, it needs to be 513x513. Is this correct?
Here's the bigger issue (which may be related). I'm loading my terrain fine, with 5 max LOD. I scale the terrain by 4xz, so I basically have a 2km*2km mesh (1 unit=meter). I then tried to override the LOD values so things are popping in and out so obviously.
0: 500
1: 1000
2: 2000
3: 4000
4: 6000
When I do this, I get a crash at one of the...
RenderBuffer.Vertices[VerticesToRender++] = vertices[...]
... calls. It appears as if VerticesToRender, at that point, is beyond the space available in RenderBuffer.Vertices. I'm going to try and debug it myself, but I'm curious if you've ever had this problem.
Thanks
EDIT: While on the subject, I'm making some optimizations to irrlicht, particularly by handling locked vertex buffers, in order to use DrawIndexedPrimitive instead of DrawIndexedPrimitiveUP. Have you tested this with your terrain system at all and seen any performance boosts?
Hardware Vertex Buffers will be implemented someday in Irrlicht, I believe. Not putting too much thought or work into that, although it will speed up very large terrains.
Check the bug reports section, I've posted a new terrain node, that fixes that problem as well as many others. You can use Irrlicht-Spintz, until the fixes are implemented into Irrlicht baseline, or grab these files -
http://irrlicht.spintz.com/downloads/CT ... ceneNode.h
http://irrlicht.spintz.com/downloads/CT ... neNode.cpp
EDIT: Links fixed
Check the bug reports section, I've posted a new terrain node, that fixes that problem as well as many others. You can use Irrlicht-Spintz, until the fixes are implemented into Irrlicht baseline, or grab these files -
http://irrlicht.spintz.com/downloads/CT ... ceneNode.h
http://irrlicht.spintz.com/downloads/CT ... neNode.cpp
EDIT: Links fixed
Last edited by Spintz on Wed Sep 21, 2005 4:18 am, edited 1 time in total.
