Lit liquids

Discuss programming topics for the various GPL'd game engine sources.
Post Reply
mankrip
Posts: 924
Joined: Fri Jul 04, 2008 3:02 am

Lit liquids

Post 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.
Ph'nglui mglw'nafh mankrip Hell's end wgah'nagl fhtagn.
==-=-=-=-=-=-=-=-=-=-==
Dev blog / Twitter / YouTube
Spike
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK
Contact:

Re: Lit liquids

Post 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.
ericw
Posts: 92
Joined: Sat Jan 18, 2014 2:11 am

Re: Lit liquids

Post by ericw »

Just made a commit to tyrutils-ericw so lit liquids never receive dirtmapping
Baker
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Re: Lit liquids

Post 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:
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
toneddu2000
Posts: 1395
Joined: Tue Feb 24, 2009 4:39 pm
Location: Italy

Re: Lit liquids

Post 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:
Meadow Fun!! - my first commercial game, made with FTEQW game engine
Baker
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Re: Lit liquids

Post 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.
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
toneddu2000
Posts: 1395
Joined: Tue Feb 24, 2009 4:39 pm
Location: Italy

Re: Lit liquids

Post 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:
Meadow Fun!! - my first commercial game, made with FTEQW game engine
Baker
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Re: Lit liquids

Post 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.
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
toneddu2000
Posts: 1395
Joined: Tue Feb 24, 2009 4:39 pm
Location: Italy

Re: Lit liquids

Post 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!
Meadow Fun!! - my first commercial game, made with FTEQW game engine
Baker
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Re: Lit liquids

Post 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 ....
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
Post Reply