Page 1 of 1

Billboard Z Depth issue

Posted: Fri Oct 20, 2023 9:55 pm
by J. Baker
Anyone else have a Z depth issue using Billboards? I made (AddBillboard()) 5 Billboards in the group but the farthest tree in that group overlaps the closer trees. It shows up smaller than the closer ones due to its depth but just over laps the others. Will look into it more but was just wondering if anyone else noticed this or had this issue.

Re: Billboard Z Depth issue

Posted: Sat Oct 21, 2023 4:13 pm
by miso
Try this:

Code: Select all

SetMaterialAttribute(yourbillboardmaterial,#PB_Material_DepthWrite,#True)

Re: Billboard Z Depth issue

Posted: Sun Oct 22, 2023 2:07 am
by J. Baker
Thanks. It works but kills or does something strange to the alpha information of the image.

Re: Billboard Z Depth issue

Posted: Sun Oct 22, 2023 8:55 am
by miso
I'm not sure what is the problem with your alpha so keep the previous and add these:

Code: Select all

MaterialBlendingMode(yourbillboardmaterial,#PB_Material_AlphaBlend)
MaterialCullingMode(yourbillboardmaterial, #PB_Material_ClockWiseCull)
SetMaterialColor(yourbillboardmaterial,#PB_Material_DiffuseColor,RGBA(255,255,255,255))
SetMaterialAttribute(yourbillboardmaterial,#PB_Material_AlphaReject,128)

Re: Billboard Z Depth issue

Posted: Sun Oct 22, 2023 1:49 pm
by J. Baker
Thank you! #PB_Material_AlphaReject works but it is not as smooth as #PB_Material_AlphaBlend.

This is what it does with #PB_Material_AlphaBlend. It kind of uses the alpha channel but then it doesn't as you can see it blocks the background tree. Using a 32bit PNG image.

Image

Re: Billboard Z Depth issue

Posted: Sun Oct 22, 2023 2:16 pm
by miso
All the 5 lines are needed for the tree material. Sorry if I wasn't clear enough. Try it, that should work.

Re: Billboard Z Depth issue

Posted: Sun Oct 22, 2023 2:25 pm
by J. Baker
Oh, I did try that first and it didn't make a difference, so I just use the one. ;)