Terrain pager

Post those lines of code you feel like sharing or find what you require for your project here; or simply use them as tutorials.
ulao
Posts: 274
Joined: Fri Mar 28, 2008 2:13 am

Post by ulao »

Code: Select all

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 
I'm after the same thing. I was able to do this with an engine I was working with.. I used a frag shader to blend 4 textures based on weights and distance. I used it for near and far textures. With irrlicht i I cant send multiple textures to a shader, at lease I dont see how. How are you achieving this?


Ok I was able to do this with

Code: Select all

	int var0=0;    services->setPixelShaderConstant("heightMap", (float*)(&var0), 1); 
    int var1=1;    services->setPixelShaderConstant("tex1", (float*)(&var1), 1);
I that how you archived this?
tracerx
Posts: 19
Joined: Thu Feb 26, 2009 6:36 am

Post by tracerx »

Saumane wrote:
ikam wrote:thnks
is it possible to use multiple textures for terrain?
No, just 1 solid texture and 1 detail texture on fixed pipeline per 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?

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.

Image
Something in the constructor of CTerrain is causing a crash for me.
It seems to be corrupting memory and then after I cannot load any textures. I've narrowed it down to somewhere in the code after the comment //Create Meshbuffer but I'm still trying to find it. Given the lines shown above I'd guess somewhere something is off by one.

Any clues?

Update: via divide and conquer, Looks like this line is the culprit:
CTTileBuffer=new scene::SMeshBufferLightMap();

I guess I'll have to drill down into that constructor and see
why it would be causing an issue.
digoxy
Posts: 51
Joined: Wed Feb 17, 2010 3:55 pm
Location: Currently Germany.

Post by digoxy »

I have been playing around with this, downloaded the most recent version and adding any mesh to the scene seems to crash with a memory fault of some sort. Seems to happen when it destroys the map texture adjacent to the added mesh object.

Is there still work being done on this terrain engine? I would really like to use this to use my own terrain images.

- Lines in OPENGL Still appear as well, I have beat this code to death to try and figure this one out as well. It seems to be stuck to the colormap only but not positive.

UPDATE: Note, this does fix the CRASH problem!

Code: Select all

         /*delete zoneList[i]->getObjectInside(); 
Grandma-- / Grandpa --
digoxy
Posts: 51
Joined: Wed Feb 17, 2010 3:55 pm
Location: Currently Germany.

Post by digoxy »

As far as I can tell (March 2010) This is the most recent download for IrrTerrain VBO.

http://code.google.com/p/fenixpack/downloads/list

I have been working with this for a few days now, it seems very nice, a few options however, I am working very hard to understand how I can add collision to this terrain. I have several placed objects on this terrain and have not applied any gravity yet.

I have my collision meta all setup but cannot figure how to add the newly added tiles to the meta collision data. How can this be done?

Any insight into this would surely be appreciated.
Thanks
Digz..
Grandma-- / Grandpa --
leebojammin
Posts: 16
Joined: Thu Jun 15, 2006 8:45 pm

Post by leebojammin »

digoxy wrote:As far as I can tell (March 2010) This is the most recent download for IrrTerrain VBO.

http://code.google.com/p/fenixpack/downloads/list

I have been working with this for a few days now, it seems very nice, a few options however, I am working very hard to understand how I can add collision to this terrain. I have several placed objects on this terrain and have not applied any gravity yet.

I have my collision meta all setup but cannot figure how to add the newly added tiles to the meta collision data. How can this be done?

Any insight into this would surely be appreciated.
Thanks
Digz..
may I ask what your using to place your objects; can you use irredit or is this homegrown ?

are shaders working in this latest code for multitextured terrains with alpha ?

thx
leebo
freezzo
Posts: 27
Joined: Thu Mar 08, 2007 6:36 pm
Contact:

Post by freezzo »

This is awesome.

I have made a few changes to it on my end:

- Added collision detection to each "zone".
- Added multithreading to load sections in the background.
- More efficiently removes old zones from memory.

Both of these still need a little bit of work. I will post code when I'm happy with it.
ACE247
Posts: 704
Joined: Tue Mar 16, 2010 12:31 am

Post by ACE247 »

Hey nice to see that. :)
I still use the terrain pager in in my game code, so will be nice to see what you come up with.
Starterz
Posts: 27
Joined: Thu Apr 02, 2009 2:45 am

Safe deletion of node.

Post by Starterz »

Hi friends!
digoxy wrote: UPDATE: Note, this does fix the CRASH problem!

Code: Select all

         /*delete zoneList[i]->getObjectInside(); 
If we just comment this line we'll have memory overhead.
Pager MUST delete unused node (why pager is exist ?)


See the decision:

Code: Select all

void CTerrainPager::loadTerrain(u16 index)
{
	CTerrain* Terrain=new 
	.....................
	.....................
	zoneList[index]->setLoaded(true);
	zoneList[index]->setObjectInside(Terrain);

//! Add this string to decr. reference counter.
	Terrain->drop(); 

}

void CTerrainPager::render()
{
  ICameraSceneNode* cam=SceneManager->getActiveCamera();
	const SViewFrustum* frustum=cam->getViewFrustum();
	.....................
	.....................

	if(ActualDistance < Param.DistanceLoad && !load)
	{
		loadTerrain(i);
	}
	else if(ActualDistance > Param.DistanceUnload && load)
	{
//! Comment this string.
		//delete zoneList[i]->getObjectInside();

//! Now ref. counter=1(!) So object will be deleted correctly:
		zoneList[i]->getObjectInside()->remove(); 
		
		zoneList[i]->setLoaded(false);
	}
	.....................
}
kalvinorama
Posts: 10
Joined: Sat Jul 19, 2008 12:27 pm

Problem

Post by kalvinorama »

Hi everybody !


Your terrain is wonderful ! good works !


For Starterz :
I have a crash with your solution !

Somedy find how solve this problem of desallocation ?

Thanks
bigbman
Posts: 23
Joined: Thu Nov 04, 2010 6:35 am

Post by bigbman »

Does anyone else have examples/experiences they can share?

How are you guys authoring worlds using this (one at a time)? What format are you using to represent your scene graph?

Thinking about trying to use this for OpenGL 1.1 - curious if there's any dependency on Shaders with the current source.

Thanks!
Post Reply