Skip to content

Commit d4d10d4

Browse files
committed
[godot] Demonstrate SpineSprite3D lighting scope
Add a directional light, opaque ground, and lit shadow-casting reference geometry to example 15. Make it visually explicit that generated SpineSprite3D materials remain unlit and do not cast shadows.
1 parent 72411fb commit d4d10d4

2 files changed

Lines changed: 84 additions & 30 deletions

File tree

‎spine-godot/example-v4-extension/examples/15-spine-sprite-3d/spine-sprite-3d.tscn‎

Lines changed: 42 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,58 @@
1-
[gd_scene load_steps=7 format=3]
1+
[gd_scene load_steps=10 format=3]
22

33
[ext_resource type="Script" path="res://examples/15-spine-sprite-3d/spine-sprite-3d.gd" id="1"]
44
[ext_resource type="SpineSkeletonDataResource" path="res://assets/spineboy/spineboy-data-res.tres" id="2"]
55
[ext_resource type="SpineSkeletonDataResource" path="res://assets/coin/coin-data-res.tres" id="3"]
66

7-
[sub_resource type="Shader" id="4"]
8-
code = "shader_type spatial;
9-
render_mode unshaded, cull_back, depth_draw_never, blend_mix;
10-
void fragment() { ALBEDO = vec3(0.2, 1.0, 0.4); ALPHA = 0.75; }
11-
"
7+
[sub_resource type="StandardMaterial3D" id="SphereMaterial"]
8+
albedo_color = Color(0.15, 1, 0.3, 1)
9+
metallic = 0.15
10+
roughness = 0.35
1211

13-
[sub_resource type="ShaderMaterial" id="5"]
14-
render_priority = -48
15-
shader = SubResource("4")
16-
17-
[sub_resource type="SphereMesh" id="6"]
18-
material = SubResource("5")
12+
[sub_resource type="SphereMesh" id="Sphere"]
13+
material = SubResource("SphereMaterial")
1914
radius = 0.15
2015
height = 0.3
2116

17+
[sub_resource type="StandardMaterial3D" id="GroundMaterial"]
18+
albedo_color = Color(0.09, 0.12, 0.17, 1)
19+
roughness = 0.9
20+
21+
[sub_resource type="PlaneMesh" id="Ground"]
22+
material = SubResource("GroundMaterial")
23+
size = Vector2(14, 12)
24+
25+
[sub_resource type="StandardMaterial3D" id="BoxMaterial"]
26+
albedo_color = Color(1, 0.32, 0.12, 1)
27+
metallic = 0.1
28+
roughness = 0.5
29+
30+
[sub_resource type="BoxMesh" id="Box"]
31+
material = SubResource("BoxMaterial")
32+
size = Vector3(0.55, 1.1, 0.55)
33+
2234
[node name="SpineSprite3DExample" type="Node3D"]
2335
script = ExtResource("1")
2436

2537
[node name="Camera3D" type="Camera3D" parent="."]
26-
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.25, 10)
38+
position = Vector3(0, 1.8, 10)
39+
rotation = Vector3(-0.08, 0, 0)
2740
current = true
2841

42+
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
43+
rotation = Vector3(-0.85, -0.55, -0.25)
44+
light_energy = 1.4
45+
shadow_enabled = true
46+
47+
[node name="Ground" type="MeshInstance3D" parent="."]
48+
position = Vector3(0, -1.5, -1)
49+
mesh = SubResource("Ground")
50+
51+
[node name="LitShadowCaster" type="MeshInstance3D" parent="."]
52+
position = Vector3(1.05, -0.95, 1.3)
53+
rotation = Vector3(0, 0.35, 0)
54+
mesh = SubResource("Box")
55+
2956
[node name="LeftSpineboy" type="SpineSprite3D" parent="."]
3057
position = Vector3(-2.3, -1.25, 0)
3158
rotation = Vector3(0, 0.32, 0)
@@ -42,7 +69,7 @@ preview_time = 0.2
4269
slot_name = "front-fist"
4370

4471
[node name="InsertedSphere" type="MeshInstance3D" parent="LeftSpineboy/HandSlot"]
45-
mesh = SubResource("6")
72+
mesh = SubResource("Sphere")
4673

4774
[node name="RightSpineboy" type="SpineSprite3D" parent="."]
4875
position = Vector3(2.3, -1.25, -0.5)
@@ -71,5 +98,5 @@ offset_top = 20.0
7198
offset_right = 1128.0
7299
offset_bottom = 76.0
73100
theme_override_font_sizes/font_size = 20
74-
text = "Native SpineSprite3D — batched geometry, tint black, and a 3D sphere inserted at the hand slot\nGenerated materials are transparent and unlit; multiply and screen are not yet supported."
101+
text = "Native SpineSprite3D — batched geometry, tint black, and a lit 3D sphere inserted at the hand slot\nThe light affects the sphere, orange box, and ground; generated Spine materials are unlit and cast no shadows."
75102
horizontal_alignment = 1

‎spine-godot/example-v4/examples/15-spine-sprite-3d/spine-sprite-3d.tscn‎

Lines changed: 42 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,58 @@
1-
[gd_scene load_steps=7 format=3]
1+
[gd_scene load_steps=10 format=3]
22

33
[ext_resource type="Script" path="res://examples/15-spine-sprite-3d/spine-sprite-3d.gd" id="1"]
44
[ext_resource type="SpineSkeletonDataResource" path="res://assets/spineboy/spineboy-data-res.tres" id="2"]
55
[ext_resource type="SpineSkeletonDataResource" path="res://assets/coin/coin-data-res.tres" id="3"]
66

7-
[sub_resource type="Shader" id="4"]
8-
code = "shader_type spatial;
9-
render_mode unshaded, cull_back, depth_draw_never, blend_mix;
10-
void fragment() { ALBEDO = vec3(0.2, 1.0, 0.4); ALPHA = 0.75; }
11-
"
7+
[sub_resource type="StandardMaterial3D" id="SphereMaterial"]
8+
albedo_color = Color(0.15, 1, 0.3, 1)
9+
metallic = 0.15
10+
roughness = 0.35
1211

13-
[sub_resource type="ShaderMaterial" id="5"]
14-
render_priority = -48
15-
shader = SubResource("4")
16-
17-
[sub_resource type="SphereMesh" id="6"]
18-
material = SubResource("5")
12+
[sub_resource type="SphereMesh" id="Sphere"]
13+
material = SubResource("SphereMaterial")
1914
radius = 0.15
2015
height = 0.3
2116

17+
[sub_resource type="StandardMaterial3D" id="GroundMaterial"]
18+
albedo_color = Color(0.09, 0.12, 0.17, 1)
19+
roughness = 0.9
20+
21+
[sub_resource type="PlaneMesh" id="Ground"]
22+
material = SubResource("GroundMaterial")
23+
size = Vector2(14, 12)
24+
25+
[sub_resource type="StandardMaterial3D" id="BoxMaterial"]
26+
albedo_color = Color(1, 0.32, 0.12, 1)
27+
metallic = 0.1
28+
roughness = 0.5
29+
30+
[sub_resource type="BoxMesh" id="Box"]
31+
material = SubResource("BoxMaterial")
32+
size = Vector3(0.55, 1.1, 0.55)
33+
2234
[node name="SpineSprite3DExample" type="Node3D"]
2335
script = ExtResource("1")
2436

2537
[node name="Camera3D" type="Camera3D" parent="."]
26-
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.25, 10)
38+
position = Vector3(0, 1.8, 10)
39+
rotation = Vector3(-0.08, 0, 0)
2740
current = true
2841

42+
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
43+
rotation = Vector3(-0.85, -0.55, -0.25)
44+
light_energy = 1.4
45+
shadow_enabled = true
46+
47+
[node name="Ground" type="MeshInstance3D" parent="."]
48+
position = Vector3(0, -1.5, -1)
49+
mesh = SubResource("Ground")
50+
51+
[node name="LitShadowCaster" type="MeshInstance3D" parent="."]
52+
position = Vector3(1.05, -0.95, 1.3)
53+
rotation = Vector3(0, 0.35, 0)
54+
mesh = SubResource("Box")
55+
2956
[node name="LeftSpineboy" type="SpineSprite3D" parent="."]
3057
position = Vector3(-2.3, -1.25, 0)
3158
rotation = Vector3(0, 0.32, 0)
@@ -42,7 +69,7 @@ preview_time = 0.2
4269
slot_name = "front-fist"
4370

4471
[node name="InsertedSphere" type="MeshInstance3D" parent="LeftSpineboy/HandSlot"]
45-
mesh = SubResource("6")
72+
mesh = SubResource("Sphere")
4673

4774
[node name="RightSpineboy" type="SpineSprite3D" parent="."]
4875
position = Vector3(2.3, -1.25, -0.5)
@@ -71,5 +98,5 @@ offset_top = 20.0
7198
offset_right = 1128.0
7299
offset_bottom = 76.0
73100
theme_override_font_sizes/font_size = 20
74-
text = "Native SpineSprite3D — batched geometry, tint black, and a 3D sphere inserted at the hand slot\nGenerated materials are transparent and unlit; multiply and screen are not yet supported."
101+
text = "Native SpineSprite3D — batched geometry, tint black, and a lit 3D sphere inserted at the hand slot\nThe light affects the sphere, orange box, and ground; generated Spine materials are unlit and cast no shadows."
75102
horizontal_alignment = 1

0 commit comments

Comments
 (0)