# Realtime forest rendering

This topic is 3723 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hello, I'm working on a 3d game which is supposed to be able to render realtime forests. The "world" is pretty big and needs quite a lot of trees (think a few million). Now, I was thinking to make a file with bits which stand for tree (1) or no tree (0). This way I can generate "bitmaps", using the diamond-square heightmap generating algorithm as a definition on how big the change is for a tree, so 1 or 0. So the forests are all pre-generated in a file of a few million bits. Now, since I have no real experience in Level Of Detail techniques, and my mind is too lazy to think up a technique that doesn't fry my cpu, I thought I could use some help. I haven't really got further than using a grid, my mind locks up here. About the trees: They are not generated in realtime, they are just a number of slightly different low-characteristic models. So, if you have some experience with this, or something pops up in your mind, I could really use your help. Greetings, Michel

##### Share on other sites
This paper and its accompanying web site provide an overview of the issues involved in drawing lot of trees and one technique for solving them.

As always the Virtual Terrain Project is a good source for info about all things terrain related.

People putting trees on large terrains usually have some sort of tree density map, rather than store the position of every tree, and procedurally decide how many and where they should go for a particular cell in the map.

##### Share on other sites
I think you need to specify what is the most used point of view.

Depending on the camera staying on the ground or flying over the world, different lod strategy will be used.
beside, if you don't have many models, you may need to create some diversity artificially.

I didn't understand this sentence : "This way I can generate "bitmaps", using the diamond-square heightmap generating algorithm as a definition on how big the change is for a tree, so 1 or 0."

##### Share on other sites
Quote:
 Original post by dave jThis paper and its accompanying web site provide an overview of the issues involved in drawing lot of trees and one technique for solving them.As always the Virtual Terrain Project is a good source for info about all things terrain related.People putting trees on large terrains usually have some sort of tree density map, rather than store the position of every tree, and procedurally decide how many and where they should go for a particular cell in the map.

Thanks for the references.
By the way, I definitely need to store the position of every tree, I need the forest to be persistent.

Quote:
 Original post by WagneriousI think you need to specify what is the most used point of view.Depending on the camera staying on the ground or flying over the world, different lod strategy will be used.beside, if you don't have many models, you may need to create some diversity artificially.I didn't understand this sentence : "This way I can generate "bitmaps", using the diamond-square heightmap generating algorithm as a definition on how big the change is for a tree, so 1 or 0."

The most used point of view is on the ground.
About that sentence, it basically means i have a file containing bits. The bits are sort of a map for the train. A 1 (bit) in the file means there is a tree. The rest of the blahblah is just how i intend to generate that file.

##### Share on other sites
Quote:
Original post by Bear777
Quote:
 Original post by dave jPeople putting trees on large terrains usually have some sort of tree density map, rather than store the position of every tree, and procedurally decide how many and where they should go for a particular cell in the map.

Thanks for the references.
By the way, I definitely need to store the position of every tree, I need the forest to be persistent.

You don't need to store the position of every tree - that was the point about about procedurally decide where the trees should go. Supposing each cell in the tree density map represents 30m2. When you come to draw the trees in the cell you could do something like:
Work out a new seed for a random number generator based on the position of the cell.for tree=1 to number of trees for this cell   generate 2 random numbers between 0 and 30 and add these to the cell's position for the tree's x and z coordinate   calculate the tree's y coordinate by working out the height at x, z   draw the tree at x, y, z

You'd want to cache this the first time you see the tree so you don't have to calculate it every time. You can discard the tree positions when you can no longer see the cell because you can always generate them again in the same position.

##### Share on other sites
Quote:
Original post by dave j
Quote:
Original post by Bear777
Quote:
 Original post by dave jPeople putting trees on large terrains usually have some sort of tree density map, rather than store the position of every tree, and procedurally decide how many and where they should go for a particular cell in the map.

Thanks for the references.
By the way, I definitely need to store the position of every tree, I need the forest to be persistent.

You don't need to store the position of every tree - that was the point about about procedurally decide where the trees should go. Supposing each cell in the tree density map represents 30m2. When you come to draw the trees in the cell you could do something like:
Work out a new seed for a random number generator based on the position of the cell.for tree=1 to number of trees for this cell   generate 2 random numbers between 0 and 30 and add these to the cell's position for the tree's x and z coordinate   calculate the tree's y coordinate by working out the height at x, z   draw the tree at x, y, z

You'd want to cache this the first time you see the tree so you don't have to calculate it every time. You can discard the tree positions when you can no longer see the cell because you can always generate them again in the same position.

yeah, but this way i'd still have to add the "heightmap" of the tree density to the engine. It'd be about 8 times bigger than the bit-based one I intend to use to avoid squary effects to the forest.
Any idea how to avoid this?

##### Share on other sites
Quote:
 Original post by Bear777yeah, but this way i'd still have to add the "heightmap" of the tree density to the engine. It'd be about 8 times bigger than the bit-based one I intend to use to avoid squary effects to the forest.Any idea how to avoid this?

Have a look at the Plants->Books and Papers page on the VTP site. It has several papers that cover vegetation placement.

##### Share on other sites

This topic is 3723 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Create an account

Register a new account

• ### Forum Statistics

• Total Topics
628647
• Total Posts
2984034

• 10
• 9
• 9
• 10
• 21