Sorting intersecting grass quads

Started by
15 comments, last by Daniel E 14 years, 9 months ago
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.
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.

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

If you get your grassy meadows going, id love to see it. :)
My eyes popped out when I saw that screen shot.
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.
clb: At the end of 2012, the positions of jupiter, saturn, mercury, and deimos are aligned so as to cause a denormalized flush-to-zero bug when computing earth's gravitational force, slinging it to the sun.
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?
It's painful how small the screenshot of the final product is in that article :(
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.
what you can do is alpha_to_coverage
see ARB_multisample

this will look a bit better than plain alphatest
i'd love to see the results too, bzroom!

btw does anyone know some common techniques to place grass dynamically on terrain in realtime?
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.

This topic is closed to new replies.

Advertisement