garrysmod-requests
garrysmod-requests copied to clipboard
Reimplementation of JellyFish shader
The jellyfish shader has been absent from Garry's Mod for quite some time now, I'm not sure as to the specifics of it; though I've had to go to great lengths in order to get similar effects via refract and sub-surface scattering as shown here:
Problem is that this still doesn't get the desired result despite the constant material editing and param changing. Could we get this shader re-added to Garry's Mod with the adjustments it needs to get working?
According to https://developer.valvesoftware.com/wiki/JellyFish the shader is all sorts of broken, is it even useful at all?
I believe it's only broken in SDK 2013+, and the reason why is unknown (to me). The shader supposedly works in older SDKs, as also stated on the wiki. As for if it's useful, it's a one-of-a-kind shader that does some really cool surface texture effects that make it appear as if there's a fully modeled 3d core beneath the surface. This is gonna be a slightly large post due to images so I'm gonna spoiler most of it for browsing convenience:
What the Jellyfish shader does:
Here's the actual mesh of the Hydra imported into Blender, the only known asset to make use of this shader. Note how it has just one 3D surface, and only one material.
Now with it being shown ingame, you can see how this shader creates its namesake, the "Jellyfish" effect of sub-surface detail:
Here are the videos these screenshots are sourced from, it's much better to convey this effect in motion than from still images. https://www.youtube.com/watch?v=zQciWVIG7zo https://youtu.be/eFEVVvEN9s8?t=48
Weirdly, the shader/hydra has multiple materials despite only one being referenced on the model, and the VMT does not have any references to these either:
"JellyFish"
{
"$basetexture" "models/hydra/bodysplit"
"$gradienttexture" "models/hydra/gradient"
"$model" 1
}
Admittedly, I do not know if there is some shader magic or possibly NPC or engine hardcode hackery involved or not with how it loads these extra materials, given the model itself only references the one material. Perhaps this could be related to breakage in steampipe versions of the engine?
edit: figured I should include the vmt
The reason it doesn't work in the 2013 SDK is because the sources for JellyFish are non-existent in the materialsystem sources. Theoretically speaking it should be really easy to re-implement, just grab the sources from an older ver. of the SDK and throw them into 2013. Hopefully it should work without any changes being needed.
Edit 1: Forgor to mention though you still need to reference it in the vproject file that compiles them to the game otherwise it wont work
At that point, the last thing would be documentation. As for the use-case scenario, I believe @Vuthakral went over a pretty extensive means for the use of it; in my case specifically it's to recreate what Crysis does, which the JellyFish shader is pretty close to. This will at least let me get rid of refraction which can be pretty performance intensive when not set up properly or if there's more than 1 overlaying into eachother.
I am unable to make it function. No matter what I tried, including using the original textures from HL2 beta, the shader just renders as completely transparent.
Looking at the HL2 beta source code and what we have, the shader code is pretty much identical, minus some API differences, so I really don't know why it just doesn't do anything.
I have updated the wiki page to include all the material parameters the shader exposes. If you can make it do anything in HL2/EP2 or something (and provide me with the files to test), I might revisit this.
What exactly did you try with the sources to get them to be fully transparent? Are they transparent or are they completely non-existent?
"completely transparent" would mean fully invisible, or "non existent". I didn't "try anything with the sources", that's just how the shader renders without any modification, using materials mentioned above.
Are there no other additional parameters, similar to how the fleshshader has to be forced on via debug, or through a proxy then through an entity in LUA? If I were to guess, the Hydra itself could have some kind of "flag" or custom lua that forces that shader to run. If everything is identical, then that could be the only thing that comes to mind, at least for me.
No, I did not see any special rendering code in the npc_hydra sources.
Probably a stupid question, but is it possibly related to HDR that it's seemingly invisible when reimplemented?
I don't see how it relates at all.
Again, if you can get it to display anything (so that I can have a known good material for testing) in some other Source engine game that has it, I could look into it further. If not, then not.
@VpSnipes How can i contact you?
@Goldermor You can contact me via discord at: vp_snipes
I know someone who HAS successfully restored the jellyfish shader into working on Source SDK 2013, however I've been unable to contact them regarding this. I'll post again if I can get any updates.
Update: I established contact and here is the fixed jellyfish shader @robotboy655 jellyfish_shader.zip Credit to ToothpasteVixen for fixing it.
If/when this is pushed to Garry's Mod, I'll update the post with the changes and offer any feedback to the implementation of the shader. (if it's working as intended, if there's anything missing/improper, etc.)
bump, was the shader source provided by @epicplayer40 useful in getting this to work?
I can confirm that the fixed shader along with the instructions provided in the zip file do in fact work. Here's me having the shader fixed in sdk 2013:
I also can confirm the fix does work.
https://github.com/user-attachments/assets/42b8ece9-92bf-4ccf-b976-4f4c90af0e8c
Bumping this because there's still no response from Rubat.
I can also confirm these to work:
But I also would like to know where the shader sources came from (.fxc files) I am not seeing these in any of our licensee repos, not even in any leaks.
But I also would like to know where the shader sources came from (.fxc files) I am not seeing these in any of our licensee repos, not even in any leaks.
I'm pretty sure that they were custom made. I'll ask the author and update if I get a response.
I can also confirm these to work:
But I also would like to know where the shader sources came from (.fxc files) I am not seeing these in any of our licensee repos, not even in any leaks.
They are just the old .vsh/.psh shader logic ported over to HLSL along with the general boilerplate code used for studiomodel compatible shaders
Alright, I have restored the shader.
The jellyfish shader has been absent from Garry's Mod for quite some time now, I'm not sure as to the specifics of it; though I've had to go to great lengths in order to get similar effects via refract and sub-surface scattering as shown here:
Problem is that this still doesn't get the desired result despite the constant material editing and param changing. Could we get this shader re-added to Garry's Mod with the adjustments it needs to get working?
You should update the VDC documentation, or at least post some information about your experimentation here for posterity.
The jellyfish shader has been absent from Garry's Mod for quite some time now, I'm not sure as to the specifics of it; though I've had to go to great lengths in order to get similar effects via refract and sub-surface scattering as shown here:
Problem is that this still doesn't get the desired result despite the constant material editing and param changing. Could we get this shader re-added to Garry's Mod with the adjustments it needs to get working?
You should update the VDC documentation, or at least post some information about your experimentation here for posterity.
My "experiment" was there because of the lack of shader support for Jellyfish in order to achieve the result I needed. This is a three layer model stack with sub-surface as the top, refraction as the secondary, and the flesh shader as the primary. This is NOT a good solution and is performance taxing depending on how many instances (models) are present on screen. I'm pretty thankful Rubat got the shader up and running again, this cuts back on 3 material instances and brings it to one, @robotboy655 thank you for taking the time to do this btw it's a HUGE help with optimization.
@robotboy655
The JellyFish shader currently present in GMod is almost fully functional except for $envmap which still tries using the old logic and ends up breaking completely, luckily however ToothpasteVixen (same person who did the original port) did make an updated version with functional/fixed $envmap/cubemap support: jellyfish_v2.zip (just includes the changed files and not the whole thing)
Alright, I have merged those changes on x86-64 beta, please let me know if it all works correctly.