Omen’s Smoke Bomb from Valorant
Recreation of Omen’s Smoke Bomb from Valorant in Godot!
How to use:
Create a new MeshInstance, give it a sphere mesh.
Apply the shader below to it.
Put any type of Noise Texture (<- Idk the license so be careful) in the “Smoke Texture” slot
Parameters:
Outer Color – Color of the outer part of the smoke bomb
Inner Color – Color of the inner circle of the smoke bomb
Time Scale – Speed of the the movement of the wind
Smoke Sharpness – Determines how the smoke texture is cut up
Dissolve – Used for making the fade in and fade out of the smoke bomb in your game
Edge Pulse – Strength of the displacement of the edges of the sphere
Apply Inside – Whether the effect should be visible inside the sphere
Smoke texture – Texture used for the smoke effect (Just use some kinda noise texture here)
Bonus:
The outer ring with the darker color is actually a separate sphere.
Create a second MeshInstance node and give it a sphere mesh as well.
Make it slightly larger than the inner sphere.
Apply this shader to it:
(THIS SHADER IS FOR THE OUTER SPHEREEE, THE OUTER SPHERE, SCROLL DOWN FOR THE INNER SPHERE SHADER!!!!!!!!)
// Outer Sphere shader for Omen's Smoke Bomb
// Recreation by NekotoArts (CC0 license)
shader_type spatial;
render_mode unshaded, cull_disabled;
uniform sampler2D smoke_texture : hint_albedo;
uniform vec4 color : hint_color = vec4(0.13, 0.09, 0.22, 1.0);
uniform float fade_size = 0.016;
uniform float fade_blend = 0.364;
uniform float smoke_sharpness = 0.869;
uniform float time_scale = 0.2;
uniform float height_fade = 3.4;
uniform float scissor = 0.457;
const float PI = 3.1415;
float fresnel(float amount, vec3 normal, vec3 view)
{
return pow((1.0 - clamp(dot(normalize(normal), normalize(view)), 0.0, 1.0 )), amount);
}
void fragment(){
// Smoke Texture
vec2 smoke_uv = UV - TIME * time_scale;
vec4 smoke_color = texture(smoke_texture, smoke_uv);
float smoke_buffer = smoothstep(0.0, smoke_sharpness, smoke_color.r);
// Coloring
ALBEDO = mix(vec3(0.0), color.rgb, smoke_buffer);
// Fresnel Fade
float fres = fresnel(2.0, NORMAL, VIEW);
fres = smoothstep(fade_size, fade_size + fade_blend, fres);
ALPHA = smoke_buffer;
ALPHA *= clamp(sin(UV.y * PI) * height_fade - (height_fade / 2.0), 0.0, 1.0);
ALPHA *= fres;
ALPHA_SCISSOR = scissor;
}
(^^^ For the outer sphere, not the inner one ^^^)
Shader code
// Omen's Smoke Bomb from Valorant
// Recreation by NekotoArts (CC0 License)
// No need for credit, just check out my YT channel maybe?
// I make a lot more Godot stuff there
// https://www.youtube.com/channel/UCD7K_FECPHTF0z5okAVlh0g
shader_type spatial;
render_mode unshaded, cull_disabled;
uniform sampler2D smoke_texture : hint_albedo;
uniform vec4 outer_color : hint_color = vec4(0.11, 0.09, 0.2, 1.0);
uniform vec4 inner_color : hint_color = vec4(0.24, 0.2, 0.37, 1.0);
uniform float time_scale = 0.2;
uniform float smoke_sharpness = 0.765;
uniform float dissolve : hint_range(-1.0, 1.0) = -1.0;
uniform float edge_pulse = 0.07;
uniform bool apply_inside = true;
const float PI = 3.1415;
float fresnel(float amount, vec3 normal, vec3 view)
{
return pow((1.0 - clamp(dot(normalize(normal), normalize(view)), 0.0, 1.0 )), amount);
}
float saturatef(float a){
return clamp(a, 0.0, 1.0);
}
void vertex(){
// Smoke Texture
vec2 smoke_uv = UV - TIME * time_scale;
vec4 smoke_color = texture(smoke_texture, smoke_uv);
VERTEX += NORMAL * smoke_color.r * edge_pulse * sin(UV.y * PI);
}
void fragment(){
// Check for front or back face
if (!apply_inside){
float frontiplier = FRONT_FACING ? 1.0 : -1.0;
NORMAL *= frontiplier;
}
// Inner Fresnel
float fres = fresnel(2, NORMAL, VIEW) * 5.0;
fres = saturatef(fres);
fres = 1.0 - fres;
// Outer Fresnel
float outer_fres = fresnel(5.0, NORMAL, VIEW) * 2.0;
outer_fres = saturatef(outer_fres);
// Smoke Texture
vec2 smoke_uv = UV - TIME * time_scale;
vec4 smoke_color = texture(smoke_texture, smoke_uv);
float smoke_buffer = smoothstep(0.0, smoke_sharpness, smoke_color.r);
// Overlay Smoke onto Fresnels
float overlay = mix(fres, 0.5, smoke_buffer);
overlay = mix(outer_fres, 1.0, overlay);
// Dissolve Effect
ALPHA = smoothstep(dissolve, 1.0, smoke_color.r);
ALPHA_SCISSOR = 0.5;
// Coloring the Effect
vec3 final_color = mix(outer_color.rgb, inner_color.rgb, overlay);
ALBEDO = final_color;
}
How to make it transparent?