Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / GHOST OBJECT ON disables the zdepth

Author
Message
Yarbles2018
6
Years of Service
User Offline
Joined: 16th Jan 2018
Location:
Posted: 26th Jul 2024 22:21
I searched around this forum and couldn't find a solution for this.

Here is a screenshot from the bee game:


This is not a problem in DBClassic.
I should also note, I'm using DBPro v1.058.

Any ideas?

Attachments

Login to view attachments
Hannibal
17
Years of Service
User Offline
Joined: 5th Mar 2007
Location:
Posted: 29th Jul 2024 02:47
You could try using alpha mapping instead, or use an image with alpha as texture

This code does something to alpha of a bitmap, I forget what but it could be useful

Mage
17
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: Canada
Posted: 29th Jul 2024 18:43
The waterline object problem:
It's been like 10 years since I was having to deal with this sort of thing. It's also quite common with objects that intersect water (which would be typically a transparent mesh of some sort. The object would typically render either above water (but not blended with water) or not render at all below the water. This is because of how z ordering works.

If the transparent object peeking out of the water is drawn first, when the water is later drawn the those pixels above the water are treated as just a regular plan overlapping the water and there is no blending. Often this can be ignored if the actual object doesn't have a transparent texture. However commonly characters hair will glitch out around water for this reason. Below the water line, there's no zdepth issue and the water is drawn blended properly.

If the transparent object peeking out of the water is drawn last then the above water section passes all the zdepth tests, and blends properly with the water. However sections below the water are actually behind already drawn pixels and become culled. So the object does not get drawn below the water.


Speaking to your issue specifically:
I see your issue in the screenshot. Your issue is rather severe and it's likely you can mitigate most of this issue with just managing your objects better.
I will assume the issue is that white circular burst shown, and that it should be behind the ground peaking up and the grass in the foreground. If this is true then it also appears your ground mesh is not meant to be transparent at all, and you likely have to use SET OBJECT TRANSPARENCY with a flag of 0 on that mesh. You likely need to use the same command with flag 1 or at least the same flag on both the effect mesh and the grass to have them correctly depth sort. Your game complicates issues because of the camera angles sometimes grass will overlap these effects and sometimes the effects will overlap grass. So they should have the same transparency flags so they are depth sorted together.

The issue here is depth sorting actually has several categories that need to be considered in a case like this.


Alternative Options:
Another trick is to create your asset with no transparency at all, use extra polygons and styling instead. This would allow you to draw the object early in the zordering process and avoid any problems at all.


-=-=-=-=-=-
SET OBJECT TRANSPARENCY
So this command has a variety of flags that might help. You can play with the Z Ordering with this command.

SET OBJECT TRANSPARENCY Object Number, Flag
0 - draw first no alpha
1 - draw first with alpha masking
2 and 3 - draw second which overlaps solid geometry
4 - draw second alpha test (only render beyond 0x000000CF alpha values)
5 - water line object (seperates depth sort automatically)
6 - combination of 3 and 4 (second phase render with alpha blend AND alpha test, used for fading LOD leaves)



Mage's Modular Code - Get awesome UI controls and powerful Bitmap Fonts!
Screen Device Recovery - Stop your apps from crashing when minimized/tabbed/screen locked.
CPU Friendly Frame Limiter - Make your app generate less computer heat + noise, and use less battery life!

Login to post a reply

Server time is: 2024-09-08 02:27:14
Your offset time is: 2024-09-08 02:27:14