Jump to content
  • Advertisement
Sign in to follow this  
Etus

Grass coverage map help

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

Hi, I'm currently trying to impelemnt a grass system in my engine on the terrain, and right now I'm struggling with finding a good way to place grass in the right places. I've read a lot of papers and looked in the forums, and the best thing I came up with is to use a coverage map to decide where the grass will appear. What I don't understand is how I can place the grass billboards based on the coverage map? I know I can read the file into an array and find out the positions I need, but I want to do it on the GPU using shaders. The only idea I thought about was to read the value from the coverage map in the pixel shader and use that to determine whether or not the currently rendered billboard is visible. But it seems a waste since I'm sending a lot of grass billboards in advanced that might not be rendered anyway. I looked at NVIDIA's Nature Scene demo and Anti-Aliasing with Transparency(which renders grass too) and I didn't understand how they used the coverage map to decide where the grass is rendered (I think they used the stencil buffer, though I'm not sure). Any ideas? Thanks!

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by Etus
I know I can read the file into an array and find out the positions I need, but I want to do it on the GPU using shaders.


Any particular reason you want to do it in the shaders? If the coverage map doesn't change between frames I'd suggest just reading the relevant positions into a vert buffer. In fact assuming your grass will follow the terrain, you could just create an extra index buffer and use the existing terrain vertices (with offsets applied in the vert shader).

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!