Re: Begining of 3D floors [continue needed]
Posted: Fri Jul 16, 2010 6:27 pm
To draw translucent images (planes, walls or floors), you must sort them to draw correctly and draw back to front. If you draw as first closest image, other images will get incorrect translucency effect against it (or if you update z-buffer, images behind this wont be visible, even if it is translucent). This also must be done in HW renderer.
And in-sector sorting should work always, maybe there is another sector with same fake floors close to it? I mean, it should work for 100% if you have only one sector with multiple fake floors and every other sector does not have any fake floor. (it might be limited to same subsector instead of same sector, i am not sure now)
Doom legacy does not have z-buffer and they have correct sorting algorithm, at least i think from what i saw. I don't know how it works, but that idea might be ported to zdoom, if it does not rely on old doom's renderer.
First i was experimenting with legacy's fake floor renderer more times, i experimentally "copied" few parts of code to heretic or hexen, with succes.
Some time later i realised how can it be done. Really simple, renderer can draw any plane at any height, to draw fake floor plane, just tell renderer to draw normal plane with different floor height before real sector's plane, don't update any cliping info and mark it as fake floor (in my zdoom mod it is marked if visplane->sky < 0). Of course to draw plane, renderer must get list of segs, these segs must be also marked as fake, so another part of code can skip them from few other things (sprite clipping, middle texture drawing + fog drawing). Maybe sorting/clipping can be done similar way? I still have no idea, but hopefully someone solve it.
And if there is nothing better, i support z-buffered "sorting", it won't be perfect (translucency will cause most problems) but at least ZDoom can support fake floors.
Heh, i am explaining how i did it ... never mind, maybe it can be helpful ... if someone needs to know something more, just ask and i will try to answer (i have not seen my code for weeks).
And in-sector sorting should work always, maybe there is another sector with same fake floors close to it? I mean, it should work for 100% if you have only one sector with multiple fake floors and every other sector does not have any fake floor. (it might be limited to same subsector instead of same sector, i am not sure now)
Doom legacy does not have z-buffer and they have correct sorting algorithm, at least i think from what i saw. I don't know how it works, but that idea might be ported to zdoom, if it does not rely on old doom's renderer.
First i was experimenting with legacy's fake floor renderer more times, i experimentally "copied" few parts of code to heretic or hexen, with succes.
Some time later i realised how can it be done. Really simple, renderer can draw any plane at any height, to draw fake floor plane, just tell renderer to draw normal plane with different floor height before real sector's plane, don't update any cliping info and mark it as fake floor (in my zdoom mod it is marked if visplane->sky < 0). Of course to draw plane, renderer must get list of segs, these segs must be also marked as fake, so another part of code can skip them from few other things (sprite clipping, middle texture drawing + fog drawing). Maybe sorting/clipping can be done similar way? I still have no idea, but hopefully someone solve it.
And if there is nothing better, i support z-buffered "sorting", it won't be perfect (translucency will cause most problems) but at least ZDoom can support fake floors.
Heh, i am explaining how i did it ... never mind, maybe it can be helpful ... if someone needs to know something more, just ask and i will try to answer (i have not seen my code for weeks).