Team Spartan Cookies & Milk Forums
Depth - Printable Version

+- Team Spartan Cookies & Milk Forums (https://teamscm.co.uk)
+-- Forum: Garry's Mod (https://teamscm.co.uk/forum-4.html)
+--- Forum: Starfall (https://teamscm.co.uk/forum-7.html)
+--- Thread: Depth (/thread-3657.html)



Depth - 57e11a - 10-06-2021

Playing with 3D2D, and I'm having issues, not having
Code:
render.overrideDepthEnable(true, true)
doesn't make them occlude, but having it makes things within a single context clip with eachother:
[Image: toh6Kxp.png]
[Image: ZPC5Gj7.png]


RE: Depth - Person8880 - 11-06-2021

That's just the nature of the depth buffer. There's not enough precision to stop it z-fighting.

Are you trying to occlude what's emitted behind another emitter, or just the windows inside the same emitter? If the latter you shouldn't need to do anything special, just render in the right order.


RE: Depth - 57e11a - 11-06-2021

Each window is it's own 3d2d context in one SF emitter


RE: Depth - 57e11a - 11-06-2021

Which I don't see a problem with, seeing as Wiremod's screens are using a 3d2d context, essentially drawing a rect, then drawing over that rect, which is what I'm doing
https://i.imgur.com/bIelp38.png
https://github.com/wiremod/wire/blob/master/lua/wire/gpulib.lua#L332


RE: Depth - Person8880 - 11-06-2021

Wiremod screens have a model behind them that writes to the depth buffer. If the screen part extended past the model it would have the same issue.

If you want to avoid precision issues you need to avoid rendering everything to the depth buffer, and instead order your operations such that depth writes don't affect parts of the same plane, only other planes.


RE: Depth - 57e11a - 11-06-2021

So, draw closer windows after farther ones?


RE: Depth - The17thDoctor - 11-06-2021

(11-06-2021, 07:50 PM)тѕсм.Quiru Wrote: So, draw closer windows after farther ones?

Exactly, that way they render the right way