Lit liquids
Moderator: InsideQC Admins
10 posts
• Page 1 of 1
Lit liquids
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.

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.

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.
-

mankrip - Posts: 915
- Joined: Fri Jul 04, 2008 3:02 am
Re: Lit liquids
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.
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: 2892
- Joined: Fri Nov 05, 2004 3:12 am
- Location: UK
Re: Lit liquids
Just made a commit to tyrutils-ericw so lit liquids never receive dirtmapping
- ericw
- Posts: 92
- Joined: Sat Jan 18, 2014 2:11 am
Re: Lit liquids
@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.
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.
The night is young. How else can I annoy the world before sunsrise?
Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
-

Baker - Posts: 3666
- Joined: Tue Mar 14, 2006 5:15 am
Re: Lit liquids
That's true! I tested it now and it's really that easy!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.
Meadow Fun!! - my first commercial game, made with FTEQW game engine
- toneddu2000
- Posts: 1352
- Joined: Tue Feb 24, 2009 4:39 pm
- Location: Italy
Re: Lit liquids
Hehetoneddu2000 wrote:That's true! I tested it now and it's really that easy!
The night is young. How else can I annoy the world before sunsrise?
Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
-

Baker - Posts: 3666
- Joined: Tue Mar 14, 2006 5:15 am
Re: Lit liquids
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)! 
Meadow Fun!! - my first commercial game, made with FTEQW game engine
- toneddu2000
- Posts: 1352
- Joined: Tue Feb 24, 2009 4:39 pm
- Location: Italy
Re: Lit liquids
No, metlslime who runs Func_Msgboard is the author of FitzQuake.toneddu2000 wrote:Are you the author of FitzQuake engine? .... It's very well written
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?
Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
-

Baker - Posts: 3666
- Joined: Tue Mar 14, 2006 5:15 am
Re: Lit liquids
ok, thanksBaker wrote:No, metlslime who runs Func_Msgboard is the author of FitzQuake.
yeah, as a non-programmer, I found it awesome too!Baker wrote:The more time I spent understanding FitzQuake's code, the more and more I liked the code.
Meadow Fun!! - my first commercial game, made with FTEQW game engine
- toneddu2000
- Posts: 1352
- Joined: Tue Feb 24, 2009 4:39 pm
- Location: Italy
Re: Lit liquids
@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 ....
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?
Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
-

Baker - Posts: 3666
- Joined: Tue Mar 14, 2006 5:15 am
10 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest