Jump to content
  • Advertisement
Sign in to follow this  
Medo Mex

3D Grass and Depth Problem

This topic is 966 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 have a transparent image that I'm using as a texture for many billboards to draw 3D grasses

 

Instead of getting the results expected, here is what I get:

[attachment=30443:grass.png]

 

The grass billboards are hiding each others, so I tried to disable the depth buffer when drawing the billboards and I got this problem fixed but I run into another problem, I see grasses I'm not supposed to see as the following:

[attachment=30444:grass 2.png]

 

How do I fix this problem?

 

Thanks,

Share this post


Link to post
Share on other sites
Advertisement

@lwm: That can fix the problem, but the same problem can occur with particles.

 

In D3D9 I used to enable the depth buffer and disable writing to the depth buffer when drawing particles.

 

How can I do the same in D3D11?

Share this post


Link to post
Share on other sites

You can do this by setting the Depth-Stencil-State to

DepthEnable = true

DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ZERO

Share this post


Link to post
Share on other sites

@lwm: Thanks, one last problem is that when I look at the grass from above, most of the grasses disappear, I also run into performance problem when I try to make the terrain have a lot of grasses (even when I'm using instancing).

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!