Vegetation Maps || Just a thought

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Guest

Vegetation Maps || Just a thought

Post by Guest »

Hi!
I wonder if it would be possible to use some sort of "vegetation maps" in irrlicht. i´ll explain what i mean:

we create a heightmap for terrain, lets say 128x128.
now we create a vegetationmap for that terrain, also 128x128.
now what is the vegetation map good for?
the color is 0,0,0 black. now were you want to have some sort of plants or grass you have to place a pixel with a color for it.(e.g. 1,1,1).
so far ok? we have a heightmap and a vegetation map which includes a black image with lots of 1,1,1 rgb pixels which should be replaced by models or billboards later :)

this is how i thought to make it work:

1. the vegetation map is a additional texure of the terrain. lets say texture3.
2. now scan the terrain.texture3 if there are any pixels with the color 1,1,1.
3. if found some pixels like that, create a billboard at this position.
4. repeat this until all pixels (128x128) are checked.

is this somehow possible? if yes i would like to try something like that, it would be a really great addition because its much easier to plant trees,grass,plants or anything else on the terrain like this. any comments or suggestions are welcome :)
Robomaniac
Posts: 602
Joined: Sat Aug 23, 2003 2:03 am
Location: Pottstown, PA
Contact:

Post by Robomaniac »

1) Yes, its possible to do it this way, i plan on doing so for cf.

A rgb or greyscale map with different values representing different types and/or different thicknesses.

This is the same technique used in BF:Vietnam

2) IT SHOULDN"T BE IMPLEMENTED INTO THE ENGINE

It should be implemented as a plugin type system, where you can just drop the class into ur project. Adding everything like this into the enigne would make the engine as bloated as a dead whale left to rot in the sun.

If u need it, u download it, implement it, and bamboozle :)
The Robomaniac
Project Head / Lead Programmer
Centaur Force
Guest

Post by Guest »

hmm... ok if you already thought about doing something like this maybe i shouldnt start making one too. because i guess youre a much experienced programmer then i am :wink: i agree with you about to not implement this into the engine, a plugin would to it. hmmm... ok the hell with it i guess i will try it the next few days :roll: it cant be so hard to make (if you think about it is a really easy way how to make this i guess).

ps: i dont even now how to scan or trace right now *lol* ok i guess i need to experience the irrlicht api a bit before i go for it :)
Robomaniac
Posts: 602
Joined: Sat Aug 23, 2003 2:03 am
Location: Pottstown, PA
Contact:

Post by Robomaniac »

Make ur own, when i finally make mine, its going to be in ogre, using some pretty spiffy stuff :)

Not that an irrlicht port would be impossible ;)
The Robomaniac
Project Head / Lead Programmer
Centaur Force
Guest

Post by Guest »

ok scanning the vegetation map works now 8) now i have to program a function that sets the entity in on the terrain based on the vegetationmap pixels. i think its ready to use soon :) i will release the code then to the irrlicht community if you want
erSitzt
Posts: 52
Joined: Sun May 09, 2004 11:59 am

Post by erSitzt »

I think this approach will look a little ugly when you have to scale your terrain, because all your plants will reside on the vertexes of the terrain.
I would prefer to specify regions with that vegetationmap (using colors) for certain plants and randomize their positions a little. I think that would look a little more 'natural'.
Hardwarespecs in signatures suck !
Midnight
Posts: 1772
Joined: Fri Jul 02, 2004 2:37 pm
Location: Wonderland

Post by Midnight »

at this point there isn't much that "should" be added to the core of irrlicht every additional ability should be a seperate entity with only a few exceptions.

ANYTHING is possable... it's a question of feasability.
afecelis
Admin
Posts: 3075
Joined: Sun Feb 22, 2004 10:44 pm
Location: Colombia
Contact:

Post by afecelis »

I'd love to see it in action GFX. Plz keep us updated!!

I guess you'll be having problems with the rotation of billboards, in case you want to simulate trees by copying-rotating the billboard several times in 360 degrees. Dunno if those bugs have been fixed. But at least it will work for grass and perhaps bushes, although it's also weird to see vegetation grow only in one direction.

let us know if you run into any of this.

:D
Image
brc-not-logged

Post by brc-not-logged »

You may want to look into using axial billboards instead of just billboards..implement in IrrlichtNX ( www.irrlichtnx.mmdevel.de ). Keep us posted!!
erSitzt
Posts: 52
Joined: Sun May 09, 2004 11:59 am

Post by erSitzt »

How do you position your plants (height) ? Are you using the heightmap of the terrain to get the position for the plants ?

Im asking because i think the TerrainSceneNode is lacking a getHeight(X,Z) function ...
Hardwarespecs in signatures suck !
Guest

Post by Guest »

i have irrlichtnx so i will try to use axial billboards. iam trying right now to get the vegetation on the right place of the terrain (i guess this is the hardest part :) ), the rest shouldnt be too hard to make.
i would use the vegetation like this:
grass = sprites (billboards)
bushes = models or many rotated sprites
trees = models because sprite trees dont look so good

maybe i should randomize the position of the entitys a little? because of erSitzt´s post :) but that would mean that if you start your level the entitys have to be placed somewhere else again, so this isnt good at all. or adding a variable so that you can choose between random placement and not.

but i hope that the script wont be so slow (placing so much entitys and trace them on the terrain). the pixel checking of the colormap goes really fast. if i have anything new i post it here. i also have to comment everything before posting the code i guess (for better understanding).

ps: sorry for my bad english :roll:

edit:

@erSitzt
i thought of getting the distance between the terrain and the entity and substract that from the entity height so that it is placed right on the terrain. (i found at least 2 functions in the api: getDistanceFrom();
getDistanceTo(); maybe these are usefull )
Robomaniac
Posts: 602
Joined: Sat Aug 23, 2003 2:03 am
Location: Pottstown, PA
Contact:

Post by Robomaniac »

Some things you might want to concider

Generally, placing a lot of nodes into the list causes major slowdowns in processing time. Try grouping all the geometry into 1 mesh at runtime. Take all the geoms and form one mesh, then add that to a scene node. I'm not sure whether this'll work well in irrlicht though, b/c of the design of the scene node structure

Also, maybe try imposters. Basically, after a certain point, change the mesh to a billboard (in the distance). Saves tris for something so far away, its a waste to draw the full model.
The Robomaniac
Project Head / Lead Programmer
Centaur Force
erSitzt
Posts: 52
Joined: Sun May 09, 2004 11:59 am

Post by erSitzt »

grouping is a good idea... at least for grass/flowers and brushes. I want my trees to fall if they're hit by something big, so grouping would be a problem...

I'll wait until someone comes up with a better terrain :)
Hardwarespecs in signatures suck !
Robomaniac
Posts: 602
Joined: Sat Aug 23, 2003 2:03 am
Location: Pottstown, PA
Contact:

Post by Robomaniac »

You could do dynamic mesh swapping, say something big hits the tree, you load up the mesh with the tree falling down, and in between frames (after its already loaded), you hot swap the meshes
The Robomaniac
Project Head / Lead Programmer
Centaur Force
Guest

Post by Guest »

this with the falling trees is a good idea. maybe some terrain mesh deforming too. that means that if i shoot a big rocket at the terrain it is creating a big hole in the terrain and destroys all the trees and makes the ground texture changing. but a lot of work i guess. i have a lot of time, though ... :) yeah cool idea, thx man! :wink:
Post Reply