• Advertisement
Sign in to follow this  

One More Grass Question

This topic is 4486 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

Well, got pretty sweet grass/plant projections. But one small problem left. I draw the the quads with glDepthMask(0), cause otherwise it doesn't look right (as explained in my other thread calles 'sweet grass') The problem is that plants projected on hills far away blend through plants closeby. A screenshot to show what I mean. How can I make sure that the plants are blended correctly in themselves aswell as the environment ??

Share this post


Link to post
Share on other sites
Advertisement
how do you mean, from the back of the terrain to the front ???
That would only work in one direction right ??

And by the way, they are drawn like that. In a grid fashion. Row after Row....


Or on another note;
Is it maybe possible to render the depth data of a lot of object on forehand before actually rendering the objects. So when they are actually drawn, its with the depth information of all other plants, and not just the ones drawn uptill then....

Share this post


Link to post
Share on other sites
draw those furthest away first

in conjunction with alpha test you can use the depth buffer to do some culling although this requires you grass to be opaque otherwise you get blending artifacts

Share this post


Link to post
Share on other sites
That would produce the same problem. When drawing outside in, the problem occurs when looking outside in.
Dont want to be culling either. Every side should be visible

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
The simpliest solution is to use vegetation textures (or objects) with only two states of visibility, solid or transparent. This way, when rendered with z writing and testing on, the vegetation that is closer will overwrite the previously drawn ones, but the farther placed ones can't overwrite the closer ones. The depth testing is done on a per pixel basis (not per texture or per texcel), so this way it's possible to draw the the farther placed plant after the near one, and only those parts of the texture (or object) will be written in the buffer, that are not covered by solid pixels of the near plant.

If you really want to draw with z writing turned off, then you have to sort every plant into a farthest first order, and draw from farthest to nearest. Since the sorting has to be done from the camera's perspective, it means the program has to resort everything every time the camera moves. The distance should be calulated with real vectors, not just by taking the transformed z values. It's slow, and imho, it's far better to implement vegetation with the help of the z buffer. (and much easier too)

Viktor

Share this post


Link to post
Share on other sites
Ok, got it working now...
With the combined advice I've managed to utilize GL_ALPHA_TEST correctly and it looks great :)

Thanx y'all

[Edited by - Kincaid on October 9, 2005 7:37:57 AM]

Share this post


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

  • Advertisement