Terrain pager
Terrain pager
Hi
I'm working on a paging terrain based on the excellent terrain class released by Copland. (http://forum.irrlicht.fr/viewtopic.php?id=336). Many thanks to him.
Pager source code
Interrest of paging are possibility to render huge world for a low cost memory.
About the terrain class : terrain is tiled in meshbuffers so only the wanted tiled are render (tweakable distance between camera and render limit) + frustum optimisation and we can use heightmap size higher than 129 (irrlicht terrain scene node default). support internally VBO (with latest irrlicht svn version) and many other features.
About the pager : It takes many parameters in entry to set up paging (load distance, render distance, mapsize, quality, scale, position, heightmap list, etc...). It organises buffer zones where to load terrain and it check if a terrain need to be load or unload depending of the load and unload distance values.
I don't use threads for loading terrain, I found that it was not necessary because it doesn't freeze on load in release mode compilation (in debug there is a freeze loading) but heightmap size need to be lower than 257 that is a very correct heightmap size (for improve more speed you could use heightmap size lower than 257 : 129 :p)
There is two texturing methods :
- 1 colormap and 1 detailmap
- possibility to use shader
I'm also working on a terrain shader for use blending textures with alphamaps and atlas texture for possibility to use more than 4 textures, but I still have some small problems so maybe on a next version :p
some screen of pager :
Red boxes are terrain loaded.
bye
I'm working on a paging terrain based on the excellent terrain class released by Copland. (http://forum.irrlicht.fr/viewtopic.php?id=336). Many thanks to him.
Pager source code
Interrest of paging are possibility to render huge world for a low cost memory.
About the terrain class : terrain is tiled in meshbuffers so only the wanted tiled are render (tweakable distance between camera and render limit) + frustum optimisation and we can use heightmap size higher than 129 (irrlicht terrain scene node default). support internally VBO (with latest irrlicht svn version) and many other features.
About the pager : It takes many parameters in entry to set up paging (load distance, render distance, mapsize, quality, scale, position, heightmap list, etc...). It organises buffer zones where to load terrain and it check if a terrain need to be load or unload depending of the load and unload distance values.
I don't use threads for loading terrain, I found that it was not necessary because it doesn't freeze on load in release mode compilation (in debug there is a freeze loading) but heightmap size need to be lower than 257 that is a very correct heightmap size (for improve more speed you could use heightmap size lower than 257 : 129 :p)
There is two texturing methods :
- 1 colormap and 1 detailmap
- possibility to use shader
I'm also working on a terrain shader for use blending textures with alphamaps and atlas texture for possibility to use more than 4 textures, but I still have some small problems so maybe on a next version :p
some screen of pager :
Red boxes are terrain loaded.
bye
Last edited by ikam on Mon Jul 21, 2008 7:35 am, edited 1 time in total.
Interesting, nice work.
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
It will be very useful, good work.
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
thnks
But you can use texturing shader like splatting or anything else like that.
I'm actually working on a texturing shader with alphamaps and texture atlas to blend more than 16 texture per terrain. It works fine but need some improvment.
No, just 1 solid texture and 1 detail texture on fixed pipeline per terrain.is it possible to use multiple textures for terrain?
But you can use texturing shader like splatting or anything else like that.
I'm actually working on a texturing shader with alphamaps and texture atlas to blend more than 16 texture per terrain. It works fine but need some improvment.
That sounds wicked.. Cant wait to see that! How's the progress with it?ikam wrote:thnks
No, just 1 solid texture and 1 detail texture on fixed pipeline per terrain.is it possible to use multiple textures for terrain?
But you can use texturing shader like splatting or anything else like that.
I'm actually working on a texturing shader with alphamaps and texture atlas to blend more than 16 texture per terrain. It works fine but need some improvment.
Edit: Forgot to mention, i do have a few problems with the terrain.. I get these weird seams (take a look at the picture I've uploaded), and sometimes when i move around the terrain, the program just crashes.
Looks awesome! What is the license on the code?
I believe I have found one issue though. I use 16-bit pngs for my heightmap. After I run your application it splits the image into multiple sections those sections are now 8-bit pngs. Would be really awesome if it maintained the quality of the image coming in.
I believe I have found one issue though. I use 16-bit pngs for my heightmap. After I run your application it splits the image into multiple sections those sections are now 8-bit pngs. Would be really awesome if it maintained the quality of the image coming in.
Jon Jones
Portfolio - needs updating
Portfolio - needs updating
Does Irrlicht use 16-bit grayscale images for heightmap creation as well as 8-bit?hybrid wrote:How do you load 16bit pngs? There's no color format for this. I guess it'd be better to use 16bit RAW images. These are properly loaded by the terrain scene node.
Jon Jones
Portfolio - needs updating
Portfolio - needs updating
-
- Posts: 208
- Joined: Sun Apr 02, 2006 9:20 pm
I may be wrong here as I haven't had time to run through the source code but as a suggestion those dark lines look like problems I had with tiling terrain objects where the normals at the X=0 Z=0 edges are not calculated or calculated correctly.
If your code has lighting on this might be the case, if supported by the object you could enable the display of normals and quickly check if they are pointing in the right direction.
If your code has lighting on this might be the case, if supported by the object you could enable the display of normals and quickly check if they are pointing in the right direction.
CRASH BUG , is in unload code, to fix crash error
comment this line in cterrainpager.cpp :
comment this line in cterrainpager.cpp :
Code: Select all
void CTerrainPager::render()
{
scene::ICameraSceneNode* cam = SceneManager->getActiveCamera();
const scene::SViewFrustum* frustum = cam->getViewFrustum();
video::IVideoDriver* Driver = SceneManager->getVideoDriver();
core::vector3df Pos = cam->getPosition();
Pos.Y = getPosition().Y;
Driver->setTransform(video::ETS_WORLD, AbsoluteTransformation);
size_t size = zoneList.size();
for (u32 i=0; i<size; i++)
{
f64 ActualDistance = zoneList[i]->getBoundingBox().getCenter().getDistanceFrom(Pos);
bool load = zoneList[i]->isLoaded();
if(ActualDistance < Param.DistanceLoad && load == false)
{
loadTerrain(i);
}
else if(ActualDistance > Param.DistanceUnload && load == true)
{
/*delete zoneList[i]->getObjectInside();
zoneList[i]->setLoaded(false);*/
}
}
}
Bennu (Best 2d and 3D dev-tool)
http://bennupack.blogspot.com
Pixtudio (Best 2D development tool)
http://pixtudiopack.blogspot.com
Bennu3D(3D Libs for bennu)
http://3dm8ee.blogspot.com/
Colombian Developers - Blog:
http://coldev.blogspot.com/
http://bennupack.blogspot.com
Pixtudio (Best 2D development tool)
http://pixtudiopack.blogspot.com
Bennu3D(3D Libs for bennu)
http://3dm8ee.blogspot.com/
Colombian Developers - Blog:
http://coldev.blogspot.com/