DaemonEngine / Daemon

The Dæmon game engine. With some bits of ioq3 and XreaL.
https://unvanquished.net
BSD 3-Clause "New" or "Revised" License
303 stars 60 forks source link

Incorrect transparent surface ordering on map habitat #1079

Open VReaperV opened 6 months ago

VReaperV commented 6 months ago

Some of the surfaces are drawn in an incorrect order in relation to the window: unvanquished_2024-04-13_104758_000 After the window is rendered: debug_tr_0 After transparent objects behind the window are rendered: debug_tr_1 I believe it's an engine bug rather than a map bug since transparent surface should always be rendered back to front.

illwieckz commented 6 months ago

I agree it's likely an engine bug. I already fixed some of them long time ago but I will not be surprised if some are remaining, or came back.

It may be possible that map bug can produce this though, so we should double-check the map materials.

slipher commented 2 days ago

1319 shows another example Here's a third:

unvanquished_2024-10-24_020217_000

I think the problem is we don't actually sort surfaces by distance at all. I don't see anything like that in R_SortDrawSurfs. It's always based on shaderSort_t+shader+entitynum+fog+lightmap, transparent or not.

VReaperV commented 2 days ago

I think the problem is we don't actually sort surfaces by distance at all. I don't see anything like that in R_SortDrawSurfs. It's always based on shaderSort_t+shader+entitynum+fog+lightmap, transparent or not.

Apparently so. Perhaps just skipping translucent surfaces for this sort would be enough to fix it, since traversing the BSP returns surfaces essentialy ordered by distance.