Jump to content

Wrong alpha math in tree billboard shader


photo

Recommended Posts

We've been experiencing a bug for a while where our tree billboards would flicker black in a really obnoxious way, that looked a lot like z-fighting. Recently though I've tracked it down and discovered that it isn't caused by z-fighting after all. 
We assumed it was so dark because it was caused by shadowed billboards being sorted incorrectly and showing up in front of other trees, but it's actually a problem with alpha testing not working properly. The first attached image shows this problem manifesting itself in a line. This is the point where the juniperoxy billboard intersects the willow billboard (the tree). You can see this in the second image where alpha test is turned off for the juniperoxy. Looking at the 4th image, you can see it's not just rendering black pixels there, it's actually rendering the transparent portion of the billboard image as opaque.

For some reason when two billboard polys intersect in a certain way, it renders part of the image at 100% opaque alpha.

 

In the short term, I've worked around this by painting a green tree pattern into the black portions of the tree billboards, and it's reduced the amount of flickering the user can see, however it's still very noticeable on groups of trees with some color variation. Is there a fix for this?

 

We're on version 2.2.1, btw.

post-1189-0-68392600-1472503857_thumb.jpg

post-1189-0-91822400-1472503866_thumb.jpg

post-1189-0-43977100-1472503871_thumb.jpg

post-1189-0-05047500-1472503881_thumb.jpg

post-1189-0-58174200-1472503889_thumb.jpg

Link to comment

Hi Ted,

 

Thank you for the test scene.

 

Could you please also give us advice where to put the camera and what steps we need to do to actually see the described issue? I've tried to fly around and disable Alpha test for juniper materail, but can't get the same results that you show us in the first post. Maybe I'm doing something wrong?
 

Thanks!

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment

Silent, 

 

Put the camera around 450, 450, 200, look down a little bit so that all of the trees are in view and use the mouse to look left and right, while the camera is moving you see quite a bit of black flickering. from this position i can see the issue Ted outlined in his first image in a couple of spots also the issues in the fourth picture.  

 

Its a little more prominent if you disable the Juniper node, also reducing the FOV on the camera helps, if you change it to 15 degrees, you can pick out the individual issues a bit easier.

 

Here are a couple of images on the test scene, they both have the Juniper disabled, one is at the default 60 FOV and one is at 15.

 

 

Thanks for any help you can provide,

Dusty

post-1533-0-08139400-1473283090_thumb.jpg

post-1533-0-45902800-1473283147_thumb.jpg

Link to comment

Hi Dred,

 

Thank you for the update. Indeed, there is a bug in 2.2.x version with grass imposters. It seems that I can't reproduce it with current 2.3 stable version. Unfortuantely, we either can't provide you a small fix, because rendering changes internally were too complex and some parts of the code were heavy refactored, sorry.

 

If you will upgrade your projects to 2.3 you will have correct impostors rendering.

 

Thanks!

 

 

2.3_sdk.jpg

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment

Silent,

 

It does look like it's fixed in 2.3.  I was hoping there might be a simple shader fix, We are currently working on the update, but with the limited time we have remaining for our release it becomes a much larger task.

 

Thanks

Dusty

Link to comment

Discarding certain alpha pixels in the deferred shader in the same fashion as the depth and auxiliary shaders results in the above alpha-related z-fighting disappearing, although there still remains a handful of normal opaque ones that z-fight. Ultimately, turning on logarithmic depth or using the new inverse z depth in 2.3 also fixes all of it by preventing the trigger of identical depth values from occurring in the first place.

Link to comment
×
×
  • Create New...