Compare commits
19 commits
feature_wa
...
main
Author | SHA1 | Date | |
---|---|---|---|
|
9ec977cf91 | ||
|
717d7ad060 | ||
|
e39e60323b | ||
|
82684c8bc8 | ||
|
7234ba2d04 | ||
|
b2a882fd3b | ||
|
34bfcd6c24 | ||
|
96db8d8f2d | ||
|
a317139785 | ||
|
a1e12e2b5b | ||
|
d1206f2ff8 | ||
|
7b13273359 | ||
|
c56e72483b | ||
|
068aa1e81d | ||
|
da440d21cb | ||
|
b1db5c87cb | ||
|
2872a04d10 | ||
|
7f210df7c5 | ||
|
6dcc968c25 |
|
@ -5,4 +5,3 @@
|
|||
[resource]
|
||||
background_mode = 2
|
||||
background_sky = SubResource( 1 )
|
||||
|
||||
|
|
BIN
materials/decors/rocks/rock_moss.material
(Stored with Git LFS)
Normal file
BIN
materials/tilables/base_plastic_hard_shiny.material
(Stored with Git LFS)
BIN
materials/tilables/base_plastic_soft.material
(Stored with Git LFS)
BIN
materials/tilables/base_steel_glossy.material
(Stored with Git LFS)
BIN
materials/tilables/basic_texture_1024.material
(Stored with Git LFS)
Normal file
|
@ -1,9 +1,10 @@
|
|||
[gd_resource type="SpatialMaterial" load_steps=5 format=2]
|
||||
|
||||
[ext_resource path="res://materials/tilables/textures/Base_suzanha_rock_baseColor.png" type="Texture" id=1]
|
||||
[ext_resource path="res://materials/tilables/textures/Base_suzanha_rock_height.png" type="Texture" id=2]
|
||||
[ext_resource path="res://materials/tilables/textures/Base_suzanha_rock_normal.png" type="Texture" id=3]
|
||||
[ext_resource path="res://materials/tilables/textures/Base_suzanha_rock_roughness.png" type="Texture" id=4]
|
||||
[ext_resource path="res://textures/tilables/stone/Base_suzanha_rock_baseColor.png" type="Texture" id=1]
|
||||
[ext_resource path="res://textures/tilables/stone/Base_suzanha_rock_height.png" type="Texture" id=2]
|
||||
[ext_resource path="res://textures/tilables/stone/Base_suzanha_rock_normal.png" type="Texture" id=3]
|
||||
[ext_resource path="res://textures/tilables/stone/Base_suzanha_rock_roughness.png" type="Texture" id=4]
|
||||
|
||||
|
||||
[resource]
|
||||
albedo_texture = ExtResource( 1 )
|
||||
|
@ -21,4 +22,3 @@ uv1_scale = Vector3( 0.4, 0.4, 0.4 )
|
|||
uv1_offset = Vector3( 0.12, 0.3, 0.14 )
|
||||
uv1_triplanar = true
|
||||
uv2_scale = Vector3( 0.7, 0.7, 0.7 )
|
||||
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
[gd_resource type="SpatialMaterial" load_steps=5 format=2]
|
||||
|
||||
[ext_resource path="res://materials/tilables/textures/Suzahna_bricks_basecolor.png" type="Texture" id=1]
|
||||
[ext_resource path="res://materials/tilables/textures/Suzahna_bricks_height.png" type="Texture" id=2]
|
||||
[ext_resource path="res://materials/tilables/textures/Suzahna_bricks_normal.png" type="Texture" id=3]
|
||||
[ext_resource path="res://materials/tilables/textures/Suzahna_bricks_roughness.png" type="Texture" id=4]
|
||||
[ext_resource path="res://textures/tilables/brick/Suzahna_bricks_basecolor.png" type="Texture" id=1]
|
||||
[ext_resource path="res://textures/tilables/brick/Suzahna_bricks_height.png" type="Texture" id=2]
|
||||
[ext_resource path="res://textures/tilables/brick/Suzahna_bricks_normal.png" type="Texture" id=3]
|
||||
[ext_resource path="res://textures/tilables/brick/Suzahna_bricks_roughness.png" type="Texture" id=4]
|
||||
|
||||
|
||||
[resource]
|
||||
albedo_texture = ExtResource( 1 )
|
||||
|
@ -20,4 +21,3 @@ depth_texture = ExtResource( 2 )
|
|||
uv1_scale = Vector3( 0.7, 0.7, 0.7 )
|
||||
uv1_offset = Vector3( 0.13, 0, 0 )
|
||||
uv1_triplanar = true
|
||||
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
[gd_resource type="SpatialMaterial" load_steps=5 format=2]
|
||||
|
||||
[ext_resource path="res://materials/tilables/textures/Suzahna_bricks_wide_basecolor.png" type="Texture" id=1]
|
||||
[ext_resource path="res://materials/tilables/textures/Suzahna_bricks_wide_height.png" type="Texture" id=2]
|
||||
[ext_resource path="res://materials/tilables/textures/Suzahna_bricks_wide_normal.png" type="Texture" id=3]
|
||||
[ext_resource path="res://materials/tilables/textures/Suzahna_bricks_wide_roughness.png" type="Texture" id=4]
|
||||
[ext_resource path="res://textures/tilables/brick/Suzahna_bricks_wide_basecolor.png" type="Texture" id=1]
|
||||
[ext_resource path="res://textures/tilables/brick/Suzahna_bricks_wide_height.png" type="Texture" id=2]
|
||||
[ext_resource path="res://textures/tilables/brick/Suzahna_bricks_wide_normal.png" type="Texture" id=3]
|
||||
[ext_resource path="res://textures/tilables/brick/Suzahna_bricks_wide_roughness.png" type="Texture" id=4]
|
||||
|
||||
|
||||
[resource]
|
||||
albedo_texture = ExtResource( 1 )
|
||||
|
@ -20,4 +21,3 @@ depth_texture = ExtResource( 2 )
|
|||
uv1_scale = Vector3( 0.7, 0.7, 0.7 )
|
||||
uv1_offset = Vector3( 0, 0, 0.24 )
|
||||
uv1_triplanar = true
|
||||
|
||||
|
|
BIN
materials/tilables/water.material
(Stored with Git LFS)
Normal file
BIN
materials/tilables/water_fountain.material
(Stored with Git LFS)
Normal file
BIN
meshes/creatures/raference/ra_ferens_boots.material
(Stored with Git LFS)
Normal file
BIN
meshes/creatures/raference/ra_ferens_head_arms.material
(Stored with Git LFS)
Normal file
BIN
meshes/creatures/raference/ra_ferens_legs.material
(Stored with Git LFS)
Normal file
BIN
meshes/creatures/raference/ra_ferens_torso.material
(Stored with Git LFS)
Normal file
30
meshes/creatures/raference/raference.tscn
Normal file
|
@ -0,0 +1,30 @@
|
|||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://raference/raference_animated.gltf" type="PackedScene" id=1]
|
||||
[ext_resource path="res://raference/ra_ferens_head_arms.material" type="Material" id=2]
|
||||
|
||||
[node name="raference" index="0" instance=ExtResource( 1 )]
|
||||
|
||||
[node name="bip01_" parent="." index="0"]
|
||||
editor/display_folded = true
|
||||
|
||||
[node name="bip01_2" parent="." index="1"]
|
||||
editor/display_folded = true
|
||||
|
||||
[node name="bip01_3" parent="." index="2"]
|
||||
editor/display_folded = true
|
||||
|
||||
[node name="raference_head" parent="bip01_3" index="0"]
|
||||
material/0 = ExtResource( 2 )
|
||||
|
||||
[node name="bip01_4" parent="." index="3"]
|
||||
editor/display_folded = true
|
||||
|
||||
[node name="bip01_5" parent="." index="4"]
|
||||
editor/display_folded = true
|
||||
|
||||
[node name="bip01_6" parent="." index="5"]
|
||||
editor/display_folded = true
|
||||
|
||||
[node name="AnimationPlayer" parent="." index="8"]
|
||||
autoplay = "_bip01_ca_female_march"
|
27753
meshes/creatures/raference/raference_animated.gltf
Normal file
49
meshes/creatures/raference/textures/raference.json
Normal file
|
@ -0,0 +1,49 @@
|
|||
{
|
||||
"format": {
|
||||
"version": "1.0"
|
||||
},
|
||||
"shaders": {
|
||||
"Main shader": {
|
||||
"parameters": {
|
||||
"Common Parameters": {
|
||||
"ao_intensity": 0.75,
|
||||
"emissive_intensity": 1,
|
||||
"horizonFade": 1.2999999523162842,
|
||||
"nbSamples": 16
|
||||
},
|
||||
"Parallax Occlusion Mapping": {
|
||||
"maxPOMSamples": 16,
|
||||
"minPOMSamples": 4,
|
||||
"pomStrength": 1,
|
||||
"usePOM": false
|
||||
},
|
||||
"Subsurface Scattering Parameters": {
|
||||
"sssColor": [
|
||||
0.7009999752044678,
|
||||
0.3009999990463257,
|
||||
0.3050000071525574
|
||||
],
|
||||
"sssEnabled": true,
|
||||
"sssScale": 0.5,
|
||||
"sssType": 1
|
||||
}
|
||||
},
|
||||
"shader": "pbr-metal-rough",
|
||||
"shaderInstance": "Main shader"
|
||||
}
|
||||
},
|
||||
"texturesets": {
|
||||
"ra_ferens_boots": {
|
||||
"shader": "Main shader"
|
||||
},
|
||||
"ra_ferens_head_arms": {
|
||||
"shader": "Main shader"
|
||||
},
|
||||
"ra_ferens_legs": {
|
||||
"shader": "Main shader"
|
||||
},
|
||||
"ra_ferens_torso": {
|
||||
"shader": "Main shader"
|
||||
}
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 675 KiB |
After Width: | Height: | Size: 275 KiB |
After Width: | Height: | Size: 548 KiB |
After Width: | Height: | Size: 928 KiB |
After Width: | Height: | Size: 789 KiB |
After Width: | Height: | Size: 323 KiB |
After Width: | Height: | Size: 647 KiB |
After Width: | Height: | Size: 1.1 MiB |
After Width: | Height: | Size: 1.1 MiB |
After Width: | Height: | Size: 357 KiB |
After Width: | Height: | Size: 629 KiB |
After Width: | Height: | Size: 1.3 MiB |
After Width: | Height: | Size: 475 KiB |
After Width: | Height: | Size: 321 KiB |
After Width: | Height: | Size: 432 KiB |
After Width: | Height: | Size: 1 MiB |
BIN
meshes/decors/rocks/Rocky_cliff.material
(Stored with Git LFS)
Normal file
73
meshes/decors/rocks/cliff.gd
Normal file
|
@ -0,0 +1,73 @@
|
|||
tool
|
||||
extends Spatial
|
||||
|
||||
## Moss.
|
||||
# Moss height.
|
||||
export var moss_height = 10.0 setget set_moss_height, get_moss_height
|
||||
func set_moss_height( value ):
|
||||
moss_height = value
|
||||
|
||||
for children in self.get_children():
|
||||
for mesh in children.get_children():
|
||||
if mesh is MeshInstance:
|
||||
mesh.get_surface_material( 0 ).next_pass.set_shader_param( "height_thresold", moss_height )
|
||||
|
||||
func get_moss_height():
|
||||
return moss_height
|
||||
# Moss fade.
|
||||
export var moss_fade = 5.0 setget set_moss_fade, get_moss_fade
|
||||
func set_moss_fade( value ):
|
||||
moss_fade = value
|
||||
|
||||
for children in self.get_children():
|
||||
for mesh in children.get_children():
|
||||
if mesh is MeshInstance:
|
||||
mesh.get_surface_material( 0 ).next_pass.set_shader_param( "height_fade", moss_fade )
|
||||
|
||||
func get_moss_fade():
|
||||
return moss_fade
|
||||
|
||||
# Moss depth min.
|
||||
export var moss_depth_min = 0.73 setget set_moss_depth_min, get_moss_depth_min
|
||||
func set_moss_depth_min( value ):
|
||||
moss_depth_min = value
|
||||
|
||||
for children in self.get_children():
|
||||
for mesh in children.get_children():
|
||||
if mesh is MeshInstance:
|
||||
var ao_gradiant = mesh.get_surface_material( 0 ).next_pass.get_shader_param( "cliff_ao_gradiant" )
|
||||
ao_gradiant.gradient.offsets[0] = moss_depth_min
|
||||
ao_gradiant.gradient.colors[0] = Color( 1.0, 1.0, 1.0, 1.0 )
|
||||
ao_gradiant.gradient.offsets[1] = moss_depth_max
|
||||
ao_gradiant.gradient.colors[1] = Color( 0.0, 0.0, 0.0, 1.0 )
|
||||
mesh.get_surface_material( 0 ).next_pass.set_shader_param( "cliff_ao_gradiant", ao_gradiant )
|
||||
|
||||
func get_moss_depth_min():
|
||||
return moss_depth_min
|
||||
|
||||
# Moss depth max.
|
||||
export var moss_depth_max = 0.93 setget set_moss_depth_max, get_moss_depth_max
|
||||
func set_moss_depth_max( value ):
|
||||
moss_depth_max = value
|
||||
|
||||
for children in self.get_children():
|
||||
for mesh in children.get_children():
|
||||
if mesh is MeshInstance:
|
||||
var ao_gradiant = mesh.get_surface_material( 0 ).next_pass.get_shader_param( "cliff_ao_gradiant" )
|
||||
ao_gradiant.gradient.offsets[0] = moss_depth_min
|
||||
ao_gradiant.gradient.colors[0] = Color( 1.0, 1.0, 1.0, 1.0 )
|
||||
ao_gradiant.gradient.offsets[1] = moss_depth_max
|
||||
ao_gradiant.gradient.colors[1] = Color( 0.0, 0.0, 0.0, 1.0 )
|
||||
mesh.get_surface_material( 0 ).next_pass.set_shader_param( "cliff_ao_gradiant", ao_gradiant )
|
||||
|
||||
func get_moss_depth_max():
|
||||
return moss_depth_max
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
pass # Replace with function body.
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
#func _process(delta):
|
||||
# pass
|
14
meshes/decors/rocks/cliff_001.tscn
Normal file
|
@ -0,0 +1,14 @@
|
|||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://meshes/decors/rocks/cliff.gd" type="Script" id=1]
|
||||
[ext_resource path="res://meshes/decors/rocks/rock_001.tscn" type="PackedScene" id=2]
|
||||
|
||||
[node name="cliff" type="Spatial"]
|
||||
script = ExtResource( 1 )
|
||||
moss_depth_max = 0.73
|
||||
|
||||
[node name="rock_001" parent="." instance=ExtResource( 2 )]
|
||||
transform = Transform( -0.996195, 3.80969e-009, 0.0871556, 0.0871556, 4.35451e-008, 0.996195, 0, 1, -4.37114e-008, 0, 10, 0 )
|
||||
|
||||
[node name="rock_006" parent="." instance=ExtResource( 2 )]
|
||||
transform = Transform( -0.996195, 3.80969e-009, 0.0871556, 0.0871556, 4.35451e-008, 0.996195, 0, 1, -4.37114e-008, 0, 27, 0 )
|
BIN
meshes/decors/rocks/rock_001.glb
(Stored with Git LFS)
Normal file
10
meshes/decors/rocks/rock_001.tscn
Normal file
|
@ -0,0 +1,10 @@
|
|||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://meshes/decors/rocks/rock_001.glb" type="PackedScene" id=1]
|
||||
[ext_resource path="res://materials/decors/rocks/rock_moss.material" type="Material" id=2]
|
||||
|
||||
[node name="rock_001" instance=ExtResource( 1 )]
|
||||
|
||||
[node name="Cliff_test_01" parent="." index="0"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )
|
||||
material/0 = ExtResource( 2 )
|
|
@ -1,9 +1,12 @@
|
|||
[gd_scene load_steps=5 format=2]
|
||||
[gd_scene load_steps=7 format=2]
|
||||
|
||||
[ext_resource path="res://meshes/props/fountain_suzanha/foutain_suzanha.escn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://materials/tilables/suzahna_bricks.tres" type="Material" id=2]
|
||||
[ext_resource path="res://materials/tilables/suzahna_bricks_wide.tres" type="Material" id=3]
|
||||
[ext_resource path="res://materials/tilables/suzahna_base.tres" type="Material" id=4]
|
||||
[ext_resource path="res://materials/tilables/water_fountain.material" type="Material" id=5]
|
||||
|
||||
[sub_resource type="PlaneMesh" id=1]
|
||||
|
||||
[node name="Fountain_suzanha" index="0" instance=ExtResource( 1 )]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.47228, 0 )
|
||||
|
@ -17,3 +20,7 @@ material/0 = ExtResource( 3 )
|
|||
[node name="Fountain_suzanha_waterhole" parent="." index="2"]
|
||||
material/0 = ExtResource( 4 )
|
||||
|
||||
[node name="water" type="MeshInstance" parent="." index="3"]
|
||||
transform = Transform( 1.86, 0, 0, 0, 1, 0, 0, 0, 0.77, 0.0789185, 0.304244, 0 )
|
||||
mesh = SubResource( 1 )
|
||||
material/0 = ExtResource( 5 )
|
||||
|
|
21
meshes/props/travel_box/container.gd
Normal file
|
@ -0,0 +1,21 @@
|
|||
tool
|
||||
extends Spatial
|
||||
|
||||
export( Color ) var color = Color( 1.0, 1.0, 1.0, 1.0 ) setget set_color
|
||||
func set_color( value ):
|
||||
color = value
|
||||
$container_bottom/container_bottom.get_surface_material( 0 ).albedo_color = self.color
|
||||
$container_lid/container_lid.get_surface_material( 0 ).albedo_color = self.color
|
||||
|
||||
export( Color ) var color2 = Color( 1.0, 1.0, 1.0, 1.0 ) setget set_color2
|
||||
func set_color2( value ):
|
||||
color2 = value
|
||||
$container_bottom/container_bottom.get_surface_material( 1 ).albedo_color = self.color2
|
||||
$container_lid/container_lid.get_surface_material( 1 ).albedo_color = self.color2
|
||||
|
||||
export( float ) var lid_angle = 0.0 setget set_lid_angle
|
||||
func set_lid_angle( value ):
|
||||
if value < 0.0 or value > 100.0:
|
||||
return
|
||||
lid_angle = value
|
||||
$container_lid.rotation_degrees = Vector3( -lid_angle, 0.0, 0.0 )
|
|
@ -1,12 +1,15 @@
|
|||
[gd_scene load_steps=3 format=2]
|
||||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://meshes/props/travel_box/container_bottom.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://meshes/props/travel_box/container_lid.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://meshes/props/travel_box/container.gd" type="Script" id=3]
|
||||
|
||||
[node name="container" type="Spatial"]
|
||||
script = ExtResource( 3 )
|
||||
color = Color( 0.0352941, 0.0431373, 0.0627451, 1 )
|
||||
color2 = Color( 0.168627, 0.172549, 0.211765, 1 )
|
||||
|
||||
[node name="container_bottom" parent="." instance=ExtResource( 1 )]
|
||||
|
||||
[node name="container_lid" parent="." instance=ExtResource( 2 )]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.001, 0.389, -0.381 )
|
||||
|
||||
|
|
|
@ -1,14 +1,51 @@
|
|||
[gd_scene load_steps=5 format=2]
|
||||
[gd_scene load_steps=14 format=2]
|
||||
|
||||
[ext_resource path="res://meshes/props/travel_box/travel_box_bottom.escn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://materials/tilables/base_plastic_soft.material" type="Material" id=2]
|
||||
[ext_resource path="res://materials/tilables/base_plastic_hard_shiny.material" type="Material" id=3]
|
||||
[ext_resource path="res://materials/tilables/base_steel_glossy.material" type="Material" id=4]
|
||||
[ext_resource path="res://textures/tilables/plastic/base_plastic_soft_roughness.png" type="Texture" id=2]
|
||||
[ext_resource path="res://textures/tilables/plastic/base_plastic_soft_colorRange.png" type="Texture" id=3]
|
||||
[ext_resource path="res://textures/tilables/plastic/base_plastic_soft_normal.png" type="Texture" id=4]
|
||||
[ext_resource path="res://textures/tilables/steel/base_steel_glossy_roughness.png" type="Texture" id=5]
|
||||
[ext_resource path="res://textures/tilables/plastic/base_plastic_hard_shiny_colorRange.png" type="Texture" id=6]
|
||||
[ext_resource path="res://textures/tilables/plastic/base_plastic_hard_shiny_roughness.png" type="Texture" id=7]
|
||||
[ext_resource path="res://textures/tilables/plastic/base_plastic_hard_shiny_normal.png" type="Texture" id=8]
|
||||
[ext_resource path="res://textures/tilables/steel/base_steel_glossy_basecolor.png" type="Texture" id=9]
|
||||
[ext_resource path="res://textures/tilables/steel/base_steel_glossy_normal.png" type="Texture" id=10]
|
||||
|
||||
[node name="container_bottom" index="0" instance=ExtResource( 1 )]
|
||||
|
||||
|
||||
|
||||
[sub_resource type="SpatialMaterial" id=1]
|
||||
resource_local_to_scene = true
|
||||
resource_name = "base_plastic_soft"
|
||||
albedo_texture = ExtResource( 3 )
|
||||
roughness_texture = ExtResource( 2 )
|
||||
normal_enabled = true
|
||||
normal_scale = 1.0
|
||||
normal_texture = ExtResource( 4 )
|
||||
|
||||
[sub_resource type="SpatialMaterial" id=2]
|
||||
resource_local_to_scene = true
|
||||
resource_name = "base_plastic_hard_shiny"
|
||||
albedo_color = Color( 0.219608, 0.278431, 0.321569, 1 )
|
||||
albedo_texture = ExtResource( 6 )
|
||||
roughness_texture = ExtResource( 7 )
|
||||
normal_enabled = true
|
||||
normal_scale = 1.0
|
||||
normal_texture = ExtResource( 8 )
|
||||
uv1_triplanar = true
|
||||
|
||||
[sub_resource type="SpatialMaterial" id=3]
|
||||
resource_local_to_scene = true
|
||||
albedo_texture = ExtResource( 9 )
|
||||
metallic = 1.0
|
||||
roughness_texture = ExtResource( 5 )
|
||||
normal_enabled = true
|
||||
normal_scale = 1.0
|
||||
normal_texture = ExtResource( 10 )
|
||||
|
||||
[node name="container_bottom" instance=ExtResource( 1 )]
|
||||
|
||||
[node name="container_bottom" parent="." index="0"]
|
||||
material/0 = ExtResource( 2 )
|
||||
material/1 = ExtResource( 3 )
|
||||
material/2 = ExtResource( 4 )
|
||||
|
||||
material/0 = SubResource( 1 )
|
||||
material/1 = SubResource( 2 )
|
||||
material/2 = SubResource( 3 )
|
||||
|
|
|
@ -12,4 +12,3 @@ transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )
|
|||
material/0 = ExtResource( 2 )
|
||||
material/1 = ExtResource( 3 )
|
||||
material/2 = ExtResource( 4 )
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
tool
|
||||
extends Spatial
|
||||
|
||||
var _mouse_look = false
|
||||
|
@ -15,11 +16,26 @@ export(float) var camera_smoothness = 0.5
|
|||
export(float) var camera_speed = 1.0
|
||||
export(float) var camera_accel = 10.0
|
||||
|
||||
var iTime=0.0
|
||||
var iFrame=0
|
||||
|
||||
signal time_frame_changed(time, frame)
|
||||
|
||||
func _ready():
|
||||
self._current_camera_speed = self.camera_speed
|
||||
|
||||
|
||||
$settings.show()
|
||||
|
||||
$sky/viewport/sprite.set_time_of_day( 16.0, $light_system/directional_light, 25.0 )
|
||||
|
||||
func _process( delta ):
|
||||
|
||||
iTime+=delta
|
||||
iFrame+=1
|
||||
|
||||
if (Engine.is_editor_hint() and $sky/viewport/sprite.editor_clouds_playing) or !Engine.is_editor_hint():
|
||||
emit_signal("time_frame_changed", iTime, iFrame)
|
||||
|
||||
if Input.is_action_pressed("move_up"):
|
||||
$dummy/camera_stand.translate( Vector3( 0.0, self._current_camera_speed*delta, 0.0 ) )
|
||||
elif Input.is_action_pressed("move_down"):
|
||||
|
@ -75,4 +91,7 @@ func _input(event):
|
|||
if event.is_action_pressed( "move_speed" ):
|
||||
self._current_camera_speed = self.camera_speed + self.camera_accel
|
||||
elif event.is_action_released( "move_speed" ):
|
||||
self._current_camera_speed = self.camera_speed
|
||||
self._current_camera_speed = self.camera_speed
|
||||
|
||||
if event.is_action_pressed( "ui_settings_window" ):
|
||||
$settings.visible = !$settings.visible
|
|
@ -1,34 +1,81 @@
|
|||
[gd_scene load_steps=13 format=2]
|
||||
[gd_scene load_steps=24 format=2]
|
||||
|
||||
[ext_resource path="res://previewer/previewer.gd" type="Script" id=1]
|
||||
[ext_resource path="res://previewer/dummy/dummy.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://materials/tilables/textures/base_UV_check_big.png" type="Texture" id=3]
|
||||
[ext_resource path="res://meshes/props/pendo_teddy/pendo_teddy.tscn" type="PackedScene" id=4]
|
||||
[ext_resource path="res://meshes/props/travel_box/container.tscn" type="PackedScene" id=5]
|
||||
[ext_resource path="res://meshes/props/reference_box/reference_box.tscn" type="PackedScene" id=6]
|
||||
[ext_resource path="res://meshes/props/fountain_suzanha/Fountain_suzanha.tscn" type="PackedScene" id=7]
|
||||
[ext_resource path="res://shaders/sky.shader" type="Shader" id=2]
|
||||
[ext_resource path="res://previewer/sky.gd" type="Script" id=3]
|
||||
[ext_resource path="res://previewer/dummy/dummy.tscn" type="PackedScene" id=4]
|
||||
[ext_resource path="res://textures/tilables/basic_texture_1024.png" type="Texture" id=5]
|
||||
[ext_resource path="res://meshes/decors/rocks/cliff_001.tscn" type="PackedScene" id=6]
|
||||
[ext_resource path="res://materials/tilables/water.material" type="Material" id=7]
|
||||
[ext_resource path="res://meshes/props/pendo_teddy/pendo_teddy.tscn" type="PackedScene" id=8]
|
||||
[ext_resource path="res://meshes/props/travel_box/container.tscn" type="PackedScene" id=9]
|
||||
[ext_resource path="res://meshes/props/reference_box/reference_box.tscn" type="PackedScene" id=10]
|
||||
[ext_resource path="res://meshes/props/fountain_suzanha/Fountain_suzanha.tscn" type="PackedScene" id=11]
|
||||
[ext_resource path="res://previewer/settings.tscn" type="PackedScene" id=12]
|
||||
|
||||
[sub_resource type="ProceduralSky" id=1]
|
||||
[sub_resource type="OpenSimplexNoise" id=1]
|
||||
period = 8.0
|
||||
|
||||
[sub_resource type="Environment" id=2]
|
||||
[sub_resource type="NoiseTexture" id=2]
|
||||
width = 1280
|
||||
height = 720
|
||||
seamless = true
|
||||
noise = SubResource( 1 )
|
||||
|
||||
[sub_resource type="ShaderMaterial" id=3]
|
||||
shader = ExtResource( 2 )
|
||||
shader_param/iTime = 452.999
|
||||
shader_param/iFrame = 20840
|
||||
shader_param/COVERAGE = 0.5
|
||||
shader_param/THICKNESS = 25.0
|
||||
shader_param/ABSORPTION = 1.031
|
||||
shader_param/STEPS = 25
|
||||
shader_param/earth_radius_km = 6371.0
|
||||
shader_param/atmo_radius_km = 6471.0
|
||||
shader_param/cam_height_m = 1.8
|
||||
shader_param/sun_pos = Vector3( -6.85618, 85.5364, 51.347 )
|
||||
shader_param/sun_intensity = 42.0
|
||||
shader_param/rayleigh_coeff = Vector3( 5.5, 13, 22.4 )
|
||||
shader_param/mie_coeff = 21.0
|
||||
shader_param/rayleigh_scale = 800.0
|
||||
shader_param/mie_scale = 120.0
|
||||
shader_param/mie_scatter_dir = 0.758
|
||||
shader_param/rotate_night_sky = null
|
||||
shader_param/iChannel0 = SubResource( 2 )
|
||||
|
||||
[sub_resource type="ImageTexture" id=4]
|
||||
size = Vector2( 1280, 720 )
|
||||
|
||||
[sub_resource type="ViewportTexture" id=5]
|
||||
viewport_path = NodePath("sky/viewport")
|
||||
|
||||
[sub_resource type="PanoramaSky" id=6]
|
||||
resource_local_to_scene = true
|
||||
panorama = SubResource( 5 )
|
||||
|
||||
[sub_resource type="Environment" id=7]
|
||||
resource_local_to_scene = true
|
||||
background_mode = 2
|
||||
background_sky = SubResource( 1 )
|
||||
background_sky = SubResource( 6 )
|
||||
background_energy = 0.1
|
||||
ambient_light_energy = 3.82
|
||||
|
||||
[sub_resource type="SpatialMaterial" id=3]
|
||||
albedo_texture = ExtResource( 3 )
|
||||
uv1_scale = Vector3( 7.6, 7.6, 7.6 )
|
||||
uv1_offset = Vector3( 0.2, 0.2, 0 )
|
||||
[sub_resource type="SpatialMaterial" id=8]
|
||||
flags_unshaded = true
|
||||
flags_world_triplanar = true
|
||||
albedo_texture = ExtResource( 5 )
|
||||
uv1_scale = Vector3( 122, 122, 122 )
|
||||
|
||||
[sub_resource type="PlaneMesh" id=4]
|
||||
material = SubResource( 3 )
|
||||
[sub_resource type="PlaneMesh" id=9]
|
||||
material = SubResource( 8 )
|
||||
|
||||
[sub_resource type="GIProbeData" id=5]
|
||||
bounds = AABB( -63.192, -10, -76.3229, 126.384, 20, 152.646 )
|
||||
[sub_resource type="PlaneMesh" id=10]
|
||||
|
||||
[sub_resource type="GIProbeData" id=11]
|
||||
bounds = AABB( -63.192, -25, -76.323, 126.384, 50, 152.646 )
|
||||
cell_size = 1.19255
|
||||
to_cell_xform = Transform( 0.838543, 0, 0, 0, 0.838543, 0, 0, 0, 0.838543, 52.9891, 8.38543, 64 )
|
||||
dynamic_data = PoolIntArray( 0, 8, 128, 32, 128, 1, 0, 0, 2, 10, 0, 0, 8, 0, 322761760, 0, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 8355711, 0 )
|
||||
to_cell_xform = Transform( 0.838542, 0, 0, 0, 0.838542, 0, 0, 0, 0.838542, 52.9891, 20.9635, 64 )
|
||||
dynamic_data = PoolIntArray( 0, 8, 128, 64, 128, 1, 0, 0, 0, 1094713344, 0, 0, 7, 0, 1, 3126, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 8355711, 0 )
|
||||
dynamic_range = 4
|
||||
bias = 1.5
|
||||
normal_bias = 0.0
|
||||
|
@ -37,38 +84,88 @@ propagation = 0.7
|
|||
[node name="previewer" type="Spatial"]
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="world_environment" type="WorldEnvironment" parent="."]
|
||||
environment = SubResource( 2 )
|
||||
[node name="sky" type="Spatial" parent="."]
|
||||
|
||||
[node name="dummy" parent="." instance=ExtResource( 2 )]
|
||||
[node name="viewport" type="Viewport" parent="sky"]
|
||||
size = Vector2( 1280, 720 )
|
||||
render_target_update_mode = 3
|
||||
|
||||
[node name="sprite" type="Sprite" parent="sky/viewport"]
|
||||
material = SubResource( 3 )
|
||||
texture = SubResource( 4 )
|
||||
centered = false
|
||||
script = ExtResource( 3 )
|
||||
directional_light_node_path = NodePath("../../../light_system/directional_light")
|
||||
sun_position = Vector3( -6.85618, 85.5364, 51.347 )
|
||||
|
||||
[node name="world_environment" type="WorldEnvironment" parent="."]
|
||||
environment = SubResource( 7 )
|
||||
|
||||
[node name="dummy" parent="." instance=ExtResource( 4 )]
|
||||
|
||||
[node name="terrain" type="Spatial" parent="."]
|
||||
|
||||
[node name="test_csg_mesh" type="CSGMesh" parent="terrain"]
|
||||
transform = Transform( 60.964, 0, 0, 0, 1.21928, 0, 0, 0, 60.964, 0, 0, 0 )
|
||||
mesh = SubResource( 4 )
|
||||
mesh = SubResource( 9 )
|
||||
|
||||
[node name="cliff" parent="terrain" instance=ExtResource( 6 )]
|
||||
transform = Transform( 0.778102, 0, 0.628138, 0, 1, 0, -0.628138, 0, 0.778102, -24.4077, -0.000944138, -27.3821 )
|
||||
moss_height = 15.0
|
||||
moss_fade = 2.5
|
||||
moss_depth_min = 0.73
|
||||
|
||||
[node name="water" type="MeshInstance" parent="terrain"]
|
||||
transform = Transform( 22.72, 0, 0, 0, 1, 0, 0, 0, 18.77, -27.5637, 0.428694, -26.1742 )
|
||||
mesh = SubResource( 10 )
|
||||
material/0 = ExtResource( 7 )
|
||||
|
||||
[node name="props" type="Spatial" parent="."]
|
||||
|
||||
[node name="pendo_teddy" parent="props" instance=ExtResource( 4 )]
|
||||
[node name="pendo_teddy" parent="props" instance=ExtResource( 8 )]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -3 )
|
||||
|
||||
[node name="container" parent="props" instance=ExtResource( 5 )]
|
||||
[node name="container" parent="props" instance=ExtResource( 9 )]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -5 )
|
||||
color = Color( 0.145098, 0.0980392, 0.713726, 1 )
|
||||
lid_angle = 45.0
|
||||
|
||||
[node name="reference_box" parent="props" instance=ExtResource( 6 )]
|
||||
[node name="container_2" parent="props" instance=ExtResource( 9 )]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -1.24144, 0, -5 )
|
||||
color = Color( 0.491686, 0.159256, 0.832031, 1 )
|
||||
lid_angle = 90.0
|
||||
|
||||
[node name="Fountain_suzanha" parent="props" instance=ExtResource( 7 )]
|
||||
[node name="container_3" parent="props" instance=ExtResource( 9 )]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -2.6614, 0, -5 )
|
||||
color = Color( 0.360784, 1, 0, 1 )
|
||||
lid_angle = 12.0
|
||||
|
||||
[node name="container_4" parent="props" instance=ExtResource( 9 )]
|
||||
transform = Transform( 0.457191, 0, 0.889369, 0, 1, 0, -0.889369, 0, 0.457191, -3.94754, 4.76837e-07, -4.27729 )
|
||||
color = Color( 0.972549, 0.196078, 0.0431373, 1 )
|
||||
lid_angle = 0.0
|
||||
|
||||
[node name="reference_box" parent="props" instance=ExtResource( 10 )]
|
||||
|
||||
[node name="Fountain_suzanha" parent="props" instance=ExtResource( 11 )]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 5, 0.472, -5 )
|
||||
|
||||
[node name="light_system" type="Spatial" parent="."]
|
||||
|
||||
[node name="directional_light" type="DirectionalLight" parent="light_system"]
|
||||
transform = Transform( 0.522088, 0.655715, -0.545401, 0, 0.639473, 0.768814, 0.852892, -0.401389, 0.333861, 0, 13.7088, 0 )
|
||||
light_energy = 2.21
|
||||
transform = Transform( 0.991203, 0.113209, -0.0685618, 0, 0.518027, 0.855364, 0.132352, -0.84784, 0.51347, -6.85618, 85.5364, 51.347 )
|
||||
light_energy = 0.653333
|
||||
shadow_enabled = true
|
||||
|
||||
[node name="gi_probe" type="GIProbe" parent="light_system"]
|
||||
extents = Vector3( 63.192, 10, 76.3229 )
|
||||
data = SubResource( 5 )
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 21.7307, 0 )
|
||||
extents = Vector3( 63.192, 25, 76.323 )
|
||||
data = SubResource( 11 )
|
||||
|
||||
[node name="settings" parent="." instance=ExtResource( 12 )]
|
||||
visible = true
|
||||
margin_left = -475.0
|
||||
margin_top = -243.0
|
||||
margin_right = -219.0
|
||||
margin_bottom = 13.0
|
||||
[connection signal="time_frame_changed" from="." to="sky/viewport/sprite" method="_on_previewer_time_frame_changed"]
|
||||
|
|
19
previewer/settings.gd
Normal file
|
@ -0,0 +1,19 @@
|
|||
extends WindowDialog
|
||||
|
||||
onready var sky_sprite = get_tree().get_root().get_node("previewer/sky/viewport/sprite")
|
||||
|
||||
func _on_sky_coverage_value_changed(value):
|
||||
sky_sprite.cov_scb( value )
|
||||
|
||||
func _on_sky_thickness_value_changed(value):
|
||||
sky_sprite.thick_scb( value )
|
||||
|
||||
func _on_sky_absorption_value_changed(value):
|
||||
sky_sprite.absb_scb( value )
|
||||
|
||||
func _on_sky_steps_value_changed(value):
|
||||
sky_sprite.step_scb( value )
|
||||
|
||||
|
||||
func _on_sky_time_value_changed(value):
|
||||
sky_sprite.set_time_of_day( value, get_tree().get_root().get_node("previewer/light_system/directional_light"), 25.0 )
|
154
previewer/settings.tscn
Normal file
|
@ -0,0 +1,154 @@
|
|||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://previewer/settings.gd" type="Script" id=1]
|
||||
|
||||
[node name="settings" type="WindowDialog"]
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
margin_left = -512.0
|
||||
margin_top = -300.0
|
||||
margin_right = -256.0
|
||||
margin_bottom = -44.0
|
||||
size_flags_horizontal = 2
|
||||
size_flags_vertical = 2
|
||||
popup_exclusive = true
|
||||
window_title = "Settings (T)"
|
||||
resizable = true
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="scroll_container" type="ScrollContainer" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
size_flags_horizontal = 7
|
||||
size_flags_vertical = 7
|
||||
|
||||
[node name="controls" type="VBoxContainer" parent="scroll_container"]
|
||||
margin_right = 256.0
|
||||
margin_bottom = 256.0
|
||||
size_flags_horizontal = 7
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="sky_label" type="Label" parent="scroll_container/controls"]
|
||||
margin_right = 256.0
|
||||
margin_bottom = 14.0
|
||||
text = "Sky"
|
||||
align = 1
|
||||
valign = 1
|
||||
|
||||
[node name="sky_box" type="VBoxContainer" parent="scroll_container/controls"]
|
||||
margin_top = 18.0
|
||||
margin_right = 256.0
|
||||
margin_bottom = 94.0
|
||||
|
||||
[node name="sky_coverage_box" type="HBoxContainer" parent="scroll_container/controls/sky_box"]
|
||||
margin_right = 256.0
|
||||
margin_bottom = 16.0
|
||||
|
||||
[node name="label" type="Label" parent="scroll_container/controls/sky_box/sky_coverage_box"]
|
||||
margin_top = 1.0
|
||||
margin_right = 126.0
|
||||
margin_bottom = 15.0
|
||||
size_flags_horizontal = 3
|
||||
text = "Coverage"
|
||||
align = 2
|
||||
|
||||
[node name="sky_coverage" type="HSlider" parent="scroll_container/controls/sky_box/sky_coverage_box"]
|
||||
margin_left = 130.0
|
||||
margin_right = 256.0
|
||||
margin_bottom = 16.0
|
||||
size_flags_horizontal = 3
|
||||
max_value = 1.0
|
||||
step = 0.001
|
||||
value = 0.5
|
||||
|
||||
[node name="sky_thickness_box" type="HBoxContainer" parent="scroll_container/controls/sky_box"]
|
||||
margin_top = 20.0
|
||||
margin_right = 256.0
|
||||
margin_bottom = 36.0
|
||||
|
||||
[node name="label" type="Label" parent="scroll_container/controls/sky_box/sky_thickness_box"]
|
||||
margin_top = 1.0
|
||||
margin_right = 126.0
|
||||
margin_bottom = 15.0
|
||||
size_flags_horizontal = 3
|
||||
text = "Thickness"
|
||||
align = 2
|
||||
|
||||
[node name="sky_thickness" type="HSlider" parent="scroll_container/controls/sky_box/sky_thickness_box"]
|
||||
margin_left = 130.0
|
||||
margin_right = 256.0
|
||||
margin_bottom = 16.0
|
||||
size_flags_horizontal = 3
|
||||
value = 25.0
|
||||
|
||||
[node name="sky_absorption_box" type="HBoxContainer" parent="scroll_container/controls/sky_box"]
|
||||
margin_top = 40.0
|
||||
margin_right = 256.0
|
||||
margin_bottom = 56.0
|
||||
|
||||
[node name="label" type="Label" parent="scroll_container/controls/sky_box/sky_absorption_box"]
|
||||
margin_top = 1.0
|
||||
margin_right = 126.0
|
||||
margin_bottom = 15.0
|
||||
size_flags_horizontal = 3
|
||||
text = "Absorbtion"
|
||||
align = 2
|
||||
|
||||
[node name="sky_absorption" type="HSlider" parent="scroll_container/controls/sky_box/sky_absorption_box"]
|
||||
margin_left = 130.0
|
||||
margin_right = 256.0
|
||||
margin_bottom = 16.0
|
||||
size_flags_horizontal = 3
|
||||
max_value = 10.0
|
||||
step = 0.001
|
||||
value = 1.031
|
||||
|
||||
[node name="sky_steps_box" type="HBoxContainer" parent="scroll_container/controls/sky_box"]
|
||||
margin_top = 60.0
|
||||
margin_right = 256.0
|
||||
margin_bottom = 76.0
|
||||
|
||||
[node name="label" type="Label" parent="scroll_container/controls/sky_box/sky_steps_box"]
|
||||
margin_top = 1.0
|
||||
margin_right = 126.0
|
||||
margin_bottom = 15.0
|
||||
size_flags_horizontal = 3
|
||||
text = "Steps"
|
||||
align = 2
|
||||
|
||||
[node name="sky_steps" type="HSlider" parent="scroll_container/controls/sky_box/sky_steps_box"]
|
||||
margin_left = 130.0
|
||||
margin_right = 256.0
|
||||
margin_bottom = 16.0
|
||||
size_flags_horizontal = 3
|
||||
value = 25.0
|
||||
ticks_on_borders = true
|
||||
|
||||
[node name="sky_time_box" type="HBoxContainer" parent="scroll_container/controls/sky_box"]
|
||||
margin_top = 60.0
|
||||
margin_right = 256.0
|
||||
margin_bottom = 76.0
|
||||
|
||||
[node name="label" type="Label" parent="scroll_container/controls/sky_box/sky_time_box"]
|
||||
margin_top = 1.0
|
||||
margin_right = 126.0
|
||||
margin_bottom = 15.0
|
||||
size_flags_horizontal = 3
|
||||
text = "Time of day"
|
||||
align = 2
|
||||
|
||||
[node name="sky_time" type="HSlider" parent="scroll_container/controls/sky_box/sky_time_box"]
|
||||
margin_left = 130.0
|
||||
margin_right = 256.0
|
||||
margin_bottom = 16.0
|
||||
size_flags_horizontal = 3
|
||||
max_value = 24.0
|
||||
step = 0.01
|
||||
value = 16.0
|
||||
[connection signal="value_changed" from="scroll_container/controls/sky_box/sky_coverage_box/sky_coverage" to="." method="_on_sky_coverage_value_changed"]
|
||||
[connection signal="value_changed" from="scroll_container/controls/sky_box/sky_thickness_box/sky_thickness" to="." method="_on_sky_thickness_value_changed"]
|
||||
[connection signal="value_changed" from="scroll_container/controls/sky_box/sky_absorption_box/sky_absorption" to="." method="_on_sky_absorption_value_changed"]
|
||||
[connection signal="value_changed" from="scroll_container/controls/sky_box/sky_steps_box/sky_steps" to="." method="_on_sky_steps_value_changed"]
|
||||
[connection signal="value_changed" from="scroll_container/controls/sky_box/sky_time_box/sky_time" to="." method="_on_sky_time_value_changed"]
|
57
previewer/sky.gd
Normal file
|
@ -0,0 +1,57 @@
|
|||
tool
|
||||
extends Sprite
|
||||
|
||||
export(bool) var editor_clouds_playing = false
|
||||
export(float, 0.0, 24.0) var day_time_hours = 12.0 setget set_day_time_hours
|
||||
|
||||
export(NodePath) var directional_light_node_path
|
||||
|
||||
func _ready():
|
||||
if !Engine.is_editor_hint():
|
||||
editor_clouds_playing = true
|
||||
|
||||
func _on_previewer_time_frame_changed(time, frame):
|
||||
self.material.set("shader_param/iTime", time)
|
||||
self.material.set("shader_param/iFrame", frame)
|
||||
|
||||
|
||||
func cov_scb(value):
|
||||
self.material.set("shader_param/COVERAGE",float(value))
|
||||
|
||||
func thick_scb(value):
|
||||
self.material.set("shader_param/THICKNESS",value)
|
||||
|
||||
func absb_scb(value):
|
||||
self.material.set("shader_param/ABSORPTION",float(value))
|
||||
|
||||
func step_scb(value):
|
||||
self.material.set("shader_param/STEPS",value)
|
||||
|
||||
|
||||
export var sun_position = Vector3(0.0, 1.0, 0.0) setget set_sun_position, get_sun_position
|
||||
func set_sun_position(new_position):
|
||||
sun_position = new_position
|
||||
if self.material:
|
||||
self.material.set_shader_param("sun_pos", sun_position)
|
||||
# _trigger_update_sky()
|
||||
func get_sun_position():
|
||||
return sun_position
|
||||
|
||||
func set_time_of_day(hours, directional_light, horizontal_angle = 0.0):
|
||||
var sun_position = Vector3(0.0, -100.0, 0.0)
|
||||
sun_position = sun_position.rotated(Vector3(1.0, 0.0, 0.0), hours * PI / 12.0)
|
||||
sun_position = sun_position.rotated(Vector3(0.0, 1.0, 0.0), horizontal_angle)
|
||||
|
||||
if directional_light:
|
||||
var t = directional_light.transform
|
||||
t.origin = sun_position
|
||||
directional_light.transform = t.looking_at(Vector3(0.0, 0.0, 0.0), Vector3(0.0, 1.0, 0.0))
|
||||
directional_light.light_energy = 1.0 - clamp(abs(hours - 12.0) / 6.0, 0.0, 1.0)
|
||||
|
||||
# and update our sky
|
||||
set_sun_position(sun_position)
|
||||
|
||||
|
||||
func set_day_time_hours(hours):
|
||||
if directional_light_node_path:
|
||||
set_time_of_day(hours, get_node(directional_light_node_path), 25.0)
|
|
@ -71,6 +71,11 @@ move_speed={
|
|||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777237,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
ui_settings_window={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":84,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
||||
[node]
|
||||
|
||||
|
|
396
shaders/sky.shader
Normal file
|
@ -0,0 +1,396 @@
|
|||
shader_type canvas_item;
|
||||
|
||||
// USING https://www.shadertoy.com/view/XtBXDw (base on it)
|
||||
|
||||
uniform float iTime;
|
||||
uniform int iFrame;
|
||||
uniform sampler2D iChannel0;
|
||||
uniform float COVERAGE :hint_range(0,1); //0.5
|
||||
uniform float THICKNESS :hint_range(0,100); //25.
|
||||
uniform float ABSORPTION :hint_range(0,10); //1.030725
|
||||
uniform int STEPS :hint_range(0,100); //25
|
||||
|
||||
|
||||
|
||||
////////////////////////////////
|
||||
uniform float earth_radius_km = 6371;
|
||||
uniform float atmo_radius_km = 6471;
|
||||
uniform float cam_height_m = 1.8;
|
||||
//uniform vec3 sun_pos = vec3(0.0, 0.1, -0.5);
|
||||
uniform vec3 sun_pos = vec3(1.0, 1.0, 1.0);
|
||||
uniform float sun_intensity = 22.0;
|
||||
uniform vec3 rayleigh_coeff = vec3(5.5, 13.0, 22.4); // we divide this by 100000
|
||||
uniform float mie_coeff = 21.0; // we divide this by 100000
|
||||
uniform float rayleigh_scale = 800;
|
||||
uniform float mie_scale = 120;
|
||||
uniform float mie_scatter_dir = 0.758;
|
||||
|
||||
uniform sampler2D night_sky : hint_black_albedo;
|
||||
uniform mat3 rotate_night_sky;
|
||||
|
||||
|
||||
|
||||
// Atmosphere code from: https://github.com/wwwtyro/glsl-atmosphere
|
||||
vec2 rsi(vec3 r0, vec3 rd, float sr) {
|
||||
// ray-sphere intersection that assumes
|
||||
// the sphere is centered at the origin.
|
||||
// No intersection when result.x > result.y
|
||||
float a = dot(rd, rd);
|
||||
float b = 2.0 * dot(rd, r0);
|
||||
float c = dot(r0, r0) - (sr * sr);
|
||||
float d = (b*b) - 4.0*a*c;
|
||||
if (d < 0.0) return vec2(100000.0,-100000.0);
|
||||
return vec2(
|
||||
(-b - sqrt(d))/(2.0*a),
|
||||
(-b + sqrt(d))/(2.0*a)
|
||||
);
|
||||
}
|
||||
|
||||
vec3 atmosphere(vec3 r, vec3 r0, vec3 pSun, float iSun, float rPlanet, float rAtmos, vec3 kRlh, float kMie, float shRlh, float shMie, float g) {
|
||||
float PI = 3.14159265358979;
|
||||
int iSteps = 16;
|
||||
int jSteps = 8;
|
||||
|
||||
// Normalize the sun and view directions.
|
||||
pSun = normalize(pSun);
|
||||
r = normalize(r);
|
||||
|
||||
// Calculate the step size of the primary ray.
|
||||
vec2 p = rsi(r0, r, rAtmos);
|
||||
if (p.x > p.y) return vec3(0,0,0);
|
||||
p.y = min(p.y, rsi(r0, r, rPlanet).x);
|
||||
float iStepSize = (p.y - p.x) / float(iSteps);
|
||||
|
||||
// Initialize the primary ray time.
|
||||
float iTimeBis = 0.0;
|
||||
|
||||
// Initialize accumulators for Rayleigh and Mie scattering.
|
||||
vec3 totalRlh = vec3(0,0,0);
|
||||
vec3 totalMie = vec3(0,0,0);
|
||||
|
||||
// Initialize optical depth accumulators for the primary ray.
|
||||
float iOdRlh = 0.0;
|
||||
float iOdMie = 0.0;
|
||||
|
||||
// Calculate the Rayleigh and Mie phases.
|
||||
float mu = dot(r, pSun);
|
||||
float mumu = mu * mu;
|
||||
float gg = g * g;
|
||||
float pRlh = 3.0 / (16.0 * PI) * (1.0 + mumu);
|
||||
float pMie = 3.0 / (8.0 * PI) * ((1.0 - gg) * (mumu + 1.0)) / (pow(1.0 + gg - 2.0 * mu * g, 1.5) * (2.0 + gg));
|
||||
|
||||
// Sample the primary ray.
|
||||
for (int i = 0; i < iSteps; i++) {
|
||||
// Calculate the primary ray sample position.
|
||||
vec3 iPos = r0 + r * (iTimeBis + iStepSize * 0.5);
|
||||
|
||||
// Calculate the height of the sample.
|
||||
float iHeight = length(iPos) - rPlanet;
|
||||
|
||||
// Calculate the optical depth of the Rayleigh and Mie scattering for this step.
|
||||
float odStepRlh = exp(-iHeight / shRlh) * iStepSize;
|
||||
float odStepMie = exp(-iHeight / shMie) * iStepSize;
|
||||
|
||||
// Accumulate optical depth.
|
||||
iOdRlh += odStepRlh;
|
||||
iOdMie += odStepMie;
|
||||
|
||||
// Calculate the step size of the secondary ray.
|
||||
float jStepSize = rsi(iPos, pSun, rAtmos).y / float(jSteps);
|
||||
|
||||
// Initialize the secondary ray time.
|
||||
float jTime = 0.0;
|
||||
|
||||
// Initialize optical depth accumulators for the secondary ray.
|
||||
float jOdRlh = 0.0;
|
||||
float jOdMie = 0.0;
|
||||
|
||||
// Sample the secondary ray.
|
||||
for (int j = 0; j < jSteps; j++) {
|
||||
// Calculate the secondary ray sample position.
|
||||
vec3 jPos = iPos + pSun * (jTime + jStepSize * 0.5);
|
||||
|
||||
// Calculate the height of the sample.
|
||||
float jHeight = length(jPos) - rPlanet;
|
||||
|
||||
// Accumulate the optical depth.
|
||||
jOdRlh += exp(-jHeight / shRlh) * jStepSize;
|
||||
jOdMie += exp(-jHeight / shMie) * jStepSize;
|
||||
|
||||
// Increment the secondary ray time.
|
||||
jTime += jStepSize;
|
||||
}
|
||||
|
||||
// Calculate attenuation.
|
||||
vec3 attn = exp(-(kMie * (iOdMie + jOdMie) + kRlh * (iOdRlh + jOdRlh)));
|
||||
|
||||
// Accumulate scattering.
|
||||
totalRlh += odStepRlh * attn;
|
||||
totalMie += odStepMie * attn;
|
||||
|
||||
// Increment the primary ray time.
|
||||
iTimeBis += iStepSize;
|
||||
|
||||
}
|
||||
|
||||
// Calculate and return the final color.
|
||||
return iSun * (pRlh * kRlh * totalRlh + pMie * kMie * totalMie);
|
||||
}
|
||||
|
||||
// and our application
|
||||
|
||||
vec3 ray_dir_from_uv(vec2 uv) {
|
||||
float PI = 3.14159265358979;
|
||||
vec3 dir;
|
||||
|
||||
float x = sin(PI * uv.y);
|
||||
dir.y = cos(PI * uv.y);
|
||||
|
||||
dir.x = x * sin(2.0 * PI * (0.5 - uv.x));
|
||||
dir.z = x * cos(2.0 * PI * (0.5 - uv.x));
|
||||
|
||||
return dir;
|
||||
}
|
||||
|
||||
vec2 uv_from_ray_dir(vec3 dir) {
|
||||
float PI = 3.14159265358979;
|
||||
vec2 uv;
|
||||
|
||||
uv.y = acos(dir.y) / PI;
|
||||
|
||||
dir.y = 0.0;
|
||||
dir = normalize(dir);
|
||||
uv.x = acos(dir.z) / (2.0 * PI);
|
||||
if (dir.x < 0.0) {
|
||||
uv.x = 1.0 - uv.x;
|
||||
}
|
||||
uv.x = 0.5 - uv.x;
|
||||
if (uv.x < 0.0) {
|
||||
uv.x += 1.0;
|
||||
}
|
||||
|
||||
return uv;
|
||||
}
|
||||
////////////////////////////////
|
||||
|
||||
|
||||
|
||||
float noise( in vec3 x )
|
||||
{
|
||||
x*=0.01;
|
||||
float z = x.z*256.0;
|
||||
vec2 offz = vec2(0.317,0.123);
|
||||
vec2 uv1 = x.xy + offz*floor(z);
|
||||
vec2 uv2 = uv1 + offz;
|
||||
return mix(textureLod( iChannel0, uv1 ,0.0).x,textureLod( iChannel0, uv2 ,0.0).x,fract(z));
|
||||
}
|
||||
|
||||
float fbm(vec3 pos,float lacunarity){
|
||||
vec3 p = pos;
|
||||
float
|
||||
t = 0.51749673 * noise(p); p *= lacunarity;
|
||||
t += 0.25584929 * noise(p); p *= lacunarity;
|
||||
t += 0.12527603 * noise(p); p *= lacunarity;
|
||||
t += 0.06255931 * noise(p);
|
||||
return t;
|
||||
}
|
||||
|
||||
float get_noise(vec3 x)
|
||||
{
|
||||
float FBM_FREQ=2.76434;
|
||||
return fbm(x, FBM_FREQ);
|
||||
}
|
||||
|
||||
vec3 render_sky_color(vec3 rd){
|
||||
vec3 sun_color = vec3(1., .7, .55);
|
||||
vec3 SUN_DIR = normalize(vec3(0, abs(sin( .3)), -1));
|
||||
float sun_amount = max(dot(rd, SUN_DIR), 0.0);
|
||||
|
||||
vec3 sky = mix(vec3(.0, .1, .4), vec3(.3, .6, .8), 1.0 - rd.y);
|
||||
sky = sky + sun_color * min(pow(sun_amount, 1500.0) * 5.0, 1.0);
|
||||
sky = sky + sun_color * min(pow(sun_amount, 10.0) * .6, 1.0);
|
||||
|
||||
return sky;
|
||||
}
|
||||
|
||||
bool SphereIntersect(vec3 SpPos, float SpRad, vec3 ro, vec3 rd, out float t, out vec3 norm) {
|
||||
ro -= SpPos;
|
||||
|
||||
float A = dot(rd, rd);
|
||||
float B = 2.0*dot(ro, rd);
|
||||
float C = dot(ro, ro)-SpRad*SpRad;
|
||||
float D = B*B-4.0*A*C;
|
||||
if (D < 0.0) return false;
|
||||
|
||||
D = sqrt(D);
|
||||
A *= 2.0;
|
||||
float t1 = (-B+D)/A;
|
||||
float t2 = (-B-D)/A;
|
||||
if (t1 < 0.0) t1 = t2;
|
||||
if (t2 < 0.0) t2 = t1;
|
||||
t1 = min(t1, t2);
|
||||
if (t1 < 0.0) return false;
|
||||
norm = ro+t1*rd;
|
||||
t = t1;
|
||||
//norm = normalize(norm);
|
||||
return true;
|
||||
}
|
||||
|
||||
float density(vec3 pos,vec3 offset,float t){
|
||||
vec3 p = pos * .0212242 + offset;
|
||||
float dens = get_noise(p);
|
||||
|
||||
float cov = 1. - COVERAGE;
|
||||
dens *= smoothstep (cov, cov + .05, dens);
|
||||
return clamp(dens, 0., 1.);
|
||||
}
|
||||
|
||||
|
||||
vec4 render_clouds(vec3 ro,vec3 rd){
|
||||
|
||||
vec3 apos=vec3(0, -450, 0);
|
||||
float arad=500.;
|
||||
vec3 WIND=vec3(0, 0, -iTime * .2);
|
||||
vec3 C = vec3(0, 0, 0);
|
||||
float alpha = 0.;
|
||||
vec3 n;
|
||||
float tt;
|
||||
if(SphereIntersect(apos,arad,ro,rd,tt,n)){
|
||||
float thickness = THICKNESS;
|
||||
int steps = STEPS;
|
||||
float march_step = thickness / float(steps);
|
||||
vec3 dir_step = rd / rd.y * march_step;
|
||||
vec3 pos =n;
|
||||
float T = 1.;
|
||||
|
||||
for (int i = 0; i < steps; i++) {
|
||||
float h = float(i) / float(steps);
|
||||
float dens = density (pos, WIND, h);
|
||||
float T_i = exp(-ABSORPTION * dens * march_step);
|
||||
T *= T_i;
|
||||
if (T < .01) break;
|
||||
C += T * (exp(h) / 1.75) *dens * march_step;
|
||||
alpha += (1. - T_i) * (1. - alpha);
|
||||
pos += dir_step;
|
||||
if (length(pos) > 1e3) break;
|
||||
}
|
||||
|
||||
return vec4(C, alpha);
|
||||
}
|
||||
return vec4(C, alpha);
|
||||
}
|
||||
|
||||
float fbm2(in vec3 p)
|
||||
{
|
||||
float f = 0.;
|
||||
f += .50000 * noise(.5 * (p+vec3(0.,0.,-iTime*0.275)));
|
||||
f += .25000 * noise(1. * (p+vec3(0.,0.,-iTime*0.275)));
|
||||
f += .12500 * noise(2. * (p+vec3(0.,0.,-iTime*0.275)));
|
||||
f += .06250 * noise(4. * (p+vec3(0.,0.,-iTime*0.275)));
|
||||
return f;
|
||||
}
|
||||
|
||||
vec3 cube_bot(vec3 d, vec3 c1, vec3 c2)
|
||||
{
|
||||
return fbm2(d) * mix(c1, c2, d * .5 + .5);
|
||||
}
|
||||
|
||||
vec3 rotate_y(vec3 v, float angle)
|
||||
{
|
||||
float ca = cos(angle); float sa = sin(angle);
|
||||
return v*mat3(
|
||||
vec3(+ca, +.0, -sa),
|
||||
vec3(+.0,+1.0, +.0),
|
||||
vec3(+sa, +.0, +ca));
|
||||
}
|
||||
|
||||
vec3 rotate_x(vec3 v, float angle)
|
||||
{
|
||||
float ca = cos(angle); float sa = sin(angle);
|
||||
return v*mat3(
|
||||
vec3(+1.0, +.0, +.0),
|
||||
vec3(+.0, +ca, -sa),
|
||||
vec3(+.0, +sa, +ca));
|
||||
}
|
||||
|
||||
void panorama_uv(vec2 fragCoord, out vec3 ro,out vec3 rd, in vec2 iResolution){
|
||||
float M_PI = 3.1415926535;
|
||||
float ymul = 2.0; float ydiff = -1.0;
|
||||
vec2 uv = fragCoord.xy / iResolution.xy;
|
||||
uv.x = 2.0 * uv.x - 1.0;
|
||||
uv.y = ymul * uv.y + ydiff;
|
||||
ro = vec3(0., 5., 0.);
|
||||
rd = normalize(rotate_y(rotate_x(vec3(0.0, 0.0, 1.0),-uv.y*M_PI/2.0),-uv.x*M_PI));
|
||||
}
|
||||
|
||||
void mainImage( out vec4 fragColor, in vec2 fragCoord, in vec2 iResolution)
|
||||
{
|
||||
vec3 ro = vec3 (0.,0.,0.);
|
||||
vec3 rd = vec3(0.);
|
||||
vec3 col=vec3(0.);
|
||||
|
||||
panorama_uv(fragCoord,ro,rd,iResolution);
|
||||
|
||||
// vec3 sky = render_sky_color(rd);
|
||||
vec3 sky = vec3( 0.0, 0.0, 0.0);
|
||||
vec4 cld = vec4(0.);
|
||||
float skyPow = dot(rd, vec3(0.0, -1.0, 0.0));
|
||||
float horizonPow =1.-pow(1.0-abs(skyPow), 5.0);
|
||||
if(rd.y>0.)
|
||||
{cld=render_clouds(ro,rd);
|
||||
cld=clamp(cld,vec4(0.),vec4(1.));
|
||||
cld.rgb+=0.04*cld.rgb*horizonPow;
|
||||
cld*=clamp(( 1.0 - exp(-2.3 * pow(max((0.0), horizonPow), (2.6)))),0.,1.);
|
||||
}
|
||||
else{
|
||||
cld.rgb = cube_bot(rd,vec3(1.5,1.49,1.71), vec3(1.1,1.15,1.5));
|
||||
cld*=cld;
|
||||
//cld=clamp(cld,vec4(0.),vec4(1.));
|
||||
cld.a=1.;
|
||||
cld*=clamp(( 1.0 - exp(-1.3 * pow(max((0.0), horizonPow), (2.6)))),0.,1.);
|
||||
}
|
||||
col=mix(sky, cld.rgb/(0.0001+cld.a), cld.a);
|
||||
//col*=col;
|
||||
fragColor = vec4(col,1.0);
|
||||
}
|
||||
|
||||
void fragment(){
|
||||
//////////////////////////////////
|
||||
vec3 dir = ray_dir_from_uv(UV);
|
||||
|
||||
// determine our sky color
|
||||
vec3 color = atmosphere(
|
||||
vec3( dir.x, -dir.y, dir.z )
|
||||
, vec3(0.0, earth_radius_km * 100.0 + cam_height_m * 0.1, 0.0)
|
||||
, sun_pos
|
||||
, sun_intensity
|
||||
, earth_radius_km * 100.0
|
||||
, atmo_radius_km * 100.0
|
||||
, rayleigh_coeff / 100000.0
|
||||
, mie_coeff / 100000.0
|
||||
, rayleigh_scale
|
||||
, mie_scale
|
||||
, mie_scatter_dir
|
||||
);
|
||||
|
||||
// Apply exposure.
|
||||
color = 1.0 - exp(-1.0 * color);
|
||||
|
||||
// Mix in night sky (already sRGB)
|
||||
if (dir.y > 0.0) {
|
||||
float f = (0.21 * color.r) + (0.72 * color.g) + (0.07 * color.b);
|
||||
float cutoff = 0.1;
|
||||
|
||||
vec2 ns_uv = uv_from_ray_dir(rotate_night_sky * dir);
|
||||
color += texture(night_sky, ns_uv).rgb * clamp((cutoff - f) / cutoff, 0.0, 1.0);
|
||||
}
|
||||
|
||||
COLOR = vec4(color, 1.0);
|
||||
////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
vec2 iResolution=1./TEXTURE_PIXEL_SIZE;
|
||||
mainImage(COLOR,UV*iResolution,iResolution);
|
||||
COLOR = vec4(color, 1.0)+COLOR;
|
||||
}
|
183
shaders/water.shader
Normal file
|
@ -0,0 +1,183 @@
|
|||
/*
|
||||
Realistic Water Shader for GODOT 3.1.1
|
||||
|
||||
Copyright (c) 2019 UnionBytes, Achim Menzel (alias AiYori)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
software and associated documentation files (the "Software"), to deal in the Software
|
||||
without restriction, including without limitation the rights to use, copy, modify,
|
||||
merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
|
||||
OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
-- UnionBytes <https://www.unionbytes.de/>
|
||||
-- YouTube: <https://www.youtube.com/user/UnionBytes>
|
||||
*/
|
||||
|
||||
|
||||
// For this shader min. GODOT 3.1.1 is required, because 3.1 has a depth buffer bug!
|
||||
shader_type spatial;
|
||||
render_mode cull_back,diffuse_burley,specular_schlick_ggx, blend_mix;
|
||||
|
||||
|
||||
// Wave settings:
|
||||
uniform float wave_speed = 0.5; // Speed scale for the waves
|
||||
uniform vec4 wave_a = vec4(1.0, 1.0, 0.35, 3.0); // xy = Direction, z = Steepness, w = Length
|
||||
uniform vec4 wave_b = vec4(1.0, 0.6, 0.30, 1.55); // xy = Direction, z = Steepness, w = Length
|
||||
uniform vec4 wave_c = vec4(1.0, 1.3, 0.25, 0.9); // xy = Direction, z = Steepness, w = Length
|
||||
|
||||
// Surface settings:
|
||||
uniform vec2 sampler_scale = vec2(0.25, 0.25); // Scale for the sampler
|
||||
uniform vec2 sampler_direction= vec2(0.05, 0.04); // Direction and speed for the sampler offset
|
||||
|
||||
uniform sampler2D uv_sampler : hint_aniso; // UV motion sampler for shifting the normalmap
|
||||
uniform vec2 uv_sampler_scale = vec2(0.25, 0.25); // UV sampler scale
|
||||
uniform float uv_sampler_strength = 0.04; // UV shifting strength
|
||||
|
||||
uniform sampler2D normalmap_a_sampler : hint_normal; // Normalmap sampler A
|
||||
uniform sampler2D normalmap_b_sampler : hint_normal; // Normalmap sampler B
|
||||
|
||||
uniform sampler2D foam_sampler : hint_black; // Foam sampler
|
||||
uniform float foam_level = 0.5; // Foam level -> distance from the object (0.0 - 0.5)
|
||||
|
||||
// Volume settings:
|
||||
uniform float refraction = 0.075; // Refraction of the water
|
||||
|
||||
uniform vec4 color_deep : hint_color; // Color for deep places in the water, medium to dark blue
|
||||
uniform vec4 color_shallow : hint_color; // Color for lower places in the water, bright blue - green
|
||||
uniform float beers_law = 2.0; // Beers law value, regulates the blending size to the deep water level
|
||||
uniform float depth_offset = -0.75; // Offset for the blending
|
||||
|
||||
// Projector for the water caustics:
|
||||
uniform mat4 projector; // Projector matrix, mostly the matric of the sun / directlight
|
||||
uniform sampler2DArray caustic_sampler : hint_black; // Caustic sampler, (Texture array with 16 Textures for the animation)
|
||||
|
||||
|
||||
// Vertex -> Fragment:
|
||||
varying float vertex_height; // Height of the water surface
|
||||
varying vec3 vertex_normal; // Vertex normal -> Needed for refraction calculation
|
||||
varying vec3 vertex_binormal; // Vertex binormal -> Needed for refraction calculation
|
||||
varying vec3 vertex_tangent; // Vertex tangent -> Needed for refraction calculation
|
||||
|
||||
varying mat4 inv_mvp; // Inverse ModelViewProjection matrix -> Needed for caustic projection
|
||||
|
||||
|
||||
// Wave function:
|
||||
vec4 wave(vec4 parameter, vec2 position, float time, inout vec3 tangent, inout vec3 binormal)
|
||||
{
|
||||
float wave_steepness = parameter.z;
|
||||
float wave_length = parameter.w;
|
||||
|
||||
float k = 2.0 * 3.14159265359 / wave_length;
|
||||
float c = sqrt(9.8 / k);
|
||||
vec2 d = normalize(parameter.xy);
|
||||
float f = k * (dot(d, position) - c * time);
|
||||
float a = wave_steepness / k;
|
||||
|
||||
tangent += normalize(vec3(1.0-d.x * d.x * (wave_steepness * sin(f)), d.x * (wave_steepness * cos(f)), -d.x * d.y * (wave_steepness * sin(f))));
|
||||
binormal += normalize(vec3(-d.x * d.y * (wave_steepness * sin(f)), d.y * (wave_steepness * cos(f)), 1.0-d.y * d.y * (wave_steepness * sin(f))));
|
||||
|
||||
return vec4(d.x * (a * cos(f)), a * sin(f) * 0.25, d.y * (a * cos(f)), 0.0);
|
||||
}
|
||||
|
||||
|
||||
// Vertex shader:
|
||||
void vertex()
|
||||
{
|
||||
float time = TIME * wave_speed;
|
||||
|
||||
vec4 vertex = vec4(VERTEX, 1.0);
|
||||
vec3 vertex_position = (WORLD_MATRIX * vertex).xyz;
|
||||
|
||||
vertex_tangent = vec3(0.0, 0.0, 0.0);
|
||||
vertex_binormal = vec3(0.0, 0.0, 0.0);
|
||||
|
||||
vertex += wave(wave_a, vertex_position.xz, time, vertex_tangent, vertex_binormal);
|
||||
vertex += wave(wave_b, vertex_position.xz, time, vertex_tangent, vertex_binormal);
|
||||
vertex += wave(wave_c, vertex_position.xz, time, vertex_tangent, vertex_binormal);
|
||||
|
||||
vertex_position = vertex.xyz;
|
||||
|
||||
vertex_height = (PROJECTION_MATRIX * MODELVIEW_MATRIX * vertex).z;
|
||||
|
||||
TANGENT = vertex_tangent;
|
||||
BINORMAL = vertex_binormal;
|
||||
vertex_normal = normalize(cross(vertex_binormal, vertex_tangent));
|
||||
NORMAL = vertex_normal;
|
||||
|
||||
UV = vertex.xz * sampler_scale;
|
||||
|
||||
VERTEX = vertex.xyz;
|
||||
|
||||
inv_mvp = inverse(PROJECTION_MATRIX * MODELVIEW_MATRIX);
|
||||
}
|
||||
|
||||
|
||||
// Fragment shader:
|
||||
void fragment()
|
||||
{
|
||||
// Calculation of the UV with the UV motion sampler
|
||||
vec2 uv_offset = sampler_direction * TIME;
|
||||
vec2 uv_sampler_uv = UV * uv_sampler_scale + uv_offset;
|
||||
vec2 uv_sampler_uv_offset = uv_sampler_strength * texture(uv_sampler, uv_sampler_uv).rg * 2.0 - 1.0;
|
||||
vec2 uv = UV + uv_sampler_uv_offset;
|
||||
|
||||
// Normalmap:
|
||||
vec3 normalmap = texture(normalmap_a_sampler, uv - uv_offset*2.0).rgb * 0.75; // 75 % sampler A
|
||||
normalmap += texture(normalmap_b_sampler, uv + uv_offset).rgb * 0.25; // 25 % sampler B
|
||||
|
||||
// Refraction UV:
|
||||
vec3 ref_normalmap = normalmap * 2.0 - 1.0;
|
||||
ref_normalmap = normalize(vertex_tangent*ref_normalmap.x + vertex_binormal*ref_normalmap.y + vertex_normal*ref_normalmap.z);
|
||||
vec2 ref_uv = SCREEN_UV + (ref_normalmap.xy * refraction) / vertex_height;
|
||||
|
||||
// Ground depth:
|
||||
float depth_raw = texture(DEPTH_TEXTURE, ref_uv).r * 2.0 - 1.0;
|
||||
float depth = PROJECTION_MATRIX[3][2] / (depth_raw + PROJECTION_MATRIX[2][2]);
|
||||
|
||||
float depth_blend = exp((depth+VERTEX.z + depth_offset) * -beers_law);
|
||||
depth_blend = clamp(1.0-depth_blend, 0.0, 1.0);
|
||||
float depth_blend_pow = clamp(pow(depth_blend, 2.5), 0.0, 1.0);
|
||||
|
||||
// Ground color:
|
||||
vec3 screen_color = textureLod(SCREEN_TEXTURE, ref_uv, depth_blend_pow * 2.5).rgb;
|
||||
|
||||
vec3 dye_color = mix(color_shallow.rgb, color_deep.rgb, depth_blend_pow);
|
||||
vec3 color = mix(screen_color*dye_color, dye_color*0.25, depth_blend_pow*0.5);
|
||||
|
||||
// Caustic screen projection
|
||||
vec4 caustic_screenPos = vec4(ref_uv*2.0-1.0, depth_raw, 1.0);
|
||||
vec4 caustic_localPos = inv_mvp * caustic_screenPos;
|
||||
caustic_localPos = vec4(caustic_localPos.xyz/caustic_localPos.w, caustic_localPos.w);
|
||||
|
||||
vec2 caustic_Uv = caustic_localPos.xz / vec2(1024.0) + 0.5;
|
||||
vec4 caustic_color = texture(caustic_sampler, vec3(caustic_Uv*300.0, mod(TIME*14.0, 16.0)));
|
||||
|
||||
color *= 1.0 + pow(caustic_color.r, 1.50) * (1.0-depth_blend) * 6.0;
|
||||
|
||||
// Foam:
|
||||
if(depth + VERTEX.z < foam_level && depth > vertex_height-0.1)
|
||||
{
|
||||
float foam_noise = clamp(pow(texture(foam_sampler, (uv*4.0) - uv_offset).r, 10.0)*40.0, 0.0, 0.2);
|
||||
float foam_mix = clamp(pow((1.0-(depth + VERTEX.z) + foam_noise), 8.0) * foam_noise * 0.4, 0.0, 1.0);
|
||||
color = mix(color, vec3(1.0), foam_mix);
|
||||
}
|
||||
|
||||
// Set all values:
|
||||
ALBEDO = color;
|
||||
METALLIC = 0.1;
|
||||
ROUGHNESS = 0.2;
|
||||
SPECULAR = 0.2 + depth_blend_pow * 0.4;
|
||||
NORMALMAP = normalmap;
|
||||
NORMALMAP_DEPTH = 1.25;
|
||||
}
|
BIN
textures/atlas/cliffs_grunges_mask.png
Normal file
After Width: | Height: | Size: 1.8 MiB |
BIN
textures/atlas/clouds_mask.png
Normal file
After Width: | Height: | Size: 1.5 MiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
BIN
textures/tilables/basic_texture_1024.png
Normal file
After Width: | Height: | Size: 29 KiB |
Before Width: | Height: | Size: 6 MiB After Width: | Height: | Size: 6 MiB |
Before Width: | Height: | Size: 1.7 MiB After Width: | Height: | Size: 1.7 MiB |
Before Width: | Height: | Size: 6.3 MiB After Width: | Height: | Size: 6.3 MiB |
Before Width: | Height: | Size: 1.7 MiB After Width: | Height: | Size: 1.7 MiB |
Before Width: | Height: | Size: 6 MiB After Width: | Height: | Size: 6 MiB |
Before Width: | Height: | Size: 1.8 MiB After Width: | Height: | Size: 1.8 MiB |
Before Width: | Height: | Size: 6.3 MiB After Width: | Height: | Size: 6.3 MiB |
Before Width: | Height: | Size: 1.7 MiB After Width: | Height: | Size: 1.7 MiB |
BIN
textures/tilables/dust/dust_baseColor.png
Normal file
After Width: | Height: | Size: 25 MiB |
BIN
textures/tilables/dust/dust_height.png
Normal file
After Width: | Height: | Size: 6.2 MiB |
BIN
textures/tilables/dust/dust_normal.png
Normal file
After Width: | Height: | Size: 18 MiB |
BIN
textures/tilables/dust/dust_roughness.png
Normal file
After Width: | Height: | Size: 6.3 MiB |
BIN
textures/tilables/moss/moss_AO.png
Normal file
After Width: | Height: | Size: 1.9 MiB |
BIN
textures/tilables/moss/moss_basecolor.png
Normal file
After Width: | Height: | Size: 5.1 MiB |
BIN
textures/tilables/moss/moss_height.png
Normal file
After Width: | Height: | Size: 1.8 MiB |
BIN
textures/tilables/moss/moss_normal.png
Normal file
After Width: | Height: | Size: 6.6 MiB |
BIN
textures/tilables/moss/moss_roughness.png
Normal file
After Width: | Height: | Size: 1.8 MiB |
Before Width: | Height: | Size: 1.4 MiB After Width: | Height: | Size: 1.4 MiB |
Before Width: | Height: | Size: 284 KiB After Width: | Height: | Size: 284 KiB |
Before Width: | Height: | Size: 1,005 KiB After Width: | Height: | Size: 1,005 KiB |
Before Width: | Height: | Size: 742 KiB After Width: | Height: | Size: 742 KiB |
Before Width: | Height: | Size: 1.4 MiB After Width: | Height: | Size: 1.4 MiB |
Before Width: | Height: | Size: 1 MiB After Width: | Height: | Size: 1 MiB |
Before Width: | Height: | Size: 4.3 MiB After Width: | Height: | Size: 4.3 MiB |
Before Width: | Height: | Size: 976 KiB After Width: | Height: | Size: 976 KiB |
Before Width: | Height: | Size: 1.3 MiB After Width: | Height: | Size: 1.3 MiB |
Before Width: | Height: | Size: 763 KiB After Width: | Height: | Size: 763 KiB |
Before Width: | Height: | Size: 3.2 MiB After Width: | Height: | Size: 3.2 MiB |
Before Width: | Height: | Size: 313 KiB After Width: | Height: | Size: 313 KiB |
Before Width: | Height: | Size: 6.2 MiB After Width: | Height: | Size: 6.2 MiB |
Before Width: | Height: | Size: 1.8 MiB After Width: | Height: | Size: 1.8 MiB |
Before Width: | Height: | Size: 6.5 MiB After Width: | Height: | Size: 6.5 MiB |
Before Width: | Height: | Size: 1.8 MiB After Width: | Height: | Size: 1.8 MiB |
BIN
textures/tilables/stone/stone_cliff_ambientOcclusion.png
Normal file
After Width: | Height: | Size: 1.6 MiB |
BIN
textures/tilables/stone/stone_cliff_basecolor.png
Normal file
After Width: | Height: | Size: 2.5 MiB |
BIN
textures/tilables/stone/stone_cliff_height.png
Normal file
After Width: | Height: | Size: 1.8 MiB |
BIN
textures/tilables/stone/stone_cliff_normal.png
Normal file
After Width: | Height: | Size: 6.7 MiB |
BIN
textures/tilables/stone/stone_cliff_roughness.png
Normal file
After Width: | Height: | Size: 472 KiB |
BIN
textures/tilables/water/Caustic.png
Normal file
After Width: | Height: | Size: 597 KiB |
BIN
textures/tilables/water/Foam.png
Normal file
After Width: | Height: | Size: 44 KiB |
BIN
textures/tilables/water/Water_N_A.png
Normal file
After Width: | Height: | Size: 424 KiB |
BIN
textures/tilables/water/Water_N_B.png
Normal file
After Width: | Height: | Size: 2.4 MiB |
BIN
textures/tilables/water/Water_UV.png
Normal file
After Width: | Height: | Size: 539 KiB |