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 / Alpha mapping acting weird

Author
Message
Deego
18
Years of Service
User Offline
Joined: 21st May 2008
Location:
Posted: 16th May 2010 19:02
In my space shooter, there are asteroids and enemy ships. When the asteroids are destroyed, they release a dust cloud that blocks the player's view and fades away using SET ALPHA MAPPING ON.

Check the picture. You can see the asteroids just fine through the faded dust cloud, but the enemy ships are completely invisible.

The asteroids have lighting effects, but the enemy ships have lighting disabled (I baked the lighting when exporting the model's texture). I thought this might be the problem, but when I gave the ships the same lighting setup as the asteroids, the same thing happened.

The ships move, and the asteroids are fixed in place while rotating. The ships are cloned when spawned and deleted when shot, and the asteroids are not deleted, just repositioned further down the asteroid field.

I tried disabling the zwrite on the dust cloud planes, but this prevented them from occluding anything.

Anyone have any ideas on what is going on?
KISTech
18
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 16th May 2010 19:29
It looks like the dust cloud object is behind the asteroids. If I understand what you are after, make sure the dust cloud object is in between the camera and everything you want hidden by it.

Deego
18
Years of Service
User Offline
Joined: 21st May 2008
Location:
Posted: 16th May 2010 19:43 Edited at: 16th May 2010 19:49
It is. The dust cloud is positioned at the XYZ of the asteroid that was destroyed. That asteroid was destroyed right in front of the camera, all other asteroids are further down field.

The dust cloud objects are created AFTER the enemy ships. Is there depth sorting based on when an object was created?

EDIT: Holy snap, there is! In the pregame load, I moved the creation of all the enemy ship models I clone from to before I made the plane I clone the dust from. Now it works just fine. The lesson, load all objects that will be transparent last!
KISTech
18
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 17th May 2010 18:43
If it's an OBJECT then it shouldn't matter what order it's created in. It matters where it's positioned.

If it's a SPRITE then it matters what order they are drawn, which you can override by specifying the SPRITE PRIORITY.

Either way, it sounds like you fixed your issue for now.

Deego
18
Years of Service
User Offline
Joined: 21st May 2008
Location:
Posted: 18th May 2010 18:14
I thought that the order objects are created in doesn't matter as well, but that was the only change I made for it to work.
Mobiius
Valued Member
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 18th May 2010 19:15
I know that alpha mapped/ghosted objects don't appear correctly when an object with a shader is behind them.

In the game I'm writing, the sea is a water shader with alpha/hosted object on top, and they appear ghosted, but the level of ghosting doesn't change. If I turn off shader water, they appear exactly as intended.

My signature is NOT a moderator plaything! Stop changing it!

Login to post a reply

Server time is: 2026-07-25 23:11:34
Your offset time is: 2026-07-25 23:11:34