Commit 23cc7db1 authored by Gavin An's avatar Gavin An

불덩이 shader

parent 09d8045c
uid://b3msdt2fkhuny
shader_type spatial;
render_mode blend_mix, depth_draw_opaque, cull_back, diffuse_burley, specular_schlick_ggx;
uniform sampler2D albedo_tex : source_color, filter_linear_mipmap, repeat_enable;
uniform sampler2D noise_tex : filter_linear_mipmap, repeat_enable;
uniform vec4 albedo_color : source_color = vec4(1.0, 0.3, 0.0, 1.0);
uniform vec4 emission_color : source_color = vec4(1.0, 0.5, 0.1, 1.0);
uniform float emission_energy : hint_range(0.0, 100.0) = 5.0;
uniform vec2 panning_speed1 = vec2(0.5, 0.2);
uniform vec2 panning_speed2 = vec2(-0.3, 0.4);
uniform float displacement_strength : hint_range(0.0, 2.0) = 0.15;
uniform float displacement_speed = 3.0;
void vertex() {
// 버텍스 디스플레이스먼트
vec2 noise_uv = UV + vec2(TIME * displacement_speed * 0.1, TIME * displacement_speed * 0.05);
float noise_val = texture(noise_tex, noise_uv).r;
// 버텍스 노멀 방향으로 변위 적용
VERTEX += NORMAL * noise_val * displacement_strength;
}
void fragment() {
// 텍스처 패닝 적용
vec2 panning_uv1 = UV + TIME * panning_speed1;
vec2 panning_uv2 = UV + TIME * panning_speed2;
float tex_val1 = texture(albedo_tex, panning_uv1).r;
float tex_val2 = texture(noise_tex, panning_uv2).r;
float combined_noise = tex_val1 * tex_val2;
ALBEDO = albedo_color.rgb * combined_noise;
EMISSION = emission_color.rgb * (combined_noise + 0.3) * emission_energy;
ROUGHNESS = 0.8;
SPECULAR = 0.2;
}
[gd_scene format=3 uid="uid://b0huienupoit2"]
[ext_resource type="PackedScene" uid="uid://blm604moyxwsh" path="res://assets/models/projectiles/fireball/fire_ball.glb" id="1_fireball_glb"]
[ext_resource type="Material" uid="uid://bdva8hwtdvis7" path="res://src/entities/projectiles/fireball/fireball_material.tres" id="2_fireball_mat"]
[sub_resource type="Gradient" id="Gradient_sparks_color"]
offsets = PackedFloat32Array(0, 0.3, 0.7, 1)
colors = PackedColorArray(1, 0.9, 0.2, 1, 1, 0.5, 0, 1, 0.8, 0.1, 0, 1, 0.4, 0, 0, 0)
[sub_resource type="GradientTexture1D" id="GradientTexture1D_sparks_color"]
gradient = SubResource("Gradient_sparks_color")
[sub_resource type="Curve" id="Curve_sparks_size"]
_data = [Vector2(0, 1), 0.0, 0.0, 0, 0, Vector2(1, 0), -1.5, 0.0, 0, 0]
point_count = 2
[sub_resource type="CurveTexture" id="CurveTexture_sparks_size"]
curve = SubResource("Curve_sparks_size")
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_sparks"]
direction = Vector3(0, 0.5, 1)
spread = 20.0
initial_velocity_min = 1.5
initial_velocity_max = 3.0
gravity = Vector3(0, 0, -10)
scale_min = 0.6
scale_max = 1.3
scale_curve = SubResource("CurveTexture_sparks_size")
color_ramp = SubResource("GradientTexture1D_sparks_color")
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_sparks"]
transparency = 1
blend_mode = 1
shading_mode = 0
vertex_color_use_as_albedo = true
billboard_mode = 1
[sub_resource type="QuadMesh" id="QuadMesh_sparks"]
material = SubResource("StandardMaterial3D_sparks")
size = Vector2(0.1, 0.1)
[sub_resource type="Gradient" id="Gradient_smoke_color"]
offsets = PackedFloat32Array(0, 0.2, 0.8, 1)
colors = PackedColorArray(0.15, 0.15, 0.15, 0, 0.2, 0.2, 0.2, 0.5, 0.25, 0.25, 0.25, 0.4, 0.3, 0.3, 0.3, 0)
[sub_resource type="GradientTexture1D" id="GradientTexture1D_smoke_color"]
gradient = SubResource("Gradient_smoke_color")
[sub_resource type="Curve" id="Curve_smoke_size"]
_data = [Vector2(0, 0.4), 0.0, 1.2, 0, 0, Vector2(1, 1.2), 0.5, 0.0, 0, 0]
point_count = 2
[sub_resource type="CurveTexture" id="CurveTexture_smoke_size"]
curve = SubResource("Curve_smoke_size")
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_smoke"]
direction = Vector3(0, 1, 1)
initial_velocity_min = 0.5
initial_velocity_max = 1.2
gravity = Vector3(0, 2, -2)
scale_curve = SubResource("CurveTexture_smoke_size")
color_ramp = SubResource("GradientTexture1D_smoke_color")
[sub_resource type="Shader" id="Shader_wdu0l"]
code = "// NOTE: Shader automatically converted from Godot Engine 4.6.3.stable's StandardMaterial3D.
shader_type spatial;
render_mode blend_mix, depth_draw_opaque, cull_back, diffuse_burley, specular_schlick_ggx, unshaded;
uniform vec4 albedo : source_color;
uniform sampler2D texture_albedo : source_color, filter_linear_mipmap, repeat_enable;
uniform ivec2 albedo_texture_size;
uniform float point_size : hint_range(0.1, 128.0, 0.1);
uniform float roughness : hint_range(0.0, 1.0);
uniform sampler2D texture_metallic : hint_default_white, filter_linear_mipmap, repeat_enable;
uniform vec4 metallic_texture_channel;
uniform sampler2D texture_roughness : hint_roughness_r, filter_linear_mipmap, repeat_enable;
uniform float specular : hint_range(0.0, 1.0, 0.01);
uniform float metallic : hint_range(0.0, 1.0, 0.01);
uniform vec3 uv1_scale;
uniform vec3 uv1_offset;
uniform vec3 uv2_scale;
uniform vec3 uv2_offset;
void vertex() {
UV = UV * uv1_scale.xy + uv1_offset.xy;
// Billboard Mode: Enabled
MODELVIEW_MATRIX = VIEW_MATRIX * mat4(
MAIN_CAM_INV_VIEW_MATRIX[0],
MAIN_CAM_INV_VIEW_MATRIX[1],
MAIN_CAM_INV_VIEW_MATRIX[2],
MODEL_MATRIX[3]);
MODELVIEW_NORMAL_MATRIX = mat3(MODELVIEW_MATRIX);
}
void fragment() {
vec2 base_uv = UV;
vec4 albedo_tex = texture(texture_albedo, base_uv);
// Vertex Color Use as Albedo: Enabled
albedo_tex *= COLOR;
ALBEDO = albedo.rgb * albedo_tex.rgb;
float metallic_tex = dot(texture(texture_metallic, base_uv), metallic_texture_channel);
METALLIC = metallic_tex * metallic;
SPECULAR = specular;
vec4 roughness_texture_channel = vec4(1.0, 0.0, 0.0, 0.0);
float roughness_tex = dot(texture(texture_roughness, base_uv), roughness_texture_channel);
ROUGHNESS = roughness_tex * roughness;
ALPHA *= albedo.a * albedo_tex.a;
}
"
[sub_resource type="ShaderMaterial" id="ShaderMaterial_tres5"]
render_priority = 0
shader = SubResource("Shader_wdu0l")
shader_parameter/albedo = Color(0.72673184, 0.7267317, 0.7267317, 1)
shader_parameter/albedo_texture_size = Vector2i(0, 0)
shader_parameter/point_size = 0.0
shader_parameter/roughness = 1.0
shader_parameter/metallic_texture_channel = Vector4(1, 0, 0, 0)
shader_parameter/specular = 0.5
shader_parameter/metallic = 0.0
shader_parameter/uv1_scale = Vector3(1, 1, 1)
shader_parameter/uv1_offset = Vector3(0, 0, 0)
shader_parameter/uv2_scale = Vector3(1, 1, 1)
shader_parameter/uv2_offset = Vector3(0, 0, 0)
[sub_resource type="QuadMesh" id="QuadMesh_smoke"]
material = SubResource("ShaderMaterial_tres5")
size = Vector2(0.1, 0.1)
[node name="FireballEffect" type="Node3D" unique_id=1007477949]
[node name="fire_ball" parent="." unique_id=631750332 instance=ExtResource("1_fireball_glb")]
transform = Transform3D(0.4, 0, 0, 0, 0.4, 0, 0, 0, 0.4, 0, 0, 0)
[node name="Mesh1_0" parent="fire_ball" index="0" unique_id=544388934]
material_override = ExtResource("2_fireball_mat")
[node name="SparkParticles" type="GPUParticles3D" parent="." unique_id=95447995]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.14090544)
amount = 40
lifetime = 0.7
process_material = SubResource("ParticleProcessMaterial_sparks")
draw_pass_1 = SubResource("QuadMesh_sparks")
[node name="SmokeParticles" type="GPUParticles3D" parent="." unique_id=146216356]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.027363837)
amount = 50
lifetime = 1.1
process_material = SubResource("ParticleProcessMaterial_smoke")
draw_pass_1 = SubResource("QuadMesh_smoke")
[editable path="fire_ball"]
[gd_resource type="ShaderMaterial" format=3 uid="uid://bdva8hwtdvis7"]
[ext_resource type="Shader" uid="uid://q61qtxae1pt1" path="res://src/entities/projectiles/fireball/fireball.gdshader" id="1_shader"]
[ext_resource type="Texture2D" uid="uid://br8rlbdv6ssla" path="res://assets/models/projectiles/fireball/fire_ball_Baked_BaseColor.png" id="2_base_color"]
[sub_resource type="FastNoiseLite" id="FastNoiseLite_1"]
noise_type = 3
frequency = 0.02
fractal_type = 2
[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_noise"]
noise = SubResource("FastNoiseLite_1")
seamless = true
[resource]
render_priority = 0
shader = ExtResource("1_shader")
shader_parameter/albedo_tex = ExtResource("2_base_color")
shader_parameter/noise_tex = SubResource("NoiseTexture2D_noise")
shader_parameter/albedo_color = Color(0.86440057, 0.3836002, 0, 1)
shader_parameter/emission_color = Color(0.9699181, 0.28715518, 0, 1)
shader_parameter/emission_energy = 1.95600009291
shader_parameter/panning_speed1 = Vector2(0.5, 0.75)
shader_parameter/panning_speed2 = Vector2(-0.5, 1)
shader_parameter/displacement_strength = 0.0470000022325
shader_parameter/displacement_speed = 4.0
[gd_scene format=3]
[gd_scene format=3 uid="uid://5ebt3f4yxl4d"]
[ext_resource type="PackedScene" path="res://assets/models/units/mage/mage.fbx" id="1_mage_fbx"]
[ext_resource type="AnimationLibrary" path="res://assets/models/units/mage/mage_animations.tres" id="2_mage_anims"]
[ext_resource type="PackedScene" uid="uid://qi6jn6gpq7mk" path="res://assets/models/units/mage/mage.fbx" id="1_mage_fbx"]
[ext_resource type="AnimationLibrary" uid="uid://dup4twc606rv" path="res://assets/models/units/mage/mage_animations.tres" id="2_mage_anims"]
[node name="mage" instance=ExtResource("1_mage_fbx")]
[node name="mage" unique_id=2062489611 instance=ExtResource("1_mage_fbx")]
transform = Transform3D(-1, 0, -8.742278e-08, 0, 1, 0, 8.742278e-08, 0, -1, 0, 0, 0)
[node name="AnimationPlayer" parent="." index="1"]
[node name="Skeleton3D" parent="Armature" parent_id_path=PackedInt32Array(252089910) index="0" unique_id=1518187286]
bones/0/position = Vector3(-0.02604381, -0.028485257, 0.63779396)
bones/0/rotation = Quaternion(0.65149087, -0.55722827, -0.35027638, 0.37731016)
bones/1/rotation = Quaternion(0.66806746, 0.20288229, -0.44615895, 0.5598811)
bones/2/rotation = Quaternion(0.70584315, 0.0888539, -0.077750064, 0.69845927)
bones/3/rotation = Quaternion(-0.6454012, -0.03186803, 0.19655482, 0.7374334)
bones/4/rotation = Quaternion(-0.4340241, -0.03172542, -0.002525541, 0.900339)
bones/5/rotation = Quaternion(0.7572378, -0.03645872, -0.052318677, 0.65001893)
bones/6/rotation = Quaternion(0.6427112, -0.07624496, 0.02701758, 0.76182616)
bones/7/rotation = Quaternion(-0.46594104, 0.14889856, -0.09954564, 0.8664982)
bones/8/rotation = Quaternion(-0.55541927, 0.10270871, 0.0380777, 0.8243243)
bones/9/rotation = Quaternion(-0.15820718, 0.21109919, -0.0410106, 0.9637043)
bones/10/rotation = Quaternion(-0.00087597984, 0.010519488, -0.04606504, 0.9988828)
bones/11/rotation = Quaternion(-0.07751671, -0.0020707778, -0.0069086505, 0.996965)
bones/12/rotation = Quaternion(0.57735246, 0.52391493, -0.32330808, 0.5363295)
bones/13/rotation = Quaternion(0.56553626, 0.27505675, 0.083389126, 0.7730192)
bones/14/rotation = Quaternion(-0.29044855, 0.075124785, 0.20163701, 0.93238324)
bones/15/rotation = Quaternion(0.09490285, 0.19491741, -0.22610243, 0.94967276)
bones/16/rotation = Quaternion(-0.5168209, 0.5474174, -0.26478106, -0.60259557)
bones/17/rotation = Quaternion(0.60044354, -0.1461899, -0.015048357, 0.7860469)
bones/18/rotation = Quaternion(-0.71120346, -0.06691303, -0.3304293, 0.61687016)
bones/19/rotation = Quaternion(0.2303776, -0.5326554, -0.10615074, 0.80742586)
bones/20/rotation = Quaternion(0.23474479, 0.01655447, -0.042023707, 0.9710072)
bones/21/rotation = Quaternion(0.008689158, 0.23618911, 0.026608352, 0.97130394)
bones/22/rotation = Quaternion(-0.16522469, -4.013281e-08, 7.0822594e-08, 0.98625606)
bones/23/rotation = Quaternion(0.6332754, 6.4982146e-08, 1.7569252e-07, 0.77392656)
[node name="AnimationPlayer" parent="." index="1" unique_id=1849508717]
libraries/ = ExtResource("2_mage_anims")
......@@ -46,17 +46,18 @@ func _update_animations() -> void:
var blend_time: float = 0.2
if has_custom_anims:
# Mage용 애니메이션 매핑 (Attack, Running, Idle)
# Mage용 애니메이션 매핑 (Attack, Running, Idle, Casting)
var attack_anim: String = library_prefix + "Attack"
var run_anim: String = library_prefix + "Running"
var idle_anim: String = library_prefix + "Idle"
var cast_anim: String = library_prefix + "Casting"
if _attack_lock_timer > 0.0:
var base_speed: float = 1.2
if unit_data.cooldown < 0.6:
base_speed = 0.6 / unit_data.cooldown
play_speed = clampf(base_speed, 1.0, 3.0)
target_anim = attack_anim
target_anim = cast_anim
elif velocity.length() > 0.1:
target_anim = run_anim
play_speed = 1.1
......@@ -93,9 +94,9 @@ func _spawn_projectile(fire_position: Vector3) -> void:
proj.set("damage", unit_data.damage)
proj.set("target", _target_monster)
# 불덩이(적황색) 발사체 색상 지정
proj.set("color", Color(1.0, 0.35, 0.1, 1.0))
proj.set("use_arrow_model", false)
# 불덩이 비주얼 효과 씬 장착
var fb_effect = preload("res://src/entities/projectiles/fireball/fireball_effect.tscn")
proj.set("custom_visual_scene", fb_effect)
get_tree().current_scene.add_child(proj)
proj.global_position = fire_position
......@@ -13,16 +13,27 @@ var color: Color = Color(1.0, 0.9, 0.2, 1.0) # 기본 노란색 발사체
# 화살 모드 여부 (Ranger 전용)
var use_arrow_model: bool = false
# 커스텀 비주얼 씬 (마법사 불덩이 등 외부 씬 연동 지원)
var custom_visual_scene: PackedScene = null
# 화살 모델 경로
const ARROW_MODEL_PATH: String = "res://assets/models/projectiles/arrow/arrow.glb"
const ARROW_TEXTURE_PATH: String = "res://assets/models/projectiles/arrow/arrow_0.jpg"
func _ready() -> void:
if use_arrow_model and ResourceLoader.exists(ARROW_MODEL_PATH):
if custom_visual_scene:
_setup_custom_visual()
elif use_arrow_model and ResourceLoader.exists(ARROW_MODEL_PATH):
_setup_arrow_visual()
else:
_setup_sphere_visual()
## 커스텀 비주얼 씬 인스턴싱하여 자식으로 장착
func _setup_custom_visual() -> void:
var visual_inst: Node3D = custom_visual_scene.instantiate() as Node3D
add_child(visual_inst)
## 화살 모델 비주얼 설정
func _setup_arrow_visual() -> void:
var arrow_scene: PackedScene = load(ARROW_MODEL_PATH) as PackedScene
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment