Procedural Cyclic Slash

Procedural Cyclic Slash

Get the code for this shader here -> https://godotshaders.com/shader/procedural-cyclic-slash/

This is a really jank shader, but it looks pretty nice when the values are just right. So that's what this post is for! I'll help you with understanding the uniforms and value setup and leave some general tips so you can experiment easily on your own.

Quick Setup

Here is a quick rundown on how to get something similar to the video above:

Create a MeshInstance3D node and set the mesh to QuadMesh

Apply the shader as a Material Override (GeometryInstance3D -> Geometry)

Set these values:

Animation.Derive_Progress = -1 Animation.Time_Scale = 0.25 Shape.Rotate_All = 285 Shape.Noise = - New NoiseTexture2D - - Width = 512 - - Height = 128 - - Seamless = True - - Noise = - - - New FastNoiseLite - - - - Noise_Type = Cellular - - - - Fractal.Gain = 4 - - - - Cellular.Distance_Function = Manhattan Shape.Width_Gradient_Mask = - New GradientTexture1D - - Gradient = - - - New Gradient - - - - Offsets: 0.2, 0.5, 0.52 - - - - Colors: #FFFFFF, #000000, #FFFFFF Shape.Length_Gradient_Mask = - New GradientTexture1D - - Gradient = - - - New Gradient - - - - Offsets: 0.25, 0.4, 0.6, 0.65, 0.7 - - - - Colors: #FFFFFF, #7F7F7F, #000000, #7F7F7F, #FFFFFF Shape.Highlight = - New GradientTexture1D - - Gradient = - - - New Gradient - - - - Offsets: 0.5, 0.52, 0.54 - - - - Colors: #000000, #FFFFFF, #000000 Coloring.Color_Lookup = - New GradientTexture1D - - Gradient = - - - New Gradient - - - - Offsets: 0.0, 0.1, 0.2 - - - - Colors: #BF40BF, #008080, #ADD8E6

Overview

This shader works by taking a noise texture and wrapping it around the center point of UV1. The curved noise texture is then masked twice to set its width and "length" and an additional texture is applied to add a highlight effect. The shader uses values of gray, a lookup texture, and UV.x to apply colours. Lastly, motion is created by shifting the UV sample of the original noise texture and running the combined grayscale texture through a smooth step function to determine its alpha. This is a text-based shader written in Godot's Shading Language. Sorry, I can't help you implement it in Unity or some other engine or software. --

Animation Uniforms

The Progress uniform sets what point in time the shader is in. This only works when the Derive Progress uniform is set to (0). You can pretty much use the progress uniform to scrub through the shader's animation. If you set the progress value in code or through an animation player, you can control the animation as you like. Derive Progress changes what drives the shader's animation. If set to (-1), TIME will progress the animation. If it animates too quickly, you can use Time Scale to speed it up or slow it down. If set to (1) the particle LIFETIME will progress the animation. This is useful if you plan to set this shader as the material of a particle in a GPUParticles3D or CPUParticles3D. Ease Progress gives you a bit of control over how the shader's animation progresses if you are driving it with TIME or LIFETIME. When set to (0) no easing will occur. (-1) Will ease in exponentially and (1) Will ease out exponentially, but if you have the chops you can tweak this by changing the functions in the shader code. Time Scale alters the speed of the animation when Derive Progress is set to (-1). Anim Rot Amt controls how much the shader rotates as it animates. Set it to (0) if you want the effect to remain in the same place instead of rotating around the center of UV1. This value is put through an easing function, so it doesn't adjust linearly. I personally, wouldn't try setting this to anything other than (0) or (1). --

Shape Uniforms

Zoom controls the size of the effect on the quad. The value is interpreted inversely, so setting a larger value will make it smaller. The effect will repeat if you set this value above (1). Rotate All lets you rotate the effect on the quad. Use degrees. Base Noise generates the main shape for this effect. You can use any type of noise and I encourage you to experiment. Just make sure it's seamless so you don't get any odd artifacts. By setting the noise to be wider than it is tall, you can stretch out the shapes it makes which I think better resembles a slash. Decreasing the dimensions of the noise can lead to bigger streak blobs and softer-looking shapes depending on the noise used. I'd look into this if you want a more stylized/cartoon-looking effect.

Procedural Cyclic Slash

Width Gradient Mask masks the Base Noise in a way that controls the width of the final effect. Like Base Noise this will be wrapped around the center point of UV1 so I suggest using a GradientTexture1D. You can do some cool things here if you're willing to experiment (and possibly alter the code) just make sure this is set to a grayscale image. The way I wrote the math dictates that darker colours will be kept and light colours will clip, so use white to control what to cut out and black to control what to keep. A gradient that transitions from white to black back to white is a good place to start.

Procedural Cyclic Slash

Length Gradient Mask masks the Base Noise in a way that controls the "length" of the final effect. This also controls how it animates sorta. I can't really explain it, but how this overlays the noise will alter how the smooth step function works... I think. White denotes the edges and Black the center. If you use a gradient here, moving the white values closer to the center can help with shaping. I also suggest using gray so you can better shape the length of the effect.

Procedural Cyclic Slash

Highlight is overlayed on the effect. like everything else, it is wrapped around the center point of UV1. A thin white stripe works best. Unlike the other textures this one is played straight, so black won't appear and white will. Moving the white stripe closer to the right edge of the gradient will move the highlight effect to the outside of the slash, left will move it inside. I like to set it so it's a bit closer to the right so it appears on the outer edge. If you don't want a highlight at all leave this uniform empty. --

Coloring Uniforms

Emission Strength controls how much it glows. If it doesn't glow in the editor, add a world environment node and enable glow, you will also need this in your game scenes fyi. Mix Strength controls how much the Color Lookup is applied to the effect. If Color Lookup is applied, decreasing this value will give a darker appearance. At (0), the effect (excluding the highlight) will appear black. You can add extra glow by increasing this above (1).

Procedural Cyclic Slash

Color Lookup is used to color the effect. I think I screwed up the math, so just ensure the colors you want the shader to sample from are close to the left side of what you set here. Three colors is pretty nice, I like to put darker colors closer to the left side and lighter ones to the right. --

Final Notes

Sorry for this lengthy post. I've had issues before where a shader I found on GodotShaders was a bit obtuse and I didn't want others to run into that with this one. I've spent quite some time trying to figure this out but I still feel this is a pretty meh effect. I think I need to look into how people animate shaders using a static image and clipping/stepping/smooth stepping it. If you have any good resources for shaders I'd be interested to hear about them. I'd prefer not to get any articles about visual or node-based shaders since I keep fumbling how to convert some nodes into functions or what sorta math is going on, but at this rate, I'll take whatever I can get lol. Hopefully, this shader saves you some time or teaches you something new! If you have any questions (and I can answer them) don't hesitate to ask. However, I'd prefer if you contacted me on Discord. I'm in Godot Café, Godot Engine, and the Godot Effects and Shaders discord servers as (@)Aiwi.

More Posts from Alkaliii and Others

7 months ago

Stacking

Very useful feature, totally not a pain to work with due to the submenus needed to select what you're acting on and then select what you're doing... I plan to make this a gimmick in at least one dungeon but maybe I should look into streamlining the process before that haha.


Tags
2 years ago

Yellow Yellow, this is content that would have probably appeared on twitter in the middle of 2023...

Yellow Yellow, This Is Content That Would Have Probably Appeared On Twitter In The Middle Of 2023...

Tags
1 year ago

Tower

Tower
Tower
Tower
Tower

Doing the bricks on the bottom was heck. I guess this is a good time to tell you this specific one won't be in the game... not because it's bad or anything but because while porting to Godot 4 I switched to 3D. So now I have to model the bricks on the bottom... heck. At least you'll be able to jump from rooftops to rooftops... hopefully


Tags
1 month ago

Explosives

Explosives

So I sorta like to develop by copying Zelda's homework. In this case, that means adding a bomb object. You can bomb jump with it, although not as crazy as the BOTW speedrun tech shenanigans lol.

I plan for the player to use this when they need MORE destructive power to proceed. I guess I should work on a breakable wall model.

You can wishlist this game on Steam! -> https://store.steampowered.com/app/3163190


Tags
2 years ago

Oct 14, 2021

This was a quick and dirty test but, it was the best I could do. 2D VFX is really hard if you don't want to draw every frame and you don't know how to use shader graph shiz and whatever. I hope I can do better in the future, but uh technically I'm future me and I haven't touched VFX since...


Tags
2 years ago

Mar 12, 2022

Mar 12, 2022
Mar 12, 2022

not gonna lie I think I started to code a bit again in march... Thats good, I was convinced I wasted a year churning up ideas.


Tags
9 months ago

added some big windows to my train station

Added Some Big Windows To My Train Station
1 year ago

Discord Rich Presence...

Discord Rich Presence...

was this necessary to add right now, no was this easy to add and another means of attaining validation and visible progress... yes


Tags
Loading...
End of content
No more pages to load
  • alkaliii
    alkaliii reblogged this · 5 months ago
  • aplovestudio
    aplovestudio reblogged this · 5 months ago
  • aplovestudio
    aplovestudio liked this · 5 months ago
  • kanetain2
    kanetain2 liked this · 5 months ago
  • tokenlad
    tokenlad liked this · 5 months ago
  • yippee-was-taken
    yippee-was-taken reblogged this · 5 months ago
  • yippee-was-taken
    yippee-was-taken liked this · 5 months ago
  • bloody-seepin-g-moi
    bloody-seepin-g-moi liked this · 5 months ago
  • jeroto
    jeroto reblogged this · 5 months ago
  • jeroto
    jeroto liked this · 5 months ago
  • bycubed7
    bycubed7 liked this · 5 months ago
  • depravedhomosexual
    depravedhomosexual reblogged this · 5 months ago
  • szmeew
    szmeew liked this · 5 months ago
  • cuumori
    cuumori liked this · 5 months ago
  • dinosaur-unicorns
    dinosaur-unicorns liked this · 5 months ago
  • alkaliii
    alkaliii reblogged this · 5 months ago
alkaliii - pearlessential
pearlessential

A blog for a game about a rather peculiar exam. Made in Godot Engine!

200 posts

Explore Tumblr Blog
Search Through Tumblr Tags