Browse Source

Add a normal map test in the 2D lights and shadows demo

This was requested by lawnjelly so we can test whether normal map
orientation behaves as expected.
Hugo Locurcio 5 years ago
parent
commit
97e00544a9

BIN
2d/lights_and_shadows/godot.png


+ 34 - 0
2d/lights_and_shadows/godot.png.import

@@ -0,0 +1,34 @@
+[remap]
+
+importer="texture"
+type="StreamTexture"
+path="res://.import/godot.png-5e0da45ed3d6786d5794553e04f58a8c.stex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://godot.png"
+dest_files=[ "res://.import/godot.png-5e0da45ed3d6786d5794553e04f58a8c.stex" ]
+
+[params]
+
+compress/mode=0
+compress/lossy_quality=0.7
+compress/hdr_mode=0
+compress/bptc_ldr=0
+compress/normal_map=0
+flags/repeat=0
+flags/filter=true
+flags/mipmaps=false
+flags/anisotropic=false
+flags/srgb=2
+process/fix_alpha_border=true
+process/premult_alpha=false
+process/HDR_as_SRGB=false
+process/invert_color=false
+stream=false
+size_limit=0
+detect_3d=true
+svg/scale=1.0

BIN
2d/lights_and_shadows/godot_normal.png


+ 34 - 0
2d/lights_and_shadows/godot_normal.png.import

@@ -0,0 +1,34 @@
+[remap]
+
+importer="texture"
+type="StreamTexture"
+path="res://.import/godot_normal.png-7f91d6bfda6a23aaa1320ed999c27a39.stex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://godot_normal.png"
+dest_files=[ "res://.import/godot_normal.png-7f91d6bfda6a23aaa1320ed999c27a39.stex" ]
+
+[params]
+
+compress/mode=0
+compress/lossy_quality=0.7
+compress/hdr_mode=0
+compress/bptc_ldr=0
+compress/normal_map=0
+flags/repeat=0
+flags/filter=true
+flags/mipmaps=false
+flags/anisotropic=false
+flags/srgb=2
+process/fix_alpha_border=true
+process/premult_alpha=false
+process/HDR_as_SRGB=false
+process/invert_color=false
+stream=false
+size_limit=0
+detect_3d=true
+svg/scale=1.0

+ 84 - 6
2d/lights_and_shadows/light_shadows.tscn

@@ -1,9 +1,11 @@
-[gd_scene load_steps=12 format=2]
+[gd_scene load_steps=14 format=2]
 
 [ext_resource path="res://background.png" type="Texture" id=1]
 [ext_resource path="res://caster.png" type="Texture" id=2]
 [ext_resource path="res://light.png" type="Texture" id=3]
 [ext_resource path="res://spot.png" type="Texture" id=4]
+[ext_resource path="res://godot.png" type="Texture" id=5]
+[ext_resource path="res://godot_normal.png" type="Texture" id=6]
 
 [sub_resource type="OccluderPolygon2D" id=1]
 polygon = PoolVector2Array( -15.913, -15.9738, 15.9079, -16.0785, 15.6986, 15.847, -16.1223, 15.9517 )
@@ -71,10 +73,80 @@ tracks/0/keys = {
 color = Color( 0.27451, 0.27451, 0.27451, 1 )
 
 [node name="Background" type="Sprite" parent="."]
-position = Vector2( 401.251, 301.906 )
+position = Vector2( 401.251, 302.906 )
 scale = Vector2( 128, 128 )
 texture = ExtResource( 1 )
 
+[node name="Sprite" type="Sprite" parent="."]
+position = Vector2( 295.886, 216.938 )
+texture = ExtResource( 5 )
+normal_map = ExtResource( 6 )
+
+[node name="Label" type="Label" parent="Sprite"]
+margin_left = -22.5563
+margin_top = 64.6982
+margin_right = 24.4437
+margin_bottom = 78.6982
+text = "Normal"
+align = 1
+__meta__ = {
+"_edit_use_anchors_": false
+}
+
+[node name="SpriteFlipX" type="Sprite" parent="."]
+position = Vector2( 543.341, 220.255 )
+scale = Vector2( -1, 1 )
+texture = ExtResource( 5 )
+normal_map = ExtResource( 6 )
+
+[node name="Label" type="Label" parent="SpriteFlipX"]
+margin_left = 22.5564
+margin_top = 66.0347
+margin_right = 69.5564
+margin_bottom = 80.0347
+rect_scale = Vector2( -1, 1 )
+text = "Flip X"
+align = 1
+__meta__ = {
+"_edit_use_anchors_": false
+}
+
+[node name="SpriteFlipY" type="Sprite" parent="."]
+position = Vector2( 291.308, 423.369 )
+scale = Vector2( 1, -1 )
+texture = ExtResource( 5 )
+normal_map = ExtResource( 6 )
+
+[node name="Label" type="Label" parent="SpriteFlipY"]
+margin_left = -23.3056
+margin_top = -67.2446
+margin_right = 23.6944
+margin_bottom = -53.2446
+rect_scale = Vector2( 1, -1 )
+text = "Flip Y"
+align = 1
+__meta__ = {
+"_edit_use_anchors_": false
+}
+
+[node name="SpriteFlipXY" type="Sprite" parent="."]
+position = Vector2( 542.081, 424.696 )
+scale = Vector2( -1, -1 )
+texture = ExtResource( 5 )
+normal_map = ExtResource( 6 )
+
+[node name="Label" type="Label" parent="SpriteFlipXY"]
+margin_left = 23.9495
+margin_top = -67.5714
+margin_right = 81.9495
+margin_bottom = -53.5714
+rect_scale = Vector2( -1, -1 )
+text = "Flip X + Y"
+align = 1
+__meta__ = {
+"_edit_use_anchors_": false
+}
+
 [node name="Casters" type="Node2D" parent="."]
 
 [node name="ShadowCaster" type="Sprite" parent="Casters"]
@@ -99,7 +171,7 @@ texture = ExtResource( 2 )
 occluder = SubResource( 1 )
 
 [node name="ShadowCaster3" type="Sprite" parent="Casters"]
-position = Vector2( 348.291, 206.319 )
+position = Vector2( 408.291, 226.319 )
 texture = ExtResource( 2 )
 
 [node name="Occluder" type="LightOccluder2D" parent="Casters/ShadowCaster3"]
@@ -186,11 +258,13 @@ occluder = SubResource( 1 )
 position = Vector2( 159.289, 452.441 )
 texture = ExtResource( 3 )
 color = Color( 1, 0.446392, 0.0576646, 1 )
-energy = 0.95
 shadow_enabled = true
 shadow_gradient_length = 1.3
 shadow_filter = 3
 shadow_filter_smooth = 11.1
+__meta__ = {
+"_edit_lock_": true
+}
 
 [node name="Blob" type="Sprite" parent="RedLight"]
 material = SubResource( 2 )
@@ -205,11 +279,13 @@ anims/motion2 = SubResource( 4 )
 position = Vector2( 753.756, 314.336 )
 texture = ExtResource( 3 )
 color = Color( 0.49247, 0.878537, 0.409146, 1 )
-energy = 0.95
 shadow_enabled = true
 shadow_gradient_length = 1.2
 shadow_filter = 3
 shadow_filter_smooth = 7.1
+__meta__ = {
+"_edit_lock_": true
+}
 
 [node name="blob" type="Sprite" parent="GreenLight"]
 material = SubResource( 5 )
@@ -224,11 +300,13 @@ anims/motion = SubResource( 3 )
 position = Vector2( 692.078, 31.1773 )
 texture = ExtResource( 3 )
 color = Color( 0.396752, 0.446392, 0.929792, 1 )
-energy = 0.95
 shadow_enabled = true
 shadow_gradient_length = 1.4
 shadow_filter = 3
 shadow_filter_smooth = 5.3
+__meta__ = {
+"_edit_lock_": true
+}
 
 [node name="blob" type="Sprite" parent="BlueLight"]
 material = SubResource( 6 )