- BubbleTrail.gd: GPUParticles3D, auto-configured in _ready, set_intensity() API - BlockBreakParticles.gd: one_shot burst, emit_burst(pos, color) API - DolphinController.gd: bubble_trail onready + speed_factor hook in _update_movement - Dolphin.tscn: BubbleEmitterPoint (0,0,1.2) > BubbleTrail child added Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
34 lines
872 B
Plaintext
34 lines
872 B
Plaintext
shader_type spatial;
|
|
render_mode unshaded, blend_add, depth_draw_never, cull_disabled;
|
|
|
|
uniform vec3 caustic_color : source_color = vec3(0.5, 0.8, 1.0);
|
|
uniform float intensity : hint_range(0, 3) = 1.5;
|
|
uniform float scale = 8.0;
|
|
uniform float speed = 0.5;
|
|
|
|
float caustic_pattern(vec2 uv) {
|
|
float t = TIME * speed;
|
|
vec2 p = uv * scale;
|
|
float c = 0.0;
|
|
c += sin(p.x + t) * 0.5;
|
|
c += cos(p.y + t * 0.7) * 0.5;
|
|
c += sin(p.x * 0.7 + p.y * 0.5 + t * 1.3) * 0.3;
|
|
c = abs(c);
|
|
c = smoothstep(0.2, 0.0, c);
|
|
return c;
|
|
}
|
|
|
|
void fragment() {
|
|
vec2 uv = UV * 2.0 - 1.0;
|
|
float c1 = caustic_pattern(uv);
|
|
float c2 = caustic_pattern(uv * 1.3 + vec2(0.5, 0.3));
|
|
float caustics = (c1 + c2 * 0.5) * intensity;
|
|
|
|
// Fade avec profondeur
|
|
float depth_fade = clamp((VERTEX.y + 60.0) / 80.0, 0.0, 1.0);
|
|
caustics *= depth_fade;
|
|
|
|
ALBEDO = caustic_color * caustics;
|
|
ALPHA = caustics;
|
|
}
|