Sign in to follow this  
dpadam450

Masking texture for plant

Recommended Posts

dpadam450    2357
Ok, to do a mask I must disable the depth test, which would make my plant be drawn over an object that is in front of it. Anyway around this, or should I just use a texture with an alpha value. If I do the last thing, do I have to go into the windows creation and add an alpha buffer?

Share this post


Link to post
Share on other sites
vincoof    514
The necessity of creating an alpha buffer for blending is an old myth. In many cases you will be able to use OpenGL's alpha blending without any alpha buffer.

As for your particular example of plant rendering, I tend to recommend alpha testing instead of alpha blending. This is often faster and doesn't need to sort faces. On the other hand you may notice a slight quality loss, more or less important depending on the type of the plants.

Share this post


Link to post
Share on other sites
Mushu    1396
As an unrelated side-note - when you render the plants, you're probably going to need to disable writing to the depth buffer. The reason for this is that, even if the pixel being written to is pure-alpha, it'll still write the z-value to it by default, thus obscuring anything drawn behind it (drawn later in the scene) which you'd want to be visible.

Disabling the depth-write allows you to draw unsorted alpha-tested quads without creating this artifact. Just remember to re-enable it when you're done with the plants :)

Share this post


Link to post
Share on other sites
vincoof    514
No offence intended, but you may (must?) keep depth writing enabled if rendering with alpha testing and without alpha blending ;)

Share this post


Link to post
Share on other sites
Mushu    1396
Heh, I've no idea - I almost exclusively use blending for any and all purposes, including alpha testing :)

I just remember that it looked really screwed up with the depth writing. In fact, I think I have an old screenie somewhere on photobucket... *goes and finds*

Ack, no, I don't. I think I only uploaded the pictures that were taken from a viewing angle which made it appear somewhat correctly :P

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this