Jump to content
  • Advertisement
Sign in to follow this  
bzroom

Sorting intersecting grass quads

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

I was reading this article on grass rendering: http://http.developer.nvidia.com/GPUGems/gpugems_ch07.html It describes clusters of 3 quads, in a star shape, to render patches of grass. It mentions that they must be sorted. But i'm confused how you'd go about sorting the 3 quads, since they intersect. It seems like they'd need to be clipped and split. Or is it refering to just sorting the clusters, as a whole, as a "good enough" aproximation? Thanks.

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by bzroom
Or is it refering to just sorting the clusters, as a whole, as a "good enough" aproximation?
Yes, just sort the clusters.

Share this post


Link to post
Share on other sites
If you get your grassy meadows going, id love to see it. :)
My eyes popped out when I saw that screen shot.

Share this post


Link to post
Share on other sites
Quote:
Original post by rouncED
If you get your grassy meadows going, id love to see it. :)
My eyes popped out when I saw that screen shot.


It's pretty much how Bethesda handled grass for Oblivion.

Share this post


Link to post
Share on other sites
It seems wrong though, to sort only the clusters. If you had only 1 cluster, odds are it will look entirely wrong. It's only if it's surrounded by clusters does it have a chance of looking decent without proper sorting.

While that's an extreme case, consider the clusters along the edge of a tall grassy section. I imagine they'ed be self overdrawn with invisibleness in lots of the cases.

I won't know till I try it and i'll be sure to post the results.

Also is there a special trick to sorting billboards, or specifically close-up billboards. While ultimately i shouldn't be so dern close to a cylindrical billboard, temporarily i am. When I sort them based on distance to the camera, I get weird issues when close up and rotating, sometimes it seems that the closer ones are drawn first.

Maybe since it's cylindrical i need to look at the distance in only the horizontal plane, it might have been my camera height that was causing issues now that i think about it. Even though it was only a small value. Does that make any sense?

Share this post


Link to post
Share on other sites
Hey, I've been playing around with rendering grass like that article says, only I'm trying to implement a fast non-programmable-pipelines version (because my netbook is fun like that) using standard OpenGL calls.. I think that the farthest I'll push my project is multitexturing..

and I'll say that I am using the alternative of alpha testing, instead of blending, and thus have eliminated the need to sort my grass. I just lump them all into a static set per terrain-mesh (which is divided into 16x16 units) and draw them that way. I also don't use quads to draw them, I use a triangle that is twice the dimensions of an equal quad..

eg: mspaint was less painful to articulate:

http://www.van-noland.com/img/triangle_for_quad.jpg

Although I've yet to figure out if the alpha-testing on a bigger polygon is worse than 2 smaller polygons (a quad).. So far, alpha testing itself doesn't seem to make any difference on framerate, so, I imagine, that if anything, using one triangle instead of a quad for a grass polygon is better.

I had to tweak my alpha-testing value so that the grass doesn't get blocky the further it is, or get 'thin' as the mipmaps come into play..


EDIT: Oh yea, don't forget to set GL_TEXTURE_WRAP_S and WRAP_T to GL_CLAMP, because GL_REPEAT is all bad for using triangles in place of quads.

Share this post


Link to post
Share on other sites
what you can do is alpha_to_coverage
see ARB_multisample

this will look a bit better than plain alphatest

Share this post


Link to post
Share on other sites
i'd love to see the results too, bzroom!

btw does anyone know some common techniques to place grass dynamically on terrain in realtime?

Share this post


Link to post
Share on other sites
Quote:
Original post by Daniel E
i'd love to see the results too, bzroom!

btw does anyone know some common techniques to place grass dynamically on terrain in realtime?


You mean procedurally generate positioning for the grass? Please elaborate, if you can.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!