111 lines
4.2 KiB
Text
111 lines
4.2 KiB
Text
[gd_scene load_steps=7 format=3 uid="uid://cpap2mt61s2m"]
|
|
|
|
[sub_resource type="Shader" id="Shader_opj16"]
|
|
code = "// NOTE: Shader automatically converted from Godot Engine 4.2.1.stable's StandardMaterial3D.
|
|
|
|
shader_type spatial;
|
|
render_mode blend_mix,depth_draw_opaque,cull_back,unshaded;
|
|
uniform vec4 albedo : source_color;
|
|
uniform sampler2D texture_albedo : source_color,filter_linear_mipmap,repeat_enable;
|
|
uniform float point_size : hint_range(0,128);
|
|
uniform float roughness : hint_range(0,1);
|
|
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;
|
|
uniform float metallic;
|
|
uniform int particles_anim_h_frames;
|
|
uniform int particles_anim_v_frames;
|
|
uniform bool particles_anim_loop;
|
|
uniform vec3 uv1_scale;
|
|
uniform vec3 uv1_offset;
|
|
uniform vec3 uv2_scale;
|
|
uniform vec3 uv2_offset;
|
|
|
|
uniform sampler2D life_alpha : repeat_disable;
|
|
|
|
varying float life;
|
|
|
|
void vertex() {
|
|
life = INSTANCE_CUSTOM.y;
|
|
UV=UV*uv1_scale.xy+uv1_offset.xy;
|
|
mat4 mat_world = mat4(normalize(INV_VIEW_MATRIX[0]), normalize(INV_VIEW_MATRIX[1]) ,normalize(INV_VIEW_MATRIX[2]), MODEL_MATRIX[3]);
|
|
mat_world = mat_world * mat4(vec4(cos(INSTANCE_CUSTOM.x), -sin(INSTANCE_CUSTOM.x), 0.0, 0.0), vec4(sin(INSTANCE_CUSTOM.x), cos(INSTANCE_CUSTOM.x), 0.0, 0.0), vec4(0.0, 0.0, 1.0, 0.0), vec4(0.0, 0.0, 0.0, 1.0));
|
|
MODELVIEW_MATRIX = VIEW_MATRIX * mat_world;
|
|
MODELVIEW_NORMAL_MATRIX = mat3(MODELVIEW_MATRIX);
|
|
float h_frames = float(particles_anim_h_frames);
|
|
float v_frames = float(particles_anim_v_frames);
|
|
float particle_total_frames = float(particles_anim_h_frames * particles_anim_v_frames);
|
|
float particle_frame = floor(INSTANCE_CUSTOM.z * float(particle_total_frames));
|
|
if (!particles_anim_loop) {
|
|
particle_frame = clamp(particle_frame, 0.0, particle_total_frames - 1.0);
|
|
} else {
|
|
particle_frame = mod(particle_frame, particle_total_frames);
|
|
}
|
|
UV /= vec2(h_frames, v_frames);
|
|
UV += vec2(mod(particle_frame, h_frames) / h_frames, floor((particle_frame + 0.5) / h_frames) / v_frames);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void fragment() {
|
|
if (length(UV - vec2(0.5)) > 0.05) {
|
|
discard;
|
|
}
|
|
vec2 base_uv = UV;
|
|
vec4 albedo_tex = texture(texture_albedo,base_uv);
|
|
ALBEDO = albedo.rgb * albedo_tex.rgb;
|
|
float metallic_tex = dot(texture(texture_metallic,base_uv),metallic_texture_channel);
|
|
METALLIC = metallic_tex * metallic;
|
|
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;
|
|
SPECULAR = specular;
|
|
ALPHA = texture(life_alpha, vec2(life)).r;
|
|
}
|
|
"
|
|
|
|
[sub_resource type="Curve" id="Curve_x40c4"]
|
|
_data = [Vector2(0, 1), 0.0, 0.0, 0, 0, Vector2(0.904632, 0.855861), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0]
|
|
point_count = 3
|
|
|
|
[sub_resource type="CurveTexture" id="CurveTexture_j7b0c"]
|
|
curve = SubResource("Curve_x40c4")
|
|
|
|
[sub_resource type="ShaderMaterial" id="ShaderMaterial_cn13f"]
|
|
render_priority = 0
|
|
shader = SubResource("Shader_opj16")
|
|
shader_parameter/albedo = Color(1, 1, 1, 1)
|
|
shader_parameter/point_size = 1.0
|
|
shader_parameter/roughness = 1.0
|
|
shader_parameter/metallic_texture_channel = Vector4(0, 0, 0, 0)
|
|
shader_parameter/specular = 0.5
|
|
shader_parameter/metallic = 0.0
|
|
shader_parameter/particles_anim_h_frames = 1
|
|
shader_parameter/particles_anim_v_frames = 1
|
|
shader_parameter/particles_anim_loop = false
|
|
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)
|
|
shader_parameter/life_alpha = SubResource("CurveTexture_j7b0c")
|
|
|
|
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_c4a1g"]
|
|
emission_shape = 3
|
|
emission_box_extents = Vector3(10, 0, 2)
|
|
turbulence_enabled = true
|
|
turbulence_noise_strength = 0.05
|
|
turbulence_noise_scale = 2.756
|
|
|
|
[sub_resource type="QuadMesh" id="QuadMesh_sfy6f"]
|
|
|
|
[node name="GPUParticles3D" type="GPUParticles3D"]
|
|
material_override = SubResource("ShaderMaterial_cn13f")
|
|
amount = 300
|
|
lifetime = 10.0
|
|
preprocess = 10.0
|
|
local_coords = true
|
|
process_material = SubResource("ParticleProcessMaterial_c4a1g")
|
|
draw_pass_1 = SubResource("QuadMesh_sfy6f")
|