feat: more player shader
This commit is contained in:
parent
dce784a237
commit
ba93e0d3f5
11 changed files with 77 additions and 45 deletions
|
|
@ -9,8 +9,10 @@
|
|||
transform = Transform3D(-1, 0, -8.742278e-08, 0, 1, 0, 8.742278e-08, 0, -1, 0, 0, 0)
|
||||
|
||||
[node name="BlankCharacterMesh" parent="HumanArmature/Skeleton3D" parent_id_path=PackedInt32Array(1295955268) index="0" unique_id=1294452068]
|
||||
transform = Transform3D(0.99992746, 0, 0, 0, 0.99992746, 0, 0, 0, 0.99992746, 0, 0, 0)
|
||||
layers = 3
|
||||
material_override = ExtResource("2_0o6ap")
|
||||
instance_shader_parameters/health = 0.6790000322525
|
||||
|
||||
[node name="Eyes" parent="HumanArmature/Skeleton3D" parent_id_path=PackedInt32Array(1295955268) index="4" unique_id=332871592]
|
||||
layers = 3
|
||||
|
|
|
|||
|
|
@ -1,35 +1,30 @@
|
|||
[gd_resource type="ShaderMaterial" format=3 uid="uid://dmfij86pa2ce4"]
|
||||
|
||||
[ext_resource type="Shader" uid="uid://briad1jwmkdw2" path="res://assets/character/shaders/player_skin.gdshader" id="1_6rrkd"]
|
||||
[ext_resource type="Texture2D" uid="uid://clm4tvbemlk7a" path="res://data/player_noise_mask.tres" id="2_mlgwu"]
|
||||
[ext_resource type="Texture2D" uid="uid://cufv10vyjbn0x" path="res://assets/character/player/player_skin.png" id="2_thik8"]
|
||||
[ext_resource type="Texture2D" uid="uid://34f1swwafqoa" path="res://assets/materials/kaleidoscope_mosaic_emission.png" id="3_i1ahx"]
|
||||
[ext_resource type="Texture2D" uid="uid://b0yi45ldkax5s" path="res://assets/materials/kaleidoscope_mosaic_heightmap.png" id="4_i1ahx"]
|
||||
[ext_resource type="Texture2D" uid="uid://dwskfat6ut10d" path="res://assets/materials/kaleidoscope_mosaic_normal.png" id="4_thik8"]
|
||||
|
||||
[sub_resource type="FastNoiseLite" id="FastNoiseLite_thik8"]
|
||||
noise_type = 0
|
||||
frequency = 0.007
|
||||
offset = Vector3(-151.31, 0, 0)
|
||||
fractal_octaves = 3
|
||||
fractal_lacunarity = 2.4
|
||||
fractal_gain = -0.432
|
||||
fractal_weighted_strength = 0.36
|
||||
|
||||
[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_i1ahx"]
|
||||
noise = SubResource("FastNoiseLite_thik8")
|
||||
invert = true
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_i1ahx"]
|
||||
cull_mode = 1
|
||||
shading_mode = 0
|
||||
albedo_color = Color(0, 0, 0, 1)
|
||||
grow = true
|
||||
grow_amount = 0.007
|
||||
|
||||
[resource]
|
||||
render_priority = 0
|
||||
next_pass = SubResource("StandardMaterial3D_i1ahx")
|
||||
shader = ExtResource("1_6rrkd")
|
||||
shader_parameter/alpha_texture = SubResource("NoiseTexture2D_i1ahx")
|
||||
shader_parameter/health = 0.3510000166725
|
||||
shader_parameter/mask_texture = ExtResource("2_mlgwu")
|
||||
shader_parameter/top_layer_albedo = ExtResource("2_thik8")
|
||||
shader_parameter/under_layer_albedo = ExtResource("3_i1ahx")
|
||||
shader_parameter/under_layer_normal = ExtResource("4_thik8")
|
||||
shader_parameter/under_layer_depth = ExtResource("4_i1ahx")
|
||||
shader_parameter/under_layer_scale = 11.561
|
||||
shader_parameter/under_layer_depth_scale = 0.349
|
||||
shader_parameter/max_depth_layers = 128.0
|
||||
shader_parameter/min_depth_layers = 32.0
|
||||
shader_parameter/under_layer_depth_scale = 0.081
|
||||
shader_parameter/max_depth_layers = 500.0
|
||||
shader_parameter/min_depth_layers = 100.0
|
||||
shader_parameter/under_emission_strength = 0.052
|
||||
|
|
|
|||
|
|
@ -1,37 +1,52 @@
|
|||
shader_type spatial;
|
||||
render_mode diffuse_toon, specular_disabled;
|
||||
|
||||
uniform sampler2D alpha_texture : hint_default_white, filter_linear;
|
||||
uniform float health : hint_range(0.0, 1.0) = 1.0;
|
||||
uniform sampler2D mask_texture : hint_default_white, filter_linear; // mask to add irregularity to revealed crystals
|
||||
instance uniform float health : hint_range(0.0, 1.0) = .4; // amount of hidden under layer (0=fully revealed, 1=fully hidden)
|
||||
|
||||
group_uniforms TopLayer;
|
||||
uniform sampler2D top_layer_albedo : source_color, hint_default_black, filter_linear_mipmap_anisotropic;
|
||||
uniform sampler2D top_layer_albedo : source_color, hint_default_black, filter_linear_mipmap_anisotropic; // top layer only has albedo colour, all others maps are constant/unchanged
|
||||
|
||||
group_uniforms UnderLayer;
|
||||
// basic maps albedo + normal
|
||||
uniform sampler2D under_layer_albedo : source_color, hint_default_white, filter_linear_mipmap_anisotropic;
|
||||
uniform sampler2D under_layer_normal : hint_normal;
|
||||
// depth map
|
||||
uniform sampler2D under_layer_depth : hint_default_white, filter_linear_mipmap_anisotropic;
|
||||
// uv scale for under layer
|
||||
uniform float under_layer_scale = 1.0;
|
||||
// depth factor
|
||||
uniform float under_layer_depth_scale = 1.0;
|
||||
// depth layer counts
|
||||
uniform float max_depth_layers = 128.0;
|
||||
uniform float min_depth_layers = 8.0;
|
||||
// under layer emission multiplier
|
||||
uniform float under_emission_strength = 0.5;
|
||||
|
||||
// convert model space to tangent space
|
||||
varying mat3 tangent_matrix;
|
||||
|
||||
// converts texture UV to parallax depth UV
|
||||
vec2 uv_to_parallax(vec2 uv, vec3 view_direction, sampler2D depth_map, float depth_factor) {
|
||||
vec2 penetration = view_direction.xy * -depth_factor;
|
||||
// total amount of UV shift from 0.0 to 1.0 depth
|
||||
vec2 uv_total_shift = view_direction.xy * -depth_factor;
|
||||
// number of layers to check for this fragment, based on view depth
|
||||
float layer_count = mix(min_depth_layers, max_depth_layers, max(dot(vec3(0.0, 0.0, 1.0), view_direction), 0.0));
|
||||
// amount of space between layers as a percentage of total depth
|
||||
float layer_separation = 1.0 / layer_count;
|
||||
vec2 uv_layer_shift = penetration / layer_count;
|
||||
// amount each layer is shifted due to the angle
|
||||
vec2 uv_layer_shift = uv_total_shift / layer_count;
|
||||
// starting at the top, find the first layer that intersects the view angle
|
||||
vec2 uv_iterator = uv;
|
||||
float layer_depth_iterator = 0.0;
|
||||
float depth_iterator = 1.0 - (texture(depth_map, uv).r);
|
||||
// ... by iterating until the depth of this layer peeks _above_ the view depth
|
||||
while(layer_depth_iterator < depth_iterator) {
|
||||
uv_iterator -= uv_layer_shift;
|
||||
uv_iterator -= uv_layer_shift; // adjusting the UV according to view angle each time
|
||||
depth_iterator = 1.0 - (texture(depth_map, uv_iterator).r);
|
||||
layer_depth_iterator += layer_separation;
|
||||
}
|
||||
//
|
||||
vec2 steep_parallax_uv = uv_iterator;
|
||||
float steep_parallax_depth = depth_iterator - layer_depth_iterator;
|
||||
float depth_distance = texture(depth_map, steep_parallax_uv).r - layer_depth_iterator + layer_separation;
|
||||
|
|
@ -48,7 +63,7 @@ void fragment() {
|
|||
vec2 under_uv_parallax = uv_to_parallax(under_uv, normalize(normalize(-VERTEX) * tangent_matrix), under_layer_depth, under_layer_depth_scale);
|
||||
vec4 top_layer_sample = texture(top_layer_albedo, UV);
|
||||
vec4 under_layer_sample = texture(under_layer_albedo, under_uv_parallax);
|
||||
float alpha = clamp(step(0.0, health - texture(alpha_texture, UV).r * texture(under_layer_depth, under_uv_parallax).r) * top_layer_sample.a, 0.0, 1.0);
|
||||
float alpha = clamp(step(0.0, health - texture(mask_texture, UV).r * texture(under_layer_depth, under_uv_parallax).r) * top_layer_sample.a, 0.0, 1.0);
|
||||
if (alpha < 1.0 && (under_uv_parallax.x / under_layer_scale > 1.0 || under_uv_parallax.x / under_layer_scale < 0.0 || under_uv_parallax.y / under_layer_scale > 1.0 || under_uv_parallax.y / under_layer_scale < 0.0)) {
|
||||
discard;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,22 +1,27 @@
|
|||
[gd_resource type="StandardMaterial3D" format=3 uid="uid://dui8cejorbv0l"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://ddaso2y8ooove" path="res://assets/materials/kaleidoscope_mosaic_albedo.png" id="1"]
|
||||
[ext_resource type="Texture2D" uid="uid://dwskfat6ut10d" path="res://assets/materials/kaleidoscope_mosaic_normal.png" id="3"]
|
||||
[ext_resource type="Texture2D" uid="uid://b0yi45ldkax5s" path="res://assets/materials/kaleidoscope_mosaic_heightmap.png" id="4"]
|
||||
[ext_resource type="Texture2D" uid="uid://34f1swwafqoa" path="res://assets/materials/kaleidoscope_mosaic_emission.png" id="5"]
|
||||
|
||||
[gd_resource type="StandardMaterial3D" load_steps=5 format=2]
|
||||
[ext_resource path="kaleidoscope_mosaic_albedo.png" type="Texture" id=1]
|
||||
[ext_resource path="kaleidoscope_mosaic_normal.png" type="Texture" id=3]
|
||||
[ext_resource path="kaleidoscope_mosaic_heightmap.png" type="Texture" id=4]
|
||||
[ext_resource path="kaleidoscope_mosaic_emission.png" type="Texture" id=5]
|
||||
[resource]
|
||||
albedo_texture = ExtResource("1")
|
||||
albedo_color = Color(1.0, 1.0, 1.0, 1.0)
|
||||
albedo_texture = ExtResource( 1 )
|
||||
metallic = 1.0
|
||||
roughness = 0.19
|
||||
emission_enabled = true
|
||||
emission_energy_multiplier = 0.03
|
||||
emission_texture = ExtResource("5")
|
||||
normal_enabled = true
|
||||
normal_texture = ExtResource("3")
|
||||
normal_scale = 1.0
|
||||
normal_texture = ExtResource( 3 )
|
||||
emission_enabled = true
|
||||
emission = Color( 0, 0, 0, 1 )
|
||||
emission_energy = 0.03
|
||||
emission_operator = 0
|
||||
emission_texture = ExtResource( 5 )
|
||||
heightmap_enabled = true
|
||||
heightmap_scale = 25.0
|
||||
heightmap_scale = 7.0
|
||||
heightmap_deep_parallax = true
|
||||
heightmap_min_layers = 8
|
||||
heightmap_max_layers = 32
|
||||
heightmap_texture = ExtResource("4")
|
||||
heightmap_texture = ExtResource( 4 )
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ compress/lossy_quality=0.7
|
|||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=1
|
||||
compress/normal_map=2
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=true
|
||||
mipmaps/limit=-1
|
||||
|
|
|
|||
BIN
project/assets/materials/kaleidoscope_mosaic_heightmap.png
(Stored with Git LFS)
BIN
project/assets/materials/kaleidoscope_mosaic_heightmap.png
(Stored with Git LFS)
Binary file not shown.
BIN
project/assets/materials/kaleidoscope_mosaic_normal.png
(Stored with Git LFS)
BIN
project/assets/materials/kaleidoscope_mosaic_normal.png
(Stored with Git LFS)
Binary file not shown.
|
|
@ -22,7 +22,7 @@ compress/lossy_quality=0.7
|
|||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=1
|
||||
compress/normal_map=2
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=true
|
||||
mipmaps/limit=-1
|
||||
|
|
|
|||
14
project/data/player_noise_mask.tres
Normal file
14
project/data/player_noise_mask.tres
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
[gd_resource type="NoiseTexture2D" format=3 uid="uid://clm4tvbemlk7a"]
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_7f35t"]
|
||||
offsets = PackedFloat32Array(0.7650961, 0.88510245)
|
||||
colors = PackedColorArray(1, 1, 1, 1, 0, 0, 0, 1)
|
||||
|
||||
[sub_resource type="FastNoiseLite" id="FastNoiseLite_i1ahx"]
|
||||
frequency = 0.0559
|
||||
|
||||
[resource]
|
||||
width = 128
|
||||
height = 128
|
||||
noise = SubResource("FastNoiseLite_i1ahx")
|
||||
color_ramp = SubResource("Gradient_7f35t")
|
||||
|
|
@ -1916,7 +1916,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 3, 0)
|
|||
transform = Transform3D(-4.371139e-08, 0, -1, 0, 1, 0, 1, 0, -4.371139e-08, 0.07438529, 0.0057001114, -3.970789)
|
||||
|
||||
[node name="AppartmentFascade3" parent="TowerC/AppartmentBuildingStory12" unique_id=707801204 instance=ExtResource("4_eefle")]
|
||||
transform = Transform3D(-4.371139e-08, 0, -1, 0, 1, 0, 1, 0, -4.371139e-08, 0.074384816, 0.0057001114, 4.0292115)
|
||||
transform = Transform3D(-4.371139e-08, 0, -1, 0, 1, 0, 1, 0, -4.371139e-08, 0.07438469, 0.0057001114, 4.029211)
|
||||
|
||||
[node name="stairs" parent="TowerC" unique_id=1879869667 instance=ExtResource("12_nrvdc")]
|
||||
transform = Transform3D(-1, 0, -8.742278e-08, 0, 1, 0, 8.742278e-08, 0, -1, 1, 3, 11)
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ animation = &"wallrun_right"
|
|||
[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_eqqp1"]
|
||||
|
||||
[sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_uxov2"]
|
||||
graph_offset = Vector2(-363.57355, -446.2923)
|
||||
nodes/output/position = Vector2(1140, 140)
|
||||
nodes/ClimbUpClip/node = SubResource("AnimationNodeAnimation_vqq2l")
|
||||
nodes/ClimbUpClip/position = Vector2(480, 480)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue