Material AlphaBlending and Billboards

Everything related to 3D programming
Olby
Enthusiast
Enthusiast
Posts: 461
Joined: Mon Jan 12, 2009 10:33 am
Contact:

Material AlphaBlending and Billboards

Post 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
Intel Core i7 Quad 2.3 Ghz, 8GB RAM, GeForce GT 630M 2GB, Windows 10 (x64)
Fred
Administrator
Administrator
Posts: 18384
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: [5.20b9] Material AlphaBlending bug

Post by Fred »

We need a small snippet to reproduce the bug.
User avatar
DK_PETER
Addict
Addict
Posts: 904
Joined: Sat Feb 19, 2011 10:06 am
Location: Denmark
Contact:

Re: [5.20b9] Material AlphaBlending bug

Post 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.
Current configurations:
Ubuntu 20.04/64 bit - Window 10 64 bit
Intel 6800K, GeForce Gtx 1060, 32 gb ram.
Amd Ryzen 9 5950X, GeForce 3070, 128 gb ram.
User avatar
Bananenfreak
Enthusiast
Enthusiast
Posts: 519
Joined: Mon Apr 15, 2013 12:22 pm

Re: [5.20b9] Material AlphaBlending bug

Post by Bananenfreak »

Yes, confirmed with the given example.
PB 5.21 LTS x64 - Windows 7 x64
Image
Fred
Administrator
Administrator
Posts: 18384
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: [5.20b9] Material AlphaBlending bug

Post by Fred »

Ok, I can see it. Strange.
User avatar
Samuel
Enthusiast
Enthusiast
Posts: 756
Joined: Sun Jul 29, 2012 10:33 pm
Location: United States

Re: [5.20b9] Material AlphaBlending bug

Post 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.
Fred
Administrator
Administrator
Posts: 18384
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: [5.20b9] Material AlphaBlending bug

Post by Fred »

Makes sens. Moved to 3D programming forum for further reference.
Post Reply