Previous Blog Next Blog
Prev/Next Blog
by date

Plan for Ben Garney

Plan for Ben Garney
Name:Ben Garney
Date Posted:Jul 12, 2004
Rating:4.3 out of 5
Public:YES
Comments:YES
RSS Feed:GarageGames Blog feedor Subscribe with .
Profile Page:View profile page for Ben Garney

Blog post
I thought it was about time to post a status update on my forest code pack for TGE. I finished rewriting the culling routines to use a much more robust quadtree implementation, as well as fixing some sorting issues, cleaning up the code a lot, and integrating a helper object from friendly intern Wes Beary to visually place clearings.

This is a follow up to my previous .plan

Anyway, enough chat - here are the screenshots. They all have about 700 trees visible (out of about 30k). It's running on my laptop's GeForce 4 440 Go, which is roughly equivalent to a GeForce 2. CPU is 1.6Ghz. The framerate is shown by Fraps, so I can't fudge it up or down to impress you. :P

I'll be runing this on some real hardware tomorrow and posting the FPS in this .plan.









In the coming weeks I'm going to write a how-to guide, finish up the Doxygen documentation, and set up a nice demo application. The forest already supports collision, multiple tree types, fast, customizable LOD with imposter rendering, and networking.

Recent Blog Posts
List:12/19/08 - Blast From The Past: Blitz3D Models in Torque
12/04/08 - Blockland Physics
09/22/08 - Austin GDC Talks: Robust Efficient Networking and Flash MMOs
05/30/08 - Next Big Thing
02/12/08 - Come See Me At GDC 2008!
10/27/07 - TGEForest Free Release
10/13/07 - Polysoup Free (And IGC)
01/26/07 - Speaking and Running Into Walls (Collision Fix)

Submit ResourceSubmit your own resources!

Timothy Aste   (Jul 12, 2004 at 06:19 GMT)
W O W

I LOVE IT! :)

Awesome work Ben, you secretive sly pony.

Thomas \"Man of Ice\" Lund   (Jul 12, 2004 at 07:09 GMT)
A winner!!! Good job Ben - now get it up as a pack, and our credit cards are ready ;-)

Phil Carlisle   (Jul 12, 2004 at 08:02 GMT)
Like it..

Chris "Meatball" Barbere   (Jul 12, 2004 at 10:35 GMT)
Looks great Ben! Is this going to be a separately purchased add on pack or something you'll just incorporate into the TGE/TSE code?

David Dougher   (Jul 12, 2004 at 11:43 GMT)
Ben,

I was lookng at the tree issue earlier and I wanted to make a simple suggestion based on some research I saw on tree and foliage placement. It comes from a master's or doctoral paper I read on the subject a couple years ago on the subject of foliage growth based on height and terrain slope.

Instead of using a single tree, how about using a couple of DML lists of trees arranged so that trees would be placed based on altitude and/or slope? You initially get both pieces of information when you go to place the tree so there is no performance hit. You can vary the results in a predictable fashion with a single seed variable and create a much more natural environment in a single pass.

Currently, you have to create three or four fxFoliage passes to place different plants in an environment. Why go through the same problem with trees? Why not do it in one pass and have the results closely match how trees actually grow?

In the paper it turned out that very realitic results could be accomplished with only four choices for height and/or slope, so a DML list dropping trees based on a seed value should be just about right.

It's also an improvement I would like to see made to fxFoliage -- if Melv ever gets some spare cycles...

Chevy Mac   (Jul 12, 2004 at 12:08 GMT)
hmmm.........

Ben Garney   (Jul 12, 2004 at 14:31 GMT)
David,

You can place as many tree types as you want through a single forest. That forest actually has two distinct tree types, although you can't tell (just two entries with the same tree model). You can currently control tree placement through three methods, by marking areas as clearcut, by using the clearing object to prevent any trees from appearing in an area, or by specifying what sort of tree goes on what sort of terrain.

I can't use your DML idea because the trees are real models, not imposters. DML only allows material lists to be specified.

To some extent this gets into the same realm as SpeedTree. The major area that SpeedTree has over this code pack is a complex procedural tree creation system. I am not going to try to compete with that. They've spent years perfecting their system, and they have a team of people to improve it.

But you don't need that to make a fun game (unless your game involves a lot of botany). All you need most of the time is a passable forest at a good framerate with collision, which this technology very definitely lets you acheive. And if you do really need it... SpeedTree is available for you. :)

Anyway, hope that clears up how this works. This is a whole lot more than fxShapeReplicator or fxFoliageReplicator give you!

Chris,

This will be a code pack for TGE. If it sells well, I may port it to TSE.
Edited on Jul 12, 2004 14:32 GMT

Jay Barnson   (Jul 12, 2004 at 15:41 GMT)   Resource Rating: 5
Okay...

I *NEED* this pack. But fortunately not right at the moment. But for an upcoming project, it's high on the list of requirements. This is AWESOME.

A couple of questions - Is the framerate CPU-bound, or bound by the videocard's rendering? How does this compare with a tree-less image of the same scene? Where is the time going, if it's CPU-bound?

Do you have level-of-detail on these trees? If not, what is the poly count?

Are tree positions algorithmically generated at run-time, or are they pre-placed?

Do you have any idea of a price-point on this pack?

Ben Garney   (Jul 12, 2004 at 17:05 GMT)
Jay,

At the moment I think it's mostly GPU bound. I haven't done a lot of benchmarking since a few weeks ago. The images are from the demo (starter.fps) mission, so you can very easily do some comparison - I'll try to get a comparison image in my next .plan. If it is CPU bound the time is going into culling/sorting several tens of thousands of trees. :)

Yes. There is one geometric LOD and an imposter LOD. The geometry is about a 150 polygons. The imposter is a billboard.

Trees are algorithmically generated. There are a variety of ways to influence tree placement, including setting clearings, marking areas as clearcut, and indicating how many of what tree go on what terrain type. You can also control how close together trees can be placed.

I am thinking of selling it in the $30-60 range.

Niko Loeffelholz   (Jul 12, 2004 at 17:38 GMT)   Resource Rating: 3
This looks great!!! Too bad we have to pay.

Willbkool   (Jul 12, 2004 at 20:49 GMT)
Looks great, and I'll be glad to pay! :)

Tony Pottier   (Jul 12, 2004 at 22:01 GMT)
Wow, it looks pretty cool :)

But I was wondering, what the advantage of this paying system over freely placing manually all your trees ?

Ben Garney   (Jul 13, 2004 at 01:15 GMT)
The renderer is optimized to minimize state changes for large numbers of trees. By amalgamating the trees (of which there may be tens of thousands) behind the facade of a single object, I'm able to keep track of them using lightweight representations, meaning that it runs way, way faster than Torque would deal with that many individual SceneObjects.

It's the difference between using a particle system and creating a thousand individual objects, pretty much.

Tony Pottier   (Jul 13, 2004 at 10:34 GMT)
Ok, sorry for my ignorance in programming ^^
My game needs a giant forest with a LOT of trees, we'll see if the FPS drops too much...
Anyway, you've made a great job.

Jeff Sherwin   (Jul 13, 2004 at 11:00 GMT)
supercool. $30-60 sounds way reasonable to me

Q: can you vary scale per tree?

if you could . . . the trees could grow

Ben Garney   (Jul 13, 2004 at 17:30 GMT)
Tony - only depends how many trees are visible at a time. You can have as many not visible trees as you want with basically no performance loss. The size of the trees is also not very important.

Jeff - Yes, you can also have it randomly scale the trees when it places them. If you felt like tweaking the code you could even implement sizing based on available nutrients or somesuch.

X-Tatic   (Jul 15, 2004 at 00:49 GMT)
Or if you wanted get distance to the nearesrt water surface, if its within a certain distance, those trees grow bigger.

I know you could define it by one of the methods, but can trees be adjusted according to terrain slope? if not im sure its an easy change..

Ben Garney   (Jul 15, 2004 at 05:02 GMT)
The possibilities of tweaking object placement are endless. I'll be sure to explain how you can extend the existing framework in the docs. :) I can't possibly implement every possibility... :(

Tim Muenstermann   (Jul 15, 2004 at 11:07 GMT)   Resource Rating: 4
GREAT work Ben!!!! It's also a reasonable price tag considering what you get.

Jerane Alleyne   (Jul 15, 2004 at 22:23 GMT)
Now all you have to do is make every tree destructible :))

David Dougher   (Jul 16, 2004 at 11:39 GMT)
I agree that the price is quite reasonable. I will purchase it and we already have tree code. The chance to see how it was implemented by you and compare it to our own is just to much of a temptation to ignore.

Waits patiently(sort of) in line...

Firas   (Jul 16, 2004 at 17:29 GMT)   Resource Rating: 4
good work Ben but I have a small question:
Can I use my own tree model If I buy this Pack ?
And if the answer is yes, How many ploy. count should my tree be?
Edited on Jul 17, 2004 17:50 GMT

Chris Calef   (Jul 20, 2004 at 21:36 GMT)
right on, ben, glad to see you're finally allowed to work on something besides fixing terrain bugs!! :-)

Chris Calef   (Jul 20, 2004 at 21:38 GMT)
How much of a hit would you have to take if you made them cast shadows?

Ben Garney   (Jul 20, 2004 at 21:41 GMT)
You can use almost any model with this system. There are some limitations (ie, the orc model wouldn't work very fast), but in general any tree model will work fine. A few hundred polygons is the maximum you should consider if you want to have lots of trees.

A fair hit. If you baked the shadows into the scene, rather less.

Bryce "Cogburn" Weiner   (Jul 21, 2004 at 23:31 GMT)
So if part of the issue is in the culling, will the culling changes be added to HEAD and the tree pack for a purchase or is the code rolled into the tree pack and that's that?

EDIT: Nvm... Its a private venture. Just read the last .plan.
Edited on Jul 21, 2004 23:33 GMT

Firas   (Jul 22, 2004 at 15:41 GMT)   Resource Rating: 4
can I use multi trees models
coz you know the forest should have many trees modles, so can I do that?

Ben Garney   (Jul 22, 2004 at 15:56 GMT)
Bryce: Glad you read it. ;)

Firas: Yes. The forest renderer supports any number of tree types, each with their own model, placement properties, scaling settings, etc.

AndrewOsborne   (Jul 26, 2004 at 02:13 GMT)
This looks awesome, definately will be purchasing this

any estimated timeframe for release?

keep up the good work :)

fireVein   (Aug 08, 2004 at 04:58 GMT)
I'm lookin' forward to the demo. :)

brian quinn   (Aug 08, 2004 at 22:05 GMT)
great stuff. I have been painting trees and grass onto terrain in farcry. Is TGE different from TSE.In other words should i hurry up and buy the TSE so I can see the grass move as I push through the undergrowth. Also is there any way of bulldozing the trees in the game? OK daft question here but maybe trigger some thoughts in your able brain.

You must be a member and be logged in to either append comments or rate this resource.