Billboard Z Depth issue

Everything related to 3D programming
User avatar
J. Baker
Addict
Addict
Posts: 2181
Joined: Sun Apr 27, 2003 8:12 am
Location: USA
Contact:

Billboard Z Depth issue

Post 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.
www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef


Even the vine knows it surroundings but the man with eyes does not.
miso
Enthusiast
Enthusiast
Posts: 466
Joined: Sat Oct 21, 2023 4:06 pm
Location: Hungary

Re: Billboard Z Depth issue

Post by miso »

Try this:

Code: Select all

SetMaterialAttribute(yourbillboardmaterial,#PB_Material_DepthWrite,#True)
User avatar
J. Baker
Addict
Addict
Posts: 2181
Joined: Sun Apr 27, 2003 8:12 am
Location: USA
Contact:

Re: Billboard Z Depth issue

Post by J. Baker »

Thanks. It works but kills or does something strange to the alpha information of the image.
www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef


Even the vine knows it surroundings but the man with eyes does not.
miso
Enthusiast
Enthusiast
Posts: 466
Joined: Sat Oct 21, 2023 4:06 pm
Location: Hungary

Re: Billboard Z Depth issue

Post 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)
User avatar
J. Baker
Addict
Addict
Posts: 2181
Joined: Sun Apr 27, 2003 8:12 am
Location: USA
Contact:

Re: Billboard Z Depth issue

Post 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
www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef


Even the vine knows it surroundings but the man with eyes does not.
miso
Enthusiast
Enthusiast
Posts: 466
Joined: Sat Oct 21, 2023 4:06 pm
Location: Hungary

Re: Billboard Z Depth issue

Post by miso »

All the 5 lines are needed for the tree material. Sorry if I wasn't clear enough. Try it, that should work.
User avatar
J. Baker
Addict
Addict
Posts: 2181
Joined: Sun Apr 27, 2003 8:12 am
Location: USA
Contact:

Re: Billboard Z Depth issue

Post by J. Baker »

Oh, I did try that first and it didn't make a difference, so I just use the one. ;)
www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef


Even the vine knows it surroundings but the man with eyes does not.
Post Reply