Page 1 of 1

Lit liquids

Posted: Fri Sep 16, 2016 2:56 am
by mankrip
How hard would it be to implement support for lit liquids in hardware-accelerated engines? In software rendering it's easy, but software-rendered engines will never be the main target for any mapper nowadays.
Image

I am really not aware of the technical difficulties, since I've never tried to learn how hardware-accelerated engines works. All that's needed is to draw both the lighting and the liquids in a single pass, using turbulent projection for the liquid texture and regular projection for the lighting, and combining them together before blending them into the framebuffer.

Support in mapping tools is almost there. The latest TyrUtils needs liquid brushes to be compiled as func_detail with _dirt -1, but hopefully this won't be needed anymore in the next versions.

I remember Spike saying that FTEQW also supports this, but several other engines would also need this feature.

Re: Lit liquids

Posted: Fri Sep 16, 2016 2:40 pm
by Spike
it depends on the implementation.
FTE just uses glsl for water, so its just a case of providing it with a second texture+texcoords that it can sample from just like any other lit surface.
Without glsl, you just need to use multitexture to combine(modulate will do it, which saves trying to use register-combiners - this is separate from glBlendFunc) the two textures before it hits the screen (that's the glBlendFunc part). again two sets of texture coords. In vanilla its really no different from other lit surfaces, just with some per-vertex texture coord modifications.
On the other hand, quakespasm's crazy render-to-texture implementation is crazy, but it should be fine to just sample from that warped texture in exactly the same way as any unlit surface.

DP supports lit water.

Re: Lit liquids

Posted: Fri Sep 16, 2016 5:53 pm
by ericw
Just made a commit to tyrutils-ericw so lit liquids never receive dirtmapping

Re: Lit liquids

Posted: Fri Sep 16, 2016 10:09 pm
by Baker
@mk --- working with the software renderer is hard. OpenGL is easy.

You could use this FitzQuake 0.85 that compiles by just pressing F5 (download) . You just open the project and click Build and you are in business instantly.

Has a project file for multiple IDEs (vc6, free Visual Studio 2008 (download | SP1 patch), CodeBlocks+MinGw (download).

Rendering code for the .bsp is nearly the same as Quakespasm.

You might be able to stir up the masses with a demonstration in an engine that the Func crowd is familiar with where they could play with it.

/One thought ... I'm not often right about these things. :mrgreen:

Re: Lit liquids

Posted: Sat Sep 17, 2016 7:37 pm
by toneddu2000
Baker wrote:You could use this FitzQuake 0.85 that compiles by just pressing F5 (download) . You just open the project and click Build and you are in business instantly.
That's true! I tested it now and it's really that easy! :biggrin: I wish FTEQW would be so simple to compile on my VS2015.. mmgrgrrrrrr :evil:

Re: Lit liquids

Posted: Sun Sep 18, 2016 8:51 pm
by Baker
toneddu2000 wrote:That's true! I tested it now and it's really that easy! :biggrin:
Hehe :lol: Made it as a way so someone new could at least get started playing with engine code with a pretty decent modernish engine.

Re: Lit liquids

Posted: Mon Sep 19, 2016 11:28 am
by toneddu2000
Are you the author of FitzQuake engine? If so, wow, compliments! It's very well written (I can't consider myself a real programmer but I can now understand good code structure)! :biggrin:

Re: Lit liquids

Posted: Wed Sep 21, 2016 4:21 am
by Baker
toneddu2000 wrote:Are you the author of FitzQuake engine? .... It's very well written
No, metlslime who runs Func_Msgboard is the author of FitzQuake.

But his engine was the first engine I ever tried to mod and I spent quite a bit of time learning about the inside of his very nice written engine.

The more time I spent understanding FitzQuake's code, the more and more I liked the code.

Re: Lit liquids

Posted: Wed Sep 21, 2016 7:16 am
by toneddu2000
Baker wrote:No, metlslime who runs Func_Msgboard is the author of FitzQuake.
ok, thanks
Baker wrote:The more time I spent understanding FitzQuake's code, the more and more I liked the code.
yeah, as a non-programmer, I found it awesome too!

Re: Lit liquids

Posted: Fri Sep 23, 2016 6:21 am
by Baker
@mk

You like .lit water.

Why not recompile start, e1m1 through e1m8, with lit water and throw in a zip.

Then do a release @ func of called "Lit water shareware episode"

Works with FTEQW (link to current engine executable since current version is hard to find, and now FTEQW is pretty classic feeling when you are playing the game) and DarkPlaces.

Then people could play with it.

Who has seen it in action? You. Spike. Maybe ericw. And no one else in the known universe.

Maybe if people experienced it ....