Procedural Water/Fluid Shader

Forum rules
The Projects forums are only for projects. If you are asking questions about a project, either find that project's thread, or start a thread in the General section instead.

Got a cool project idea but nothing else? Put it in the project ideas thread instead!

Projects for any Doom-based engine (especially 3DGE) are perfectly acceptable here too.

Please read the full rules for more details.
User avatar
RiboNucleic Asshat
Posts: 501
Joined: Thu May 09, 2013 8:15 pm
Discord: Ribonucleic Asshat#6969
Twitch ID: ribonucleicasshat
Graphics Processor: nVidia with Vulkan support
Location: Exactly where I am

Procedural Water/Fluid Shader

Post by RiboNucleic Asshat »

Simple shader that replaces the vanilla water animations with a smoother procedural one, based on voronoi cells.
Only for Doom! Does not work in the Raven games!



Rather hefty on the GPU for how simple the effect is, and only water is fully accurate to the original texture, buuuut... I like how it looks. Plus, maybe someone could sift through the mess of a shader I wrote and use it as inspiration.

DOES NOT WORK WITH CUSTOM WATER ANIMATIONS THAT USE MORE FRAMES THAN VANILLA. This means it's borked in BTSX and other similar wads.

IT DOES, however, support custom palettes. The shader uses a small LUT in Doom graphics format, which means it'll change with the palette.

DOWNLOAD!!!

(or don't)
fluidshader-1.3.pk3
You do not have the required permissions to view the files attached to this post.
Last edited by RiboNucleic Asshat on Sat Apr 06, 2019 10:40 pm, edited 2 times in total.
User avatar
NightFright
Spotlight Team
Posts: 1278
Joined: Fri May 02, 2008 12:29 pm
Location: Germany

Re: Procedural Water/Fluid Shader

Post by NightFright »

This looks interesting, but unfortunately it won't work for me. Ultimate Doom crashes with an error when trying to load the game and Doom II is loading but liquids still look just the way they used to before. I wouldn't say I have the wrong hardware for this since I am using a Geforce 1070, also with latest version of GZDoom (3.7.2).
User avatar
RiboNucleic Asshat
Posts: 501
Joined: Thu May 09, 2013 8:15 pm
Discord: Ribonucleic Asshat#6969
Twitch ID: ribonucleicasshat
Graphics Processor: nVidia with Vulkan support
Location: Exactly where I am

Re: Procedural Water/Fluid Shader

Post by RiboNucleic Asshat »

That's odd, I have an NVIDIA card too (GTX 970) and have no issues. Are there any errors in the console, or what error does trying to load Ultimate Doom give you? I'm afraid that my knowledge of device-specific GLSL quirks is rather lacking, so I'm uncertain what could cause that.

EDIT: Ok, so it turns out the crashing with UDoom was because there are no SLIME0* textures in Doom 1, and apparently using missing textures in GLDEFS just straight-up crashes the engine instead of giving an error, so that's fixed now. Still uncertain why it wouldn't work in Doom 2, though.
User avatar
NightFright
Spotlight Team
Posts: 1278
Joined: Fri May 02, 2008 12:29 pm
Location: Germany

Re: Procedural Water/Fluid Shader

Post by NightFright »

Does it maybe require a certain option to be activated in the menus? As far as I know I should have all eye-candy-related options activated, though. Also shouldn't be running any mods that could collide with this, just the spritefix project, PerK's sound improvements and a statusbar mod. Nothing that contains its own gldefs file, even though that shouldn't matter.

And yes, GZDoom crashing because it doesn't find textures isn't exactly the best way to handle the issue. I would have rather expected a warning message.
User avatar
RiboNucleic Asshat
Posts: 501
Joined: Thu May 09, 2013 8:15 pm
Discord: Ribonucleic Asshat#6969
Twitch ID: ribonucleicasshat
Graphics Processor: nVidia with Vulkan support
Location: Exactly where I am

Re: Procedural Water/Fluid Shader

Post by RiboNucleic Asshat »

Can you try running it on a completely clean version of GZDoom (no ini or extra files loaded at all)? There shouldn't be any options or CVARs that would disable the shader. The only thing I can think of is that somehow your flat names are different, or possibly the shader is silently failing to compile in the background.
User avatar
NightFright
Spotlight Team
Posts: 1278
Joined: Fri May 02, 2008 12:29 pm
Location: Germany

Re: Procedural Water/Fluid Shader

Post by NightFright »

Just remembered one thing: I am using custom brightmaps which are also applied to some textures, among them liquids. Could those interfere with the shader?
User avatar
RiboNucleic Asshat
Posts: 501
Joined: Thu May 09, 2013 8:15 pm
Discord: Ribonucleic Asshat#6969
Twitch ID: ribonucleicasshat
Graphics Processor: nVidia with Vulkan support
Location: Exactly where I am

Re: Procedural Water/Fluid Shader

Post by RiboNucleic Asshat »

Ah! That could be it! Brightmaps are applied with a shader, so if you've got brightmaps that match up to the liquid textures (even if they're all black, which would be... wasteful) it's possible that it's going to knock out the water shader. If that isn't it, then I'm genuinely stumped. I would need more people to test it on a variety of systems and report any issues.
User avatar
Zackdoessomething
Posts: 21
Joined: Sat Nov 25, 2017 1:48 am
Discord: Zacko238(Vallena)#8203
Location: Spaghetti Land

Re: Procedural Water/Fluid Shader

Post by Zackdoessomething »

Hey i gotta say,
t h a t s s o m e n i c e a n i m a t i o n s B-)
no really, that is very cool to look at! btw, can you make a FreeDooM version of it if you want to? because i like it's liquids more than Doom's. :thumb:
User avatar
NightFright
Spotlight Team
Posts: 1278
Joined: Fri May 02, 2008 12:29 pm
Location: Germany

Re: Procedural Water/Fluid Shader

Post by NightFright »

Two question from my side:
1) Lava isn't included on purpose?
2) Would you also consider making these shaders for Heretic?

I still need to try getting these to work with my brightmaps. Right now I don't have access to my computer, so it'll have to wait.
User avatar
RiboNucleic Asshat
Posts: 501
Joined: Thu May 09, 2013 8:15 pm
Discord: Ribonucleic Asshat#6969
Twitch ID: ribonucleicasshat
Graphics Processor: nVidia with Vulkan support
Location: Exactly where I am

Re: Procedural Water/Fluid Shader

Post by RiboNucleic Asshat »

The reason certain textures aren't included is because this particular method can't accurately recreate those textures; I'll have to find a different procedural method. Those include one of the SLIME* animations (can be seen in Plutonia MAP01; it won't be replaced) and lava. Brightmaps won't ever work with this shader unless it's modified to use custom logic (though I feel it would be more appropriate if GZDoom were to override the brightmap shader and not vice versa in situations like this). Lighting is a component of any texture shader, so "brightmaps" can be created by simply not multiplying it in to varying degrees.

Currently I've got a fair few other projects tying me up, but perhaps I can get around to doing it later. I'll try to finish Doom's liquids first then move on to other games.
User avatar
doomfiend
Posts: 526
Joined: Sun Aug 27, 2006 6:10 am
Location: some where

Re: Procedural Water/Fluid Shader

Post by doomfiend »

Would one be interested as releasing these as animated textures? I'd totally like test Normal / Specular maps to these liquids xD
User avatar
RiboNucleic Asshat
Posts: 501
Joined: Thu May 09, 2013 8:15 pm
Discord: Ribonucleic Asshat#6969
Twitch ID: ribonucleicasshat
Graphics Processor: nVidia with Vulkan support
Location: Exactly where I am

Re: Procedural Water/Fluid Shader

Post by RiboNucleic Asshat »

Hey, guess who's stupid? Yes, it's this girl right here!

I've fixed the issue with texture resizing breaking the shader. Turns out hardcoding numbers for the resolution isn't a good idea after all, who'da thunk!
User avatar
MFG38
Posts: 399
Joined: Sun Apr 14, 2019 8:26 am
Graphics Processor: nVidia (Modern GZDoom)
Location: Finland

Re: Procedural Water/Fluid Shader

Post by MFG38 »

Love the look of this. I want to try using this with a custom texture at some point. :D

Return to “Shaders”