Rendering millions of trees...

Published May 17, 2010
Advertisement
Million Tree Rendering
The last few days I've been working on upgraded tree rendering system. It needs to support a few million trees per world. I use a static imposter system at far distances, a dynamic imposter system for nearer trees, and trees near the camera are rendered full 3D.

Hardware instancing using multiple vertex streams is the key. There is no LOD/culling on trees in the below screenshots, so I'm rendering the millions of trees every frame. This is mostly to help give an idea how slow things will be running with 16,000+ dynamic imposters on all the entities in the game world. Performance is not bad even on my aging 3 year old computer.

Sun Rendering
I've also made a pass on the sun rendering and the night-skybox rendering code. The full dynamic 24-hour day system is almost *something something complete*. *something something dark side*. And by that I mean it's just about functioning again. If you remember my previous post about a week ago, I've had to re-write my HDR pipeline. So I'm going over all the effects and updating them while re-integrating them with the new pipeline.

Everything shown in these screenshots is faked using my own approximations, no fancy atmospheric scattering algorithms here ... just good old fashioned smoke and mirrors ;-o It's still a work in progress.

All this graphics stuff...what about gameplay
Yes I'm aware a tree-renderer isn't the goal here ... but in order for me to be excited about a project I have to keep updating the gfx lol. I am about to transition heavily into work on the integrated WYSIWYG editor, also building up the Real-Time Strategy interface. This is going to be a full-on strategy wargame. The kind of thing I've always wanted to make. Obviously you can also control any unit on your team, at any time - which makes things more interesting.

Screenshots...
Please don't hate me because I don't thumbnail my screenshots :-p













- Dan
0 likes 9 comments

Comments

Litheon
Looks really really nice/beautifull :)
May 17, 2010 07:09 AM
ExcessNeo
Quote:Original post by dgreen02
Screenshots...
Please don't hate me because I don't thumbnail my screenshots :-p


Your journal wouldn't be yours if it wasn't for non thumbnailed screenshots :p

Looks amazing as per usual.
May 17, 2010 08:21 AM
Wan
I want to go there. :)
May 17, 2010 03:30 PM
mikfig
This looks absolutely amazing :D

I only have one question: if you didn't simulate atmospheric scattering, what kind of trickery do you use? If you can't answer this question specifically, could you at least answer it in a more general form?

Thanks,
Mikfig
May 21, 2010 01:54 AM
dgreen02
Quote:Original post by mikfig
This looks absolutely amazing :D

I only have one question: if you didn't simulate atmospheric scattering, what kind of trickery do you use? If you can't answer this question specifically, could you at least answer it in a more general form?

Thanks,
Mikfig


Thanks for the comment.

I hand painted the sky gradiant @ all times of day which gets mapped onto cubemap mask texture I hand painted, and I wrote a shader merge it all together and also render the sun in one pass. This way I have 100% control of how things will look at each time of day, it's as simple as editing a texture.

Clouds are rendered after the sky using billboards infinatly far away from the viewer. I fake light scattering in the cloud shader by using each of the r,g,b,a channels of the cloud texture for a seperate function ( color, transparency, scattering, darkening factor ).

The rendering cost for these effects is almost negligible

- Dan
May 21, 2010 10:37 AM
mikfig
Heh, that's really cool. I have come to think all rendering trickery is some interesting math trick or what not; however, this reminds you that ingenuity doesn't always involve math.
May 21, 2010 11:57 PM
dgreen02
Quote:Original post by mikfig
Heh, that's really cool. I have come to think all rendering trickery is some interesting math trick or what not; however, this reminds you that ingenuity doesn't always involve math.


I use fast_sqrt() lol. That's teh answer :-o
May 22, 2010 12:45 AM
swiftcoder
I know you have probably mentioned this previously, but what kind of specifications does your 'ageing 3 year old computer' have? I am just blown away by the sheer quantity you are able to render!
May 22, 2010 07:24 AM
dgreen02
Quote:Original post by swiftcoder
I know you have probably mentioned this previously, but what kind of specifications does your 'ageing 3 year old computer' have? I am just blown away by the sheer quantity you are able to render!


Thanks :-)

The main work machine is Intel Core2Duo 2.4ghz, 4GB RAM, 9800GTX+ 512MB video.

My secondary work machine is Intel Core2Duo 2.4ghz, 2GB RAM, 8800GTS 640MB video.

I bought those computers in 2007, then I have a long range of about 7 other machines ( including a new gaming laptop I just bought today )

The game achieves 40-120FPS at 1280x720 w 4X MSAA, depending where you are in the world. This is with 2.09 million trees on the terrain. I've tested my system with up to 10,000,000 trees in the world and it works nice ~25 FPS but it's not practicle to waste all that time on just rendering trees/foliage. 1-2 million trees per world is a nice sweetspot. There are minor caching artifacts if you fly the camera 20km away in 2 seconds, but the game will resolve it within 100 frames.

I'm really excited about all this for the first time I feel I have something special tech-wise. I just overcame the biggest hurdle I could see which was getting physics on the 50+ million triangle terrain, but it works flawlessly and without a real hit to the game ... I use Havok physics in the engine. It's funny the havok remote debugger crashes because it can't display all the triangles ( you need some kind of geomipmapping/LOD to display large terrains like these ).

I will post an update very soon [grin] [grin]

- Dan
May 22, 2010 03:27 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement