Page 1 of 2

Translucent (3D) water

Posted: Mon Apr 19, 2010 3:21 pm
by kgsws-CZ
I was playing with zdoom renderer, and i have figured out how to make translucent water effect.
I did few other things so it clips under/above water things correctly.
But it has many limitations, like problems when you use different water levels too close (water rendering will be correct, but sprite ordering not)
And, i guess, my code is one huge hack ... maybe ... but it is good as proof of concept ... or no?
Anyway, if you consider it usable, here is diff (with example wad): http://zdoom.ic.cz/zdoom/trwater.zip (diff made from revision 2288)
And here are some screenshots (and yes, all are made in software mode, no stacked sectors used):
Spoiler:

Re: Translucent (3D) water

Posted: Mon Apr 19, 2010 4:00 pm
by InsanityBringer
woah that's pretty cool

Closest the software renderer will likely get to rendering 3d floors. Anyone mind making a EXE for us non-programmer types?

Re: Translucent (3D) water

Posted: Mon Apr 19, 2010 9:20 pm
by qwerqsar
Nice! Would like to see a program for us, the ignorant masses :P

Re: Translucent (3D) water

Posted: Tue Apr 20, 2010 11:34 am
by Recurracy
That's awesome.

Re: Translucent (3D) water

Posted: Tue Apr 20, 2010 12:07 pm
by StrikerMan780
F'ing Sweet. I can see this becoming extremely useful for quite a few things I have in mind.

Now, if you could expand on this and get 3D Floors working in software, you'd be my hero.

Re: Translucent (3D) water

Posted: Tue Apr 20, 2010 1:11 pm
by kgsws-CZ
3D floors are possible in software renderer, but right now i still don't fully understand it.
Even this water is not ideal, sprite ordering is messed because of 2 water levels (under and on) - that's why it does not support multiple translucent water levels on screen, and has few other bugs. (anyway, if you use one water level, it works great)
I am trying to get it better, its slow progress but it might be done. I don't know how much time i can spend on it.

And bad news, i can't give you EXE, i am compiling it under linux.

Re: Translucent (3D) water

Posted: Tue Apr 20, 2010 2:45 pm
by InsanityBringer
kgsws-CZ wrote:And bad news, i can't give you EXE, i am compiling it under linux.
I do have a working config to build Zdoom, so I'll try using that.

Re: Translucent (3D) water

Posted: Tue Apr 20, 2010 3:54 pm
by Siggi
I just got this working now, and I'm impressed. This is a really nice effect.

I'd upload an EXE for the rest of you, but I'm using Linux as well.
#zdoom wrote:23:55 <@Siggi> ok, that water test build is awesome
23:56 < InsanityBringer> and I should have a windows EXE for those who aren't programmers. Soon
23:56 <@Siggi> nice

Re: Translucent (3D) water

Posted: Tue Apr 20, 2010 4:11 pm
by InsanityBringer
http://basementnet.us/ryan/zdoomw3dflats.zip

it should work. Provide your own FMODex.dll

Re: Translucent (3D) water

Posted: Tue Apr 20, 2010 8:05 pm
by phi108
This is very cool. Great job!

I hope the code is acceptable for inclusion into ZDoom, or maybe it will provide the inspiration or insight for an official feature addition. And I hope those "side-affect" 3D floors somehow become official and effective, though I doubt they will be as good as GL 3D floors...

Re: Translucent (3D) water

Posted: Tue Apr 20, 2010 8:47 pm
by randi
phi108 wrote:I hope the code is acceptable for inclusion into ZDoom
It would be better if it was compatible with GZDoom's 3D floors.

Re: Translucent (3D) water

Posted: Tue Apr 20, 2010 10:27 pm
by kgsws-CZ
randy wrote:It would be better if it was compatible with GZDoom's 3D floors.
That is not so easy, i used transfer_heights because it already has some sprite clipping code assigned with it, and it allows to make only one fake floor.
My changes in renderer allows only one fake floor per real sector, and because of that, sprite ordering is a lot easier.

I have done more experiments (not included in diff) - zdoom can have full 3D floors support, but it will need totally new system of sprite sorting that will count with fake floors. I have no idea about this new algorithm.
I can make 3D floors rendering without correct sorting right now. It will show all 3D floors, but sprites and/or floors will be overdrawn in most cases.
And bad thing, i have problems with sloped fake floors - if you make sloped fake floor that is touching real floor, it is not drawn correctly - as you can see in my example wad, that sloped floor is not begining at real floor (take a closer look).
Anyway, i guess that sprite + fake floor sorting algorithm with slopes support will be even more complicated.

Re: Translucent (3D) water

Posted: Wed Apr 21, 2010 6:28 am
by StrikerMan780
But hey, imagine what could be done if you managed to pull it off. Take your time.

Re: Translucent (3D) water

Posted: Wed Apr 21, 2010 8:12 am
by Scuba Steve
Translucent water CAN be done with the current renderer... but it's really half-assed. Through a combination of Stacked sectors, transfer heights and multiple sprites it can be done to a lame degree. The effect can be seen in the river and Office fountain in Urban Brawl... but, like you said, the downside is that it clips sprites at the water level... which can be fixed for static sprites by adding a duplicate on the underside of the portal.

Re: Translucent (3D) water

Posted: Wed Apr 21, 2010 4:12 pm
by Blzut3
kgsws-CZ wrote:I can make 3D floors rendering without correct sorting right now. It will show all 3D floors, but sprites and/or floors will be overdrawn in most cases.
And bad thing, i have problems with sloped fake floors - if you make sloped fake floor that is touching real floor, it is not drawn correctly - as you can see in my example wad, that sloped floor is not begining at real floor (take a closer look).
Anyway, i guess that sprite + fake floor sorting algorithm with slopes support will be even more complicated.
I'll take unsloped 3D floors only over no 3D floors at all. If the renderer at least attempts slopes all the better, but as I said, I would like to see something happen rather than nothing at all.