ajout d'effet de post processing et réparation des graines
This commit is contained in:
33
common/vfx/materials/shaders/blur_vignette.gdshader
Normal file
33
common/vfx/materials/shaders/blur_vignette.gdshader
Normal file
@@ -0,0 +1,33 @@
|
||||
shader_type canvas_item;
|
||||
|
||||
uniform sampler2D screen_texture: hint_screen_texture, repeat_disable, filter_linear_mipmap;
|
||||
uniform float blur_radius : hint_range(0, 1) = 0.2; // Radius of the blur effect
|
||||
uniform float blur_amount : hint_range(0, 5) = 1.0; // Strength of the blur effect
|
||||
uniform float blur_inner : hint_range(0, 1) = 0.6; // Inner edge of the blur effect
|
||||
uniform float blur_outer : hint_range(0, 1) = 0.66; // Outer edge of the blur effect
|
||||
|
||||
void fragment() {
|
||||
// Original color of the pixel from the screen
|
||||
vec4 pixelColor = texture(screen_texture, UV);
|
||||
|
||||
// Color with blur effect from the screen
|
||||
vec4 blurColor = textureLod(screen_texture, SCREEN_UV, blur_amount);
|
||||
|
||||
// Calculate distance from the center of the screen
|
||||
float distance = length(UV - vec2(0.5, 0.5));
|
||||
|
||||
// Apply smoothstep function to control transition between areas
|
||||
float blur = smoothstep(blur_inner - blur_radius, blur_outer, distance);
|
||||
|
||||
// Mix colors of the blur effect and the original color based on the smoothstep value
|
||||
pixelColor.rgb = mix(blurColor.rgb, COLOR.rgb, -blur);
|
||||
|
||||
// Set the alpha component of the blur effect to the smoothstep value
|
||||
blurColor.a = blur;
|
||||
|
||||
// Mix colors of the blur effect with white for an additional effect
|
||||
blurColor.rgb = mix(blurColor.rgb, vec3(1.0), 0.1);
|
||||
|
||||
// Set the final color to the modified color of the blur effect
|
||||
COLOR = blurColor;
|
||||
}
|
||||
1
common/vfx/materials/shaders/blur_vignette.gdshader.uid
Normal file
1
common/vfx/materials/shaders/blur_vignette.gdshader.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cfj18vc04cgkg
|
||||
40
common/vfx/materials/shaders/screen_fog.gdshader
Normal file
40
common/vfx/materials/shaders/screen_fog.gdshader
Normal file
@@ -0,0 +1,40 @@
|
||||
// Based on https://godotshaders.com/shader/screen-smoke-fog/
|
||||
shader_type canvas_item;
|
||||
render_mode blend_mix;
|
||||
|
||||
// Stuff related to camera position and offsets
|
||||
uniform vec2 camera_position;
|
||||
uniform vec2 camera_offset;
|
||||
uniform float camera_position_speed: hint_range(0.0, 1.0) = 0.025;
|
||||
uniform float camera_offset_speed: hint_range(0.0, 1.0) = 0.025;
|
||||
|
||||
// Uniforms for customization
|
||||
uniform sampler2D noise_texture_1 : repeat_enable;
|
||||
uniform sampler2D noise_texture_2 : repeat_enable;
|
||||
uniform float noise_blend : hint_range(0.0, 1.0) = 1.0;
|
||||
uniform float noise_speed_1 : hint_range(0.0, 1.0) = 1.0;
|
||||
uniform float noise_speed_2 : hint_range(0.0, 1.0) = 1.0;
|
||||
uniform vec2 noise_dir_1 = vec2(1.0,+1.0);
|
||||
uniform vec2 noise_dir_2 = vec2(1.0,-1.0);
|
||||
uniform vec3 smoke_color : source_color = vec3(0.8);
|
||||
uniform float density : hint_range(0.0, 1.0) = 1.0;
|
||||
|
||||
void fragment() {
|
||||
vec2 offset = ( (camera_position * camera_position_speed) + (camera_offset * camera_offset_speed) );
|
||||
|
||||
vec2 time_offset_1 = TIME * noise_dir_1 * noise_speed_1 * 0.1;
|
||||
vec2 time_offset_2 = TIME * noise_dir_2 * noise_speed_2 * 0.1;
|
||||
|
||||
// Create distorted UV and sample final noise
|
||||
vec2 distorted_uv_1 = UV + time_offset_1 + vec2(offset.x,offset.y * 1.75) * 0.1;
|
||||
vec2 distorted_uv_2 = UV + time_offset_2 + vec2(offset.x,offset.y * 1.75) * 0.1;
|
||||
|
||||
vec4 final_noise_1 = texture(noise_texture_1, distorted_uv_1);
|
||||
vec4 final_noise_2 = texture(noise_texture_2, distorted_uv_2);
|
||||
float mixed_noise = mix(final_noise_1, final_noise_2, noise_blend).r;
|
||||
|
||||
float smoke_alpha = mixed_noise * density;
|
||||
|
||||
// Output color
|
||||
COLOR = vec4(smoke_color, smoke_alpha);
|
||||
}
|
||||
1
common/vfx/materials/shaders/screen_fog.gdshader.uid
Normal file
1
common/vfx/materials/shaders/screen_fog.gdshader.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://btgk5l0a6ii44
|
||||
Reference in New Issue
Block a user