Black boxes on alpha bitmaps

All topics about ZGameEditor goes here.

Moderator: Moderators

Post Reply
Imerion
Posts: 197
Joined: Sun Feb 09, 2014 4:42 pm

Black boxes on alpha bitmaps

Post by Imerion » Thu Oct 30, 2014 12:54 pm

I have tried to create halo-like effects around objects in my game by using a translucent sprite. But for some reason it renders black boxes around each object, hiding other sprites but not 3D objects.

The bitmap used for the halos has an alpha layer, so it should be just a circle. The material has blend mode set to alpha/one. Specular and emission is on 0, no shininess, zbuffer on, backface off.

At first I thought this was a problem with my graphics drivers, but I have now tested it on several computers and all render the same. I have tried most options I could find, but haven't found a solution. Something I could have overlooked?

User avatar
Kjell
Posts: 1669
Joined: Sat Feb 23, 2008 11:15 pm

Re: Black boxes on alpha bitmaps

Post by Kjell » Thu Oct 30, 2014 1:14 pm

Hi Imerion,

When rendering using a semi-transparent material with Z-Buffer ( writes ) turned on, you need to make sure to render back-to-front. A easy solution could be to turn Z-Buffer off, or use the Model.RenderOrder = DepthSorted option .. but neither might give you the desired results.

Could you post a screenshot or short video of the problem? That makes it easier to suggest a solution that works best for you specific situation.

K

Imerion
Posts: 197
Joined: Sun Feb 09, 2014 4:42 pm

Post by Imerion » Fri Oct 31, 2014 12:43 am

I have tried playing around with those settings, but it didn't help. I use depth-sorting for most objects.

I have included a screenshot of the problem. Perhaps it can help. All I want is that those black areas around each halo should be completely transparent.
Attachments
transparency.png
transparency.png (220.27 KiB) Viewed 1976 times

User avatar
Kjell
Posts: 1669
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell » Fri Oct 31, 2014 12:27 pm

Hi Imerion,
Imerion wrote:I have tried playing around with those settings, but it didn't help. I use depth-sorting for most objects.
There are some other aspects that control / determine the order in which things are rendered .. so it's a bit difficult to guess what's causing it.
Imerion wrote:I have included a screenshot of the problem. Perhaps it can help. All I want is that those black areas around each halo should be completely transparent.
It appears that your sky ( stars & purple nebula ) is being rendered after the astroids, while you want this to render before any overlapping semi-transparent things. Try disabling DepthSorted on your sky model and make sure to spawn it first ( so before any other models ).

K

Imerion
Posts: 197
Joined: Sun Feb 09, 2014 4:42 pm

Post by Imerion » Fri Oct 31, 2014 1:51 pm

Ah, that took care of it! The background model is now using standard renderorder and is spawned first. Looks as it should now! Huge thanks again!

Post Reply