Page 1 of 1

Material AlphaBlending and Billboards

Posted: Thu Aug 08, 2013 6:25 pm
by Olby
Material with #PB_Material_AlphaBlend flag will render incorrectly when many billboards are rendered on top of each other towards the back of the scene.
Tested on 5.20b9 and 5.11 using OpenGL and DirectX9 using a PNG texture and billboards.

Image

Re: [5.20b9] Material AlphaBlending bug

Posted: Wed Mar 12, 2014 9:15 am
by Fred
We need a small snippet to reproduce the bug.

Re: [5.20b9] Material AlphaBlending bug

Posted: Wed Mar 12, 2014 9:24 am
by DK_PETER
Fred wrote:We need a small snippet to reproduce the bug.
No need. Just run the BillboardGrass.pb demo.
Move camera to ground level, so the grass becomes big.
Then move left and right (or simply pan around) to see the bug.

Re: [5.20b9] Material AlphaBlending bug

Posted: Wed Mar 12, 2014 10:21 am
by Bananenfreak
Yes, confirmed with the given example.
PB 5.21 LTS x64 - Windows 7 x64

Re: [5.20b9] Material AlphaBlending bug

Posted: Wed Mar 12, 2014 11:04 am
by Fred
Ok, I can see it. Strange.

Re: [5.20b9] Material AlphaBlending bug

Posted: Wed Mar 12, 2014 11:47 am
by Samuel
I did some research and I'm pretty sure this isn't a bug. It's a billboard/alphablending limitation and it's for all 3D engines not just Ogre.
The reason is alphablending is not commutative. So, depth buffers can't tell which pixels need to be drawn in front of each other without extra work.
The only way around this is to create each plane individually which voids the whole purpose of using billboards.

My advice is whenever possible don't use alphablending with billboards.
When you have use it. Make sure it's something not very obvious or limit the camera movement so it will never get at an angle to notice the issue.

Re: [5.20b9] Material AlphaBlending bug

Posted: Wed Mar 12, 2014 12:00 pm
by Fred
Makes sens. Moved to 3D programming forum for further reference.