pull/2/head
godotg 2022-07-23 12:15:14 +08:00
parent efb7814820
commit 8d496b9dae
19 changed files with 283 additions and 4 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 408 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/laigter.JPG-fce275ef4cf4f956989ac079a7dfca9d.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://doc/demo11_particle_light/image/laigter.JPG"
dest_files=[ "res://.import/laigter.JPG-fce275ef4cf4f956989ac079a7dfca9d.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 not shown.

After

Width:  |  Height:  |  Size: 315 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/light_shadow_main.png-1196e88b3b574bbbb10d5cc94f3a3d00.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://doc/demo11_particle_light/image/light_shadow_main.png"
dest_files=[ "res://.import/light_shadow_main.png-1196e88b3b574bbbb10d5cc94f3a3d00.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 not shown.

After

Width:  |  Height:  |  Size: 227 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 341 KiB

View File

@ -1,11 +1,21 @@
# 1. 光照系统 # 1. 光照系统Light2D
- godot 的 2D 动态光照 - godot 的 2D 动态光照
- 首先看看 Demo 的预览效果。可以看到,当我们在 Demo 中移动光源的位置,小人和场景也会随之表现出不同光照的情景 - 首先看看 Demo 的预览效果。可以看到,当我们在 Demo 中移动光源的位置,小人和场景也会随之表现出不同光照的情景
![Image text](image/light1.gif) ![Image text](image/light1.gif)
- 那么它和普通的 Sprite 有什么区别呢? 通过对比不难看出它们的差别主要是集中在材质上面。小人使用了自定义的 mat_normal 材质 - 带法线贴图的Sprite和普通的 Sprite 有什么区别呢? 通过对比不难看出它们的差别主要是集中在材质上面。小人使用了自定义的 mat_normal 材质
# 2. 法线贴图NormalMap
- 法线贴图的定义
```
法线贴图就是在原物体的凹凸表面的每个点上均作法线通过RGB颜色通道来标记法线的方向
你可以把它理解成与原凹凸表面平行的另一个不同的表面,但实际上它又只是一个光滑的平面。
对于视觉效果而言,它的效率比原有的凹凸表面更高,若在特定位置上应用光源,可以让细节程度较低的表面生成高细节程度的精确光照方向和反射效果。
```
![Image text](image/light2.jpg) ![Image text](image/light2.jpg)
@ -15,7 +25,22 @@
模拟光照的过程实际上就是模拟整个光的传播过程。 模拟光照的过程实际上就是模拟整个光的传播过程。
``` ```
# 2. 粒子系统 - 需要注意的是法线贴图在3D游戏中运用的更多一点2D稍微少很多
- 法线贴图的制作软件[laigter](https://github.com/azagaya/laigter)
![Image text](image/laigter.JPG)
- godot中使用法线贴图非常的简单
![Image text](image/set-normal-map.gif)
![Image text](image/light-settings.gif)
![Image text](image/simple-sprite-with-normal.gif)
# 3. 光照和阴影LightOccluder2D
- 光照是指光的照射godot 中光照的实现模拟了光对真实世界的影响。在场景中添加光源可以使场景产生相应的光照和阴影效果,获得更好的视觉效果。
![Image text](image/light_shadow_main.png)
# 4. 粒子系统
![Image text](image/particle1.png) ![Image text](image/particle1.png)
![Image text](image/particle2.png) ![Image text](image/particle2.png)
@ -43,4 +68,4 @@
![Image text](image/particle24.png) ![Image text](image/particle24.png)
![Image text](image/particle25.png) ![Image text](image/particle25.png)
![Image text](image/particle26.png) ![Image text](image/particle26.png)
![Image text](image/particle27.png) ![Image text](image/particle27.png)

View File

@ -0,0 +1,16 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://scene/demo11_particle_light/normal_map/azagaya_n.png" type="Texture" id=1]
[ext_resource path="res://scene/demo11_particle_light/normal_map/azagaya.png" type="Texture" id=2]
[ext_resource path="res://scene/demo11_particle_light/normal_map/LightSprite.png" type="Texture" id=3]
[node name="Node2D" type="Node2D"]
[node name="azagaya" type="Sprite" parent="."]
position = Vector2( 270, 199.431 )
texture = ExtResource( 2 )
normal_map = ExtResource( 1 )
[node name="Light2D" type="Light2D" parent="."]
position = Vector2( 306.368, 226.998 )
texture = ExtResource( 3 )

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/LightSprite.png-c40d01886f4a6ec8b4377142d643177e.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://scene/demo11_particle_light/normal_map/LightSprite.png"
dest_files=[ "res://.import/LightSprite.png-c40d01886f4a6ec8b4377142d643177e.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 not shown.

After

Width:  |  Height:  |  Size: 24 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/azagaya.png-ad429dd9403620b051e8578587d08aea.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://scene/demo11_particle_light/normal_map/azagaya.png"
dest_files=[ "res://.import/azagaya.png-ad429dd9403620b051e8578587d08aea.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 not shown.

After

Width:  |  Height:  |  Size: 33 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/azagaya_n.png-5b93a8bb5a6286587518a775b01152a3.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://scene/demo11_particle_light/normal_map/azagaya_n.png"
dest_files=[ "res://.import/azagaya_n.png-5b93a8bb5a6286587518a775b01152a3.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 not shown.

After

Width:  |  Height:  |  Size: 34 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/simplebrick.png-5e16cb9c113a4ed9a022f89e50a799bc.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://scene/demo11_particle_light/normal_map/simplebrick.png"
dest_files=[ "res://.import/simplebrick.png-5e16cb9c113a4ed9a022f89e50a799bc.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 not shown.

After

Width:  |  Height:  |  Size: 57 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/simplebrick_n.png-b5f5247c3aa4e49d79ccb3dd8d40a42e.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://scene/demo11_particle_light/normal_map/simplebrick_n.png"
dest_files=[ "res://.import/simplebrick_n.png-b5f5247c3aa4e49d79ccb3dd8d40a42e.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