tree rendering

Member
Posts: 157
Joined: 2002.12
Post: #1
I didn't realize how difficult it would be rendering a tree made out of planes.
I still cannot get them to render perfectly because of the way the depth buffer works (writes the whole triangle area to depth buffer).

The best I could do was to render the tree without depth test, then render again with depth test on but not very efficient if I render hundreds of trees.

I read on the web that the best think I could do is to use the painter algorithm to sort the planes and render back-forward.

I think the solution is vertex shading??

Any suggestions?

Thanks..[Image: a.jpg][Image: b.jpg]
Quote this message in a reply
Member
Posts: 45
Joined: 2006.11
Post: #2
I think what is meant is to disable depth writing, not depth testing, while rendering the trees. However, this isn't a good solution either since the trees are mostly opaque. That usually only works well with mostly transparent textures (although I think I remember someone saying there was a blending mode that took source alpha into account and didn't draw pixels if the source alpha was opaque. I don't remember what that is at the moment). I don't think you can get a completely accurate rendering even with sorting, since the planes can overlap in a ring and break the painter's algorithm. You would need to subdivide the geometry to overcome that problem. Instead, disable depth writing AND sort the planes, and if the case is that the planes ring overlap, then you'll get a better approximation than with a funky depth test overlap.
Quote this message in a reply
DoG
Moderator
Posts: 869
Joined: 2003.01
Post: #3
There is some PhD work done at my school just about tree rendering. They render thousands of polygonal trees on high-end hardware, but they use impostors instead of rendering the actual polygons for all trees.
Quote this message in a reply
menace690
Unregistered
 
Post: #4
One option you have is at distances at least, is to prerender the trees. That way, you can have one planar surface rendered rather than a combination of many.
Quote this message in a reply
Member
Posts: 164
Joined: 2002.04
Post: #5
Easy and fast way... set alphafunc to greater than .5 or so, and turn off GL_BLEND. Keep depth testing and writing.
Quote this message in a reply
Member
Posts: 304
Joined: 2002.04
Post: #6
Sharp looking trees man. I cant see the problem in the screenshots you posted and I bet most players wont either.
Quote this message in a reply
Member
Posts: 157
Joined: 2002.12
Post: #7
menace690 Wrote:prerender the trees.
That would work if I never got close to the trees, but I will be flying over the trees . Blink
Quote this message in a reply
Member
Posts: 157
Joined: 2002.12
Post: #8
JeroMiya Wrote:I think what is meant is to disable depth writin
Sorry, Yes that's what I meant.
That's exactly what I'm doing but popups and drawing artifacts are too distracting, I'll try another modeling approach.

Thanks for your support to all of you...
Quote this message in a reply
Member
Posts: 157
Joined: 2002.12
Post: #9
DoG Wrote:There is some PhD work done at my school
Is there a link I can go to?

Thanks...
Quote this message in a reply
Member
Posts: 157
Joined: 2002.12
Post: #10
codemattic Wrote:I cant see the problem in the screenshots you posted and I bet most players wont either.

Thanks. Is very noticeable when the camera is moving around them Huh
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Help With Procedural Tree Algorithm Nick 1 3,662 Jul 26, 2006 10:56 AM
Last Post: unknown
  Tree Culling Jake 13 5,946 Jan 7, 2005 02:44 AM
Last Post: arekkusu
  BSP tree compiler ClarustheDogCow 3 3,760 Jul 4, 2002 09:30 AM
Last Post: ClarustheDogCow