Forum

Lit liquids

Discuss programming topics for the various GPL'd game engine sources.

Moderator: InsideQC Admins

Lit liquids

Postby mankrip » Fri Sep 16, 2016 2:56 am

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
User avatar
mankrip
 
Posts: 914
Joined: Fri Jul 04, 2008 3:02 am

Re: Lit liquids

Postby Spike » Fri Sep 16, 2016 2:40 pm

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.
Spike
 
Posts: 2878
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Re: Lit liquids

Postby ericw » Fri Sep 16, 2016 5:53 pm

Just made a commit to tyrutils-ericw so lit liquids never receive dirtmapping
ericw
 
Posts: 91
Joined: Sat Jan 18, 2014 2:11 am

Re: Lit liquids

Postby Baker » Fri Sep 16, 2016 10:09 pm

@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 ..
User avatar
Baker
 
Posts: 3661
Joined: Tue Mar 14, 2006 5:15 am

Re: Lit liquids

Postby toneddu2000 » Sat Sep 17, 2016 7:37 pm

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:
toneddu2000
 
Posts: 1301
Joined: Tue Feb 24, 2009 4:39 pm
Location: Italy

Re: Lit liquids

Postby Baker » Sun Sep 18, 2016 8:51 pm

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 ..
User avatar
Baker
 
Posts: 3661
Joined: Tue Mar 14, 2006 5:15 am

Re: Lit liquids

Postby toneddu2000 » Mon Sep 19, 2016 11:28 am

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:
toneddu2000
 
Posts: 1301
Joined: Tue Feb 24, 2009 4:39 pm
Location: Italy

Re: Lit liquids

Postby Baker » Wed Sep 21, 2016 4:21 am

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 ..
User avatar
Baker
 
Posts: 3661
Joined: Tue Mar 14, 2006 5:15 am

Re: Lit liquids

Postby toneddu2000 » Wed Sep 21, 2016 7:16 am

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!
toneddu2000
 
Posts: 1301
Joined: Tue Feb 24, 2009 4:39 pm
Location: Italy

Re: Lit liquids

Postby Baker » Fri Sep 23, 2016 6:21 am

@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 ..
User avatar
Baker
 
Posts: 3661
Joined: Tue Mar 14, 2006 5:15 am


Return to Engine Programming

Who is online

Users browsing this forum: No registered users and 2 guests