Last active
June 8, 2025 14:06
-
-
Save maidopi-usagi/16d6c70982565c51001e31e47a192b81 to your computer and use it in GitHub Desktop.
Godot SubEmitter example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [gd_scene load_steps=9 format=3 uid="uid://djnfyqm1dgdud"] | |
| [sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_xlglh"] | |
| sky_horizon_color = Color(0.662243, 0.671743, 0.686743, 1) | |
| ground_horizon_color = Color(0.662243, 0.671743, 0.686743, 1) | |
| [sub_resource type="Sky" id="Sky_crest"] | |
| sky_material = SubResource("ProceduralSkyMaterial_xlglh") | |
| [sub_resource type="Environment" id="Environment_axu21"] | |
| background_mode = 2 | |
| sky = SubResource("Sky_crest") | |
| tonemap_mode = 2 | |
| glow_enabled = true | |
| [sub_resource type="Shader" id="Shader_4xowi"] | |
| code = "shader_type particles; | |
| float hash11(float p) | |
| { | |
| p = fract(p * .1031); | |
| p *= p + 33.33; | |
| p *= p + p; | |
| return fract(p); | |
| } | |
| void start() { | |
| } | |
| void process() { | |
| if (hash11(TIME) < 0.25) | |
| { | |
| float theta = hash11(TIME * 2.33 + 0.14) * 2.0 * PI; | |
| mat4 xf = TRANSFORM; | |
| xf[3].xyz += vec3(cos(theta),0.0,sin(theta)) * 10.0; | |
| emit_subparticle(xf, vec3(0.0), vec4(1.0), vec4(0.0), FLAG_EMIT_POSITION); | |
| } | |
| } | |
| " | |
| [sub_resource type="ShaderMaterial" id="ShaderMaterial_noarx"] | |
| shader = SubResource("Shader_4xowi") | |
| [sub_resource type="BoxMesh" id="BoxMesh_a0tk4"] | |
| [sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_a202f"] | |
| [sub_resource type="SphereMesh" id="SphereMesh_a202f"] | |
| [node name="Node3D" type="Node3D"] | |
| [node name="WorldEnvironment" type="WorldEnvironment" parent="."] | |
| environment = SubResource("Environment_axu21") | |
| [node name="DirectionalLight3D" type="DirectionalLight3D" parent="."] | |
| transform = Transform3D(-0.866023, -0.433016, 0.250001, 0, 0.499998, 0.866027, -0.500003, 0.749999, -0.43301, 0, 0, 0) | |
| shadow_enabled = true | |
| [node name="GPUParticles3D" type="GPUParticles3D" parent="."] | |
| sub_emitter = NodePath("../GPUParticles3D2") | |
| process_material = SubResource("ShaderMaterial_noarx") | |
| draw_pass_1 = SubResource("BoxMesh_a0tk4") | |
| [node name="GPUParticles3D2" type="GPUParticles3D" parent="."] | |
| amount = 256 | |
| process_material = SubResource("ParticleProcessMaterial_a202f") | |
| draw_pass_1 = SubResource("SphereMesh_a202f") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment