Game Development Community

dev|Pro Game Development Curriculum

Trees, lot of trees. (phase 4)

by Claude-Alain Fournier · 02/24/2007 (6:52 am) · 17 comments

The mandatory screenshot :

i173.photobucket.com/albums/w67/cafournier/TGEA-2007-02-24-15-27-34-03.jpg
What's new from yesterday ? Well I have redone the code that decide when to draw the top view of a tree.
In the previous version, the calculation was done per quadrant, so all the trees of a quadrant will be having top view billboard shown. The result was not that good, specially if you are at the bottom of a hill, then even tree above you get the top billboard drawn. So I grabbed a beer to build up courage and attacked the vertex shader, finally managed to force the vertex shader to do all the work for me, so now the vertex shader decide for each tree if the top billboard should be drawn or not based on the view angle.

In the screenshot you can easily see the limit where the top billboard is drawn or not. I actually use a 45 degree angle.

Here is also a small video where you clearly see the change as the orc fall into the forest, then I made it run around in the cleared path so you see the change from 2d to 3d :

Click here for the video

#1
02/24/2007 (7:33 am)
Wow, thats some cool stuff you got going down.
#2
02/24/2007 (8:13 am)
It looks really good. I assume the popping effect is due to the 2D and 3D trees being different colors so you can see what the code is doing?
#3
02/24/2007 (8:32 am)
is the visibility dynamic so that for example in the options you can adjust what the distance is when the model changes to a billboard?

other than that, lookin great :)
#4
02/24/2007 (8:59 am)
Claude you are kicking.
Another beer? ;-)
#5
02/24/2007 (9:00 am)
Awesome as usual!
#6
02/24/2007 (9:27 am)
@Frank

Yes and no ;) The problem will always be that the trees are not always facing the same as the billboard pic. Also you need some skill to make the 2d pic realy match the color of in game tree, I can't, I am not an artist so this is about the best I can do, but no doubt good artists will be making something better.

@Florian

This is fully configurable, there are some variable that are currently only set in code, but I will make them visible to script so you have full control. But for performance reason you realy want to play with the settings, with 100'000 tree forest you can't have a too large area in 3d or the fps won't follow. But in less dense forest you can have a larger area covered by 3d trees. I am developping with a large forest as test, but I doubt anyone will realy want that much tree in such an area, let say that at least it will be supported ;)
#7
02/24/2007 (10:40 am)
Claude,

VERY NICE! that is good progress.

And once again, sorry for the delay in getting back to on the tree work. Once the GDC crunch time is over, I will be able to work with you in it.
#8
02/24/2007 (1:09 pm)
Looks natural.
#9
02/24/2007 (1:57 pm)
Quote:In the screenshot you can easily see the limit where the top billboard is drawn or not. I actually use a 45 degree angle.

hi Claude -
one easy way to mitigate the visibility of the boundary there
would be to use a per-tree random modification to the threshhold angle.
like +/- five or ten degrees.
#10
02/24/2007 (2:41 pm)
@Orion

Yes that's a pretty good idea actually. but shader language does not have random generator. I would have to find another way, maybe take the second decimal of the X axis position of the tree to define the variation +- 10 degrees. That's something I will experiment.

@Todd

No problem, I am still working on getting the code do what I want, no hurry here.
#11
02/25/2007 (1:20 am)
Wow..That looks great!
#12
02/25/2007 (7:34 am)
woah! is this coming as a resource!?
#13
02/26/2007 (4:33 am)
The last game where I saw trees acting like that was in Just Cause and I must say that this is pretty nice quality. I have seen sky effect like that in too few games and now I see one person writing a script for it, makes me wonder what are commercial game studios thinking! Anyway, it's good to have people like you.

I'd like to see you walking deeper into the forest. Does it affect the FPS much?
#14
02/26/2007 (8:50 am)
@Juha

Yes once I get server side collision fixed.

@Jesse

The sky is the one from water demo from TGEA. you can see video of walk in forest here

look at the whole album there are few sceenshots and 2 videos.

Performance decrease depending on the density.
#15
02/28/2007 (9:30 am)
Looks really great.

If the billboards used the ground color similar to the way the shapes do, one would perhaps never notice the change in the latest video :-)
#16
03/03/2007 (8:03 pm)
Great work . This is looking very cool !

Aun.
#17
02/08/2009 (1:53 pm)
Anything new on this?