Skip to content

Commit

Permalink
Merge pull request #511 from Calinou/lights-and-shadows-normal-maps
Browse files Browse the repository at this point in the history
Add a normal map test in the 2D lights and shadows demo
  • Loading branch information
aaronfranke authored Aug 19, 2020
2 parents bc40a8d + 97e0054 commit a582304
Show file tree
Hide file tree
Showing 5 changed files with 152 additions and 6 deletions.
Binary file added 2d/lights_and_shadows/godot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions 2d/lights_and_shadows/godot.png.import
Original file line number Diff line number Diff line change
@@ -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
Binary file added 2d/lights_and_shadows/godot_normal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions 2d/lights_and_shadows/godot_normal.png.import
Original file line number Diff line number Diff line change
@@ -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
90 changes: 84 additions & 6 deletions 2d/lights_and_shadows/light_shadows.tscn
Original file line number Diff line number Diff line change
@@ -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 )
Expand Down Expand Up @@ -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"]
Expand All @@ -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"]
Expand Down Expand Up @@ -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 )
Expand All @@ -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 )
Expand All @@ -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 )
Expand Down

0 comments on commit a582304

Please sign in to comment.