Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/05/23 14:22
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
4 registered members (AndrewAMD, Quad, soulman3, Ayumi), 675 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Depth Sorting problems... again [solved] #344328
10/16/10 14:12
10/16/10 14:12
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline OP
Senior Expert
Superku  Offline OP
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
I feel like an absolute beginner, but still I don't get it.

I have 3 different "layers" of transparent sprites as you can see in the following screenshot:


(click to enlarge)

The black sprites are at y = -256,
the dust sprites at y = -128-random(64) and
the slope sprites at y = -80.

As you can see, depending on the camera position the moving dust sprites sometimes overlap the black sprites (left shot) or get drawn behind the slope sprites (right shot).

I've read everything about transparency in the manual that I could find, nevertheless I don't get rid of this problem.
I've set camera.clip_far to only 2500 (and camera.clip_near to 15) to "increase" the z-buffer-resolution, I've tried the different sorting algorithms of d3d_entsort and without an ISOMETRIC camera I get similar results.

When I increase the distances between the three layers (by some 100 quants), the sorting problems become less.
Moving the camera, f.i. from -600 to -3600 (with increased clip_far) seems to reduce the amount of sorting issues, too, but shouldn't it be the other way round?

Why do I never see sorting issues in commercial games with many explosions and dust sprites, what's their secret?

Last edited by Superku; 10/20/10 18:24.

"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: Depth Sorting problems... again [Re: Superku] #344338
10/16/10 16:57
10/16/10 16:57
Joined: Nov 2008
Posts: 216
J
jane Offline
Member
jane  Offline
Member
J

Joined: Nov 2008
Posts: 216
Have you testet the dept var (camera.depth) in the manual? Makes on every frame
a z-buffer cleaning.

Re: Depth Sorting problems... again [Re: jane] #344342
10/16/10 17:36
10/16/10 17:36
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline OP
Senior Expert
Superku  Offline OP
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Thanks for your hint, but I did not change that value.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: Depth Sorting problems... again [Re: Superku] #344348
10/16/10 18:33
10/16/10 18:33
Joined: Nov 2008
Posts: 216
J
jane Offline
Member
jane  Offline
Member
J

Joined: Nov 2008
Posts: 216
are you able to create the sprites with ent_createlayer, to give the sprites
a layervalue?

Re: Depth Sorting problems... again [Re: jane] #344353
10/16/10 19:14
10/16/10 19:14
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline OP
Senior Expert
Superku  Offline OP
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Hm I did not think about view entities yet, but the usage of those would spawn multiple new issues, f.i. the black sprites would need to be view entities, too, and placed dynamically accordingly to the camera's position, so they overlap the dust sprites. Additionally, the dust layer has to be covered by black blocks, too (see left screenshot).


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: Depth Sorting problems... again [Re: Superku] #344365
10/16/10 20:25
10/16/10 20:25
Joined: Nov 2008
Posts: 216
J
jane Offline
Member
jane  Offline
Member
J

Joined: Nov 2008
Posts: 216
Visual Basic is able to use alpha sort lists writen in c.

but I dont know its possible to integrate it in Gamestudio.

Here another Method to alpha-sort with flags:

link


Last edited by jane; 10/16/10 20:38.
Re: Depth Sorting problems... again [Re: Superku] #344370
10/16/10 21:13
10/16/10 21:13
Joined: Dec 2002
Posts: 3,363
Vindobona (Ostarichi)
Harry Potter Offline
Expert
Harry Potter  Offline
Expert

Joined: Dec 2002
Posts: 3,363
Vindobona (Ostarichi)
Hi Felix!

Semi-transparent objects like TGA-sprites cannot use the z-buffer. They are sorted by their distance to the camera.

So if the center of your dust sprite is closer to the camera than the center of your black sprite, the dust sprite will overlap the black sprite.

You could use flat models with TGA skin instead of sprites. They are also sorted by their center point, but with models you can individually set the position of this point.

Re: Depth Sorting problems... again [Re: Harry Potter] #344371
10/16/10 21:24
10/16/10 21:24
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline OP
Senior Expert
Superku  Offline OP
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Hi Thomas! wink

Thanks, you're right, I forgot that not only the y-difference makes up the distance to the camera.
The solution would be sorting by y-distance to the camera, but I guess that's currently not possible?


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: Depth Sorting problems... again [Re: Superku] #344388
10/16/10 23:35
10/16/10 23:35
Joined: Apr 2010
Posts: 172
W
wdlmaster Offline
Member
wdlmaster  Offline
Member
W

Joined: Apr 2010
Posts: 172
maybe you could also try the ZNEAR flag (but it only renders the sprite in front of everything else, so you have still no control of the rendering order)

Re: Depth Sorting problems... again [Re: wdlmaster] #344390
10/16/10 23:37
10/16/10 23:37
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline OP
Senior Expert
Superku  Offline OP
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Thanks wdlmaster, I've already tried that, too! wink


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Page 1 of 2 1 2

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1