Ajout de parametres pour personnaliser la mousse de la falaise.
This commit is contained in:
parent
2872a04d10
commit
b1db5c87cb
5 changed files with 98 additions and 19 deletions
BIN
materials/decors/rocks/rock_moss.material
(Stored with Git LFS)
BIN
materials/decors/rocks/rock_moss.material
(Stored with Git LFS)
Binary file not shown.
73
meshes/decors/rocks/cliff.gd
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
|
|
@ -1,35 +1,38 @@
|
||||||
[gd_scene load_steps=2 format=2]
|
[gd_scene load_steps=3 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://meshes/decors/rocks/rock_001.tscn" type="PackedScene" id=1]
|
[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"]
|
[node name="cliff" type="Spatial"]
|
||||||
|
script = ExtResource( 1 )
|
||||||
|
moss_depth_max = 0.73
|
||||||
|
|
||||||
[node name="rock_001" parent="." instance=ExtResource( 1 )]
|
[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 )
|
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( 1 )]
|
[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 )
|
transform = Transform( -0.996195, 3.80969e-009, 0.0871556, 0.0871556, 4.35451e-008, 0.996195, 0, 1, -4.37114e-008, 0, 27, 0 )
|
||||||
|
|
||||||
[node name="rock_002" parent="." instance=ExtResource( 1 )]
|
[node name="rock_002" parent="." instance=ExtResource( 2 )]
|
||||||
transform = Transform( 0.98106, -0.173648, 0.0858316, 0.0871557, -4.35451e-008, -0.996195, 0.172987, 0.984808, 0.0151344, 23, 10, 3 )
|
transform = Transform( 0.98106, -0.173648, 0.0858316, 0.0871557, -4.35451e-008, -0.996195, 0.172987, 0.984808, 0.0151344, 23, 10, 3 )
|
||||||
|
|
||||||
[node name="rock_007" parent="." instance=ExtResource( 1 )]
|
[node name="rock_007" parent="." instance=ExtResource( 2 )]
|
||||||
transform = Transform( 0.98106, -0.173648, 0.0858316, 0.0871557, -4.35451e-008, -0.996195, 0.172987, 0.984808, 0.0151344, 23, 27, 3 )
|
transform = Transform( 0.98106, -0.173648, 0.0858316, 0.0871557, -4.35451e-008, -0.996195, 0.172987, 0.984808, 0.0151344, 23, 27, 3 )
|
||||||
|
|
||||||
[node name="rock_003" parent="." instance=ExtResource( 1 )]
|
[node name="rock_003" parent="." instance=ExtResource( 2 )]
|
||||||
transform = Transform( 0.96225, -0.258819, -0.084186, -0.0871558, -4.35451e-008, -0.996195, 0.257834, 0.965926, -0.0225576, 44, 10, 8 )
|
transform = Transform( 0.96225, -0.258819, -0.084186, -0.0871558, -4.35451e-008, -0.996195, 0.257834, 0.965926, -0.0225576, 44, 10, 8 )
|
||||||
|
|
||||||
[node name="rock_009" parent="." instance=ExtResource( 1 )]
|
[node name="rock_009" parent="." instance=ExtResource( 2 )]
|
||||||
transform = Transform( 0.96225, -0.258819, -0.084186, -0.0871558, -4.35451e-008, -0.996195, 0.257834, 0.965926, -0.0225576, 44, 27, 8 )
|
transform = Transform( 0.96225, -0.258819, -0.084186, -0.0871558, -4.35451e-008, -0.996195, 0.257834, 0.965926, -0.0225576, 44, 27, 8 )
|
||||||
|
|
||||||
[node name="rock_004" parent="." instance=ExtResource( 1 )]
|
[node name="rock_004" parent="." instance=ExtResource( 2 )]
|
||||||
transform = Transform( 0.996195, 0.0871557, -3.8097e-009, 0, -4.37114e-008, -1, -0.0871557, 0.996195, -4.35451e-008, -21, 10, 1 )
|
transform = Transform( 0.996195, 0.0871557, -3.8097e-009, 0, -4.37114e-008, -1, -0.0871557, 0.996195, -4.35451e-008, -21, 10, 1 )
|
||||||
|
|
||||||
[node name="rock_010" parent="." instance=ExtResource( 1 )]
|
[node name="rock_010" parent="." instance=ExtResource( 2 )]
|
||||||
transform = Transform( 0.996195, 0.0871557, -3.8097e-009, 0, -4.37114e-008, -1, -0.0871557, 0.996195, -4.35451e-008, -21, 27, 1 )
|
transform = Transform( 0.996195, 0.0871557, -3.8097e-009, 0, -4.37114e-008, -1, -0.0871557, 0.996195, -4.35451e-008, -21, 27, 1 )
|
||||||
|
|
||||||
[node name="rock_005" parent="." instance=ExtResource( 1 )]
|
[node name="rock_005" parent="." instance=ExtResource( 2 )]
|
||||||
transform = Transform( -0.886457, 0.431875, -0.166366, -0.23457, -0.109382, 0.965926, 0.398961, 0.895276, 0.198267, -42, 10, 7 )
|
transform = Transform( -0.886457, 0.431875, -0.166366, -0.23457, -0.109382, 0.965926, 0.398961, 0.895276, 0.198267, -42, 10, 7 )
|
||||||
|
|
||||||
[node name="rock_008" parent="." instance=ExtResource( 1 )]
|
[node name="rock_008" parent="." instance=ExtResource( 2 )]
|
||||||
transform = Transform( -0.886457, 0.431875, -0.166366, -0.23457, -0.109382, 0.965926, 0.398961, 0.895276, 0.198267, -42, 27, 7 )
|
transform = Transform( -0.886457, 0.431875, -0.166366, -0.23457, -0.109382, 0.965926, 0.398961, 0.895276, 0.198267, -42, 27, 7 )
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
[ext_resource path="res://meshes/decors/rocks/rock_001.glb" type="PackedScene" id=1]
|
[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]
|
[ext_resource path="res://materials/decors/rocks/rock_moss.material" type="Material" id=2]
|
||||||
|
|
||||||
[node name="rock_001" index="0" instance=ExtResource( 1 )]
|
[node name="rock_001" instance=ExtResource( 1 )]
|
||||||
|
|
||||||
[node name="Cliff_test_01" parent="." index="0"]
|
[node name="Cliff_test_01" parent="." index="0"]
|
||||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )
|
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )
|
||||||
|
|
|
@ -26,10 +26,10 @@ uv1_offset = Vector3( 0.2, 0.2, 0 )
|
||||||
material = SubResource( 3 )
|
material = SubResource( 3 )
|
||||||
|
|
||||||
[sub_resource type="GIProbeData" id=5]
|
[sub_resource type="GIProbeData" id=5]
|
||||||
bounds = AABB( -63.192, -10, -76.3229, 126.384, 20, 152.646 )
|
bounds = AABB( -63.192, -25, -76.323, 126.384, 50, 152.646 )
|
||||||
cell_size = 1.19255
|
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 )
|
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, 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 )
|
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
|
dynamic_range = 4
|
||||||
bias = 1.5
|
bias = 1.5
|
||||||
normal_bias = 0.0
|
normal_bias = 0.0
|
||||||
|
@ -51,6 +51,8 @@ mesh = SubResource( 4 )
|
||||||
|
|
||||||
[node name="cliff" parent="terrain" instance=ExtResource( 4 )]
|
[node name="cliff" parent="terrain" instance=ExtResource( 4 )]
|
||||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -48.2121 )
|
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -48.2121 )
|
||||||
|
moss_height = 15.0
|
||||||
|
moss_fade = 2.5
|
||||||
|
|
||||||
[node name="props" type="Spatial" parent="."]
|
[node name="props" type="Spatial" parent="."]
|
||||||
|
|
||||||
|
@ -90,5 +92,6 @@ light_energy = 2.21
|
||||||
shadow_enabled = true
|
shadow_enabled = true
|
||||||
|
|
||||||
[node name="gi_probe" type="GIProbe" parent="light_system"]
|
[node name="gi_probe" type="GIProbe" parent="light_system"]
|
||||||
extents = Vector3( 63.192, 10, 76.3229 )
|
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 21.7307, 0 )
|
||||||
|
extents = Vector3( 63.192, 25, 76.323 )
|
||||||
data = SubResource( 5 )
|
data = SubResource( 5 )
|
||||||
|
|
Loading…
Reference in a new issue