Now the characters and terrarin use the same material, and shader.

This commit is contained in:
Relintai 2019-12-03 15:22:45 +01:00
parent dc0d5eeb66
commit ca8bdf9ce2
11 changed files with 103 additions and 94 deletions

View File

@ -0,0 +1,7 @@
[gd_resource type="ShaderMaterial" load_steps=2 format=2]
[ext_resource path="res://data/shaders/1_standard_shader.tres" type="Shader" id=1]
[resource]
shader = ExtResource( 1 )
shader_param/albedo = Color( 1, 1, 1, 1 )

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,7 @@
[gd_scene load_steps=37 format=2] [gd_scene load_steps=37 format=2]
[ext_resource path="res://data/models/Material_003.material" type="Material" id=1] [ext_resource path="res://data/models/Material_003.material" type="Material" id=1]
[ext_resource path="res://data/materials/Character.material" type="Material" id=2] [ext_resource path="res://data/materials/1_standard_material.tres" type="Material" id=2]
[ext_resource path="res://player/CharacterSkeletonGD.gd" type="Script" id=3] [ext_resource path="res://player/CharacterSkeletonGD.gd" type="Script" id=3]
[ext_resource path="res://player/CharacterSkeletonAttachPoint.gd" type="Script" id=4] [ext_resource path="res://player/CharacterSkeletonAttachPoint.gd" type="Script" id=4]
[ext_resource path="res://data/models/armature.tscn" type="PackedScene" id=5] [ext_resource path="res://data/models/armature.tscn" type="PackedScene" id=5]
@ -110,7 +110,7 @@ animation = "run-loop"
[sub_resource type="AnimationNodeAnimation" id=11] [sub_resource type="AnimationNodeAnimation" id=11]
animation = "run-right-loop" animation = "run-right-loop"
[sub_resource type="AnimationNodeBlendSpace2D" id=16] [sub_resource type="AnimationNodeBlendSpace2D" id=12]
blend_point_0/node = SubResource( 8 ) blend_point_0/node = SubResource( 8 )
blend_point_0/pos = Vector2( -1, 0 ) blend_point_0/pos = Vector2( -1, 0 )
blend_point_1/node = SubResource( 9 ) blend_point_1/node = SubResource( 9 )
@ -121,56 +121,56 @@ blend_point_3/node = SubResource( 11 )
blend_point_3/pos = Vector2( 1, 0 ) blend_point_3/pos = Vector2( 1, 0 )
blend_mode = 1 blend_mode = 1
[sub_resource type="AnimationNodeStateMachineTransition" id=17] [sub_resource type="AnimationNodeStateMachineTransition" id=13]
xfade_time = 0.09 xfade_time = 0.09
[sub_resource type="AnimationNodeStateMachineTransition" id=14]
xfade_time = 0.09
[sub_resource type="AnimationNodeStateMachineTransition" id=15]
xfade_time = 0.05
[sub_resource type="AnimationNodeStateMachineTransition" id=16]
auto_advance = true
xfade_time = 0.15
[sub_resource type="AnimationNodeStateMachineTransition" id=17]
auto_advance = true
xfade_time = 0.14
[sub_resource type="AnimationNodeStateMachineTransition" id=18] [sub_resource type="AnimationNodeStateMachineTransition" id=18]
xfade_time = 0.09 xfade_time = 0.09
[sub_resource type="AnimationNodeStateMachineTransition" id=19] [sub_resource type="AnimationNodeStateMachineTransition" id=19]
xfade_time = 0.05 xfade_time = 0.1
[sub_resource type="AnimationNodeStateMachineTransition" id=20] [sub_resource type="AnimationNodeStateMachineTransition" id=20]
auto_advance = true xfade_time = 0.1
xfade_time = 0.15
[sub_resource type="AnimationNodeStateMachineTransition" id=21] [sub_resource type="AnimationNodeStateMachineTransition" id=21]
auto_advance = true xfade_time = 0.09
xfade_time = 0.14
[sub_resource type="AnimationNodeStateMachineTransition" id=22] [sub_resource type="AnimationNodeStateMachineTransition" id=22]
xfade_time = 0.09 xfade_time = 0.09
[sub_resource type="AnimationNodeStateMachineTransition" id=23] [sub_resource type="AnimationNodeStateMachineTransition" id=23]
xfade_time = 0.1
[sub_resource type="AnimationNodeStateMachineTransition" id=24] [sub_resource type="AnimationNodeStateMachineTransition" id=24]
xfade_time = 0.1 xfade_time = 0.12
[sub_resource type="AnimationNodeStateMachineTransition" id=25] [sub_resource type="AnimationNodeStateMachineTransition" id=25]
xfade_time = 0.09 xfade_time = 0.12
[sub_resource type="AnimationNodeStateMachineTransition" id=26] [sub_resource type="AnimationNodeStateMachineTransition" id=26]
xfade_time = 0.09 xfade_time = 0.12
[sub_resource type="AnimationNodeStateMachineTransition" id=27] [sub_resource type="AnimationNodeStateMachineTransition" id=27]
xfade_time = 0.12
[sub_resource type="AnimationNodeStateMachineTransition" id=28] [sub_resource type="AnimationNodeStateMachineTransition" id=28]
xfade_time = 0.12 xfade_time = 0.12
[sub_resource type="AnimationNodeStateMachineTransition" id=29] [sub_resource type="AnimationNodeStateMachine" id=29]
xfade_time = 0.12
[sub_resource type="AnimationNodeStateMachineTransition" id=30]
xfade_time = 0.12
[sub_resource type="AnimationNodeStateMachineTransition" id=31]
xfade_time = 0.12
[sub_resource type="AnimationNodeStateMachineTransition" id=32]
xfade_time = 0.12
[sub_resource type="AnimationNodeStateMachine" id=33]
states/cast-end/node = SubResource( 4 ) states/cast-end/node = SubResource( 4 )
states/cast-end/position = Vector2( 117.871, -197.811 ) states/cast-end/position = Vector2( 117.871, -197.811 )
"states/cast-end 2/node" = SubResource( 3 ) "states/cast-end 2/node" = SubResource( 3 )
@ -181,13 +181,13 @@ states/dead/node = SubResource( 6 )
states/dead/position = Vector2( -129.129, 73.189 ) states/dead/position = Vector2( -129.129, 73.189 )
states/idle-loop/node = SubResource( 7 ) states/idle-loop/node = SubResource( 7 )
states/idle-loop/position = Vector2( -255.566, -317.817 ) states/idle-loop/position = Vector2( -255.566, -317.817 )
states/run-loop/node = SubResource( 16 ) states/run-loop/node = SubResource( 12 )
states/run-loop/position = Vector2( 31.871, -340.817 ) states/run-loop/position = Vector2( 31.871, -340.817 )
transitions = [ "idle-loop", "casting-loop", SubResource( 17 ), "casting-loop", "idle-loop", SubResource( 18 ), "casting-loop", "cast-end", SubResource( 19 ), "cast-end", "cast-end 2", SubResource( 20 ), "cast-end 2", "idle-loop", SubResource( 21 ), "idle-loop", "cast-end", SubResource( 22 ), "idle-loop", "run-loop", SubResource( 23 ), "run-loop", "idle-loop", SubResource( 24 ), "casting-loop", "run-loop", SubResource( 25 ), "run-loop", "casting-loop", SubResource( 26 ), "run-loop", "cast-end", SubResource( 27 ), "idle-loop", "dead", SubResource( 28 ), "casting-loop", "dead", SubResource( 29 ), "cast-end 2", "dead", SubResource( 30 ), "run-loop", "dead", SubResource( 31 ), "dead", "idle-loop", SubResource( 32 ) ] transitions = [ "idle-loop", "casting-loop", SubResource( 13 ), "casting-loop", "idle-loop", SubResource( 14 ), "casting-loop", "cast-end", SubResource( 15 ), "cast-end", "cast-end 2", SubResource( 16 ), "cast-end 2", "idle-loop", SubResource( 17 ), "idle-loop", "cast-end", SubResource( 18 ), "idle-loop", "run-loop", SubResource( 19 ), "run-loop", "idle-loop", SubResource( 20 ), "casting-loop", "run-loop", SubResource( 21 ), "run-loop", "casting-loop", SubResource( 22 ), "run-loop", "cast-end", SubResource( 23 ), "idle-loop", "dead", SubResource( 24 ), "casting-loop", "dead", SubResource( 25 ), "cast-end 2", "dead", SubResource( 26 ), "run-loop", "dead", SubResource( 27 ), "dead", "idle-loop", SubResource( 28 ) ]
start_node = "idle-loop" start_node = "idle-loop"
graph_offset = Vector2( -509.129, -407.811 ) graph_offset = Vector2( -509.129, -407.811 )
[sub_resource type="AnimationNodeStateMachinePlayback" id=34] [sub_resource type="AnimationNodeStateMachinePlayback" id=30]
[node name="character" type="CharacterSkeleton3D"] [node name="character" type="CharacterSkeleton3D"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -0.00126277, 0, -0.000325084 ) transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -0.00126277, 0, -0.000325084 )
@ -241,7 +241,7 @@ mesh = SubResource( 2 )
material/0 = null material/0 = null
[node name="LeftHandAttachment" type="BoneAttachment" parent="armature/Armature/Skeleton" index="2"] [node name="LeftHandAttachment" type="BoneAttachment" parent="armature/Armature/Skeleton" index="2"]
transform = Transform( 0.103426, -0.988451, -0.110561, 0.0564442, -0.105111, 0.992813, -0.99303, -0.108925, 0.0449195, 0.242846, 0.761501, -0.0114767 ) transform = Transform( 0.103369, -0.988358, -0.111374, 0.0564146, -0.10592, 0.992699, -0.993035, -0.108901, 0.0448067, 0.244227, 0.759943, -0.0106616 )
bone_name = "left_hand" bone_name = "left_hand"
[node name="LeftHandAP" type="Spatial" parent="armature/Armature/Skeleton/LeftHandAttachment"] [node name="LeftHandAP" type="Spatial" parent="armature/Armature/Skeleton/LeftHandAttachment"]
@ -249,7 +249,7 @@ transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.04, -0.09 )
script = ExtResource( 4 ) script = ExtResource( 4 )
[node name="RightHandAttachment" type="BoneAttachment" parent="armature/Armature/Skeleton" index="3"] [node name="RightHandAttachment" type="BoneAttachment" parent="armature/Armature/Skeleton" index="3"]
transform = Transform( -0.0427069, -0.998132, 0.0431305, -0.127995, 0.0482658, 0.990538, -0.990869, 0.0367939, -0.129825, -0.248857, 0.765104, -0.00449833 ) transform = Transform( -0.0426668, -0.998146, 0.042682, -0.127478, 0.0477918, 0.990591, -0.990942, 0.0368403, -0.129294, -0.249511, 0.765826, -0.00542467 )
bone_name = "right_hand" bone_name = "right_hand"
[node name="RightHandAP" type="Spatial" parent="armature/Armature/Skeleton/RightHandAttachment"] [node name="RightHandAP" type="Spatial" parent="armature/Armature/Skeleton/RightHandAttachment"]
@ -265,7 +265,7 @@ transform = Transform( 1, 0, 0, 0, -1.62921e-07, 1, 0, -1, -1.62921e-07, 0, 0, 0
script = ExtResource( 4 ) script = ExtResource( 4 )
[node name="NeckAttachment" type="BoneAttachment" parent="armature/Armature/Skeleton" index="5"] [node name="NeckAttachment" type="BoneAttachment" parent="armature/Armature/Skeleton" index="5"]
transform = Transform( 0.999954, -0.00337903, 0.0089612, 0.00956298, 0.316377, -0.948509, 0.00036994, 0.94862, 0.316421, 0.00119397, 1.31494, 0.00220678 ) transform = Transform( 0.999941, -0.00398304, 0.0101906, 0.0109184, 0.316342, -0.948464, 0.000554104, 0.948624, 0.316407, 0.00117709, 1.31329, 0.00221987 )
bone_name = "neck" bone_name = "neck"
[node name="TorsoAP" type="Spatial" parent="armature/Armature/Skeleton/NeckAttachment"] [node name="TorsoAP" type="Spatial" parent="armature/Armature/Skeleton/NeckAttachment"]
@ -273,10 +273,10 @@ transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.04, -0.09 )
script = ExtResource( 4 ) script = ExtResource( 4 )
[node name="AnimationTree" type="AnimationTree" parent="."] [node name="AnimationTree" type="AnimationTree" parent="."]
tree_root = SubResource( 33 ) tree_root = SubResource( 29 )
anim_player = NodePath("../armature/AnimationPlayer") anim_player = NodePath("../armature/AnimationPlayer")
active = true active = true
parameters/playback = SubResource( 34 ) parameters/playback = SubResource( 30 )
parameters/run-loop/blend_position = Vector2( 0, -0.0172414 ) parameters/run-loop/blend_position = Vector2( 0, -0.0172414 )
[node name="DirectionalLight" type="DirectionalLight" parent="."] [node name="DirectionalLight" type="DirectionalLight" parent="."]

View File

@ -1,20 +0,0 @@
[gd_resource type="Shader" format=2]
[resource]
code = "shader_type spatial;
//render_mode unshaded, cull_disabled;
//render_mode unshaded;
//render_mode specular_toon;
render_mode vertex_lighting;
render_mode shadows_disabled;
//render_mode ambient_light_disabled;
void fragment() {
METALLIC = 0.0;
ROUGHNESS = 0.01;
ALBEDO = vec3(0.1, 0.3, 0.5);
}
void light() {
DIFFUSE_LIGHT += dot(NORMAL, LIGHT) * ATTENUATION * ALBEDO;
}"

View File

@ -0,0 +1,15 @@
[gd_resource type="Shader" format=2]
[resource]
code = "shader_type spatial;
render_mode blend_mix,depth_draw_opaque,cull_back,specular_disabled,vertex_lighting;
uniform vec4 albedo : hint_color;
uniform sampler2D texture_albedo : hint_albedo;
void fragment() {
vec2 base_uv = UV;
vec4 albedo_tex = texture(texture_albedo,base_uv);
albedo_tex *= COLOR;
ALBEDO = albedo.rgb * albedo_tex.rgb;
}
"

View File

@ -1,31 +1,13 @@
[gd_resource type="VoxelmanLibraryMerger" load_steps=8 format=2] [gd_resource type="VoxelmanLibraryMerger" load_steps=6 format=2]
[ext_resource path="res://data/materials/world_material.tres" type="Material" id=1] [ext_resource path="res://data/materials/1_standard_material.tres" type="Material" id=1]
[ext_resource path="res://data/voxel_surfaces/2_test.tres" type="VoxelSurfaceMerger" id=3] [ext_resource path="res://data/voxel_surfaces/2_test.tres" type="VoxelSurfaceMerger" id=3]
[ext_resource path="res://data/voxel_surfaces/1_stone.tres" type="VoxelSurfaceMerger" id=4] [ext_resource path="res://data/voxel_surfaces/1_stone.tres" type="VoxelSurfaceMerger" id=4]
[ext_resource path="res://data/voxel_surfaces/3_test2.tres" type="VoxelSurfaceMerger" id=5] [ext_resource path="res://data/voxel_surfaces/3_test2.tres" type="VoxelSurfaceMerger" id=5]
[ext_resource path="res://data/voxel_surfaces/0_air.tres" type="VoxelSurfaceMerger" id=7] [ext_resource path="res://data/voxel_surfaces/0_air.tres" type="VoxelSurfaceMerger" id=7]
[sub_resource type="Shader" id=1]
code = "shader_type spatial;
render_mode blend_mix,depth_draw_opaque,cull_back,specular_disabled,vertex_lighting;
uniform vec4 albedo : hint_color;
uniform sampler2D texture_albedo : hint_albedo;
void fragment() {
vec2 base_uv = UV;
vec4 albedo_tex = texture(texture_albedo,base_uv);
albedo_tex *= COLOR;
ALBEDO = albedo.rgb * albedo_tex.rgb;
}
"
[sub_resource type="ShaderMaterial" id=2]
shader = SubResource( 1 )
shader_param/albedo = Color( 1, 1, 1, 1 )
[resource] [resource]
material = ExtResource( 1 ) material = ExtResource( 1 )
prop_material = SubResource( 2 ) prop_material = ExtResource( 1 )
texture_flags = 1 texture_flags = 1
voxel_surfaces = [ ExtResource( 7 ), ExtResource( 4 ), ExtResource( 3 ), ExtResource( 5 ) ] voxel_surfaces = [ ExtResource( 7 ), ExtResource( 4 ), ExtResource( 3 ), ExtResource( 5 ) ]

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/test.png-e87bdfc7eb0364f7afee143bf66dc9dd.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://data/voxel_textures/test.png"
dest_files=[ "res://.import/test.png-e87bdfc7eb0364f7afee143bf66dc9dd.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=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=false
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0

View File

@ -1,6 +1,7 @@
[gd_resource type="ShaderMaterial" load_steps=2 format=2] [gd_resource type="ShaderMaterial" load_steps=2 format=2]
[ext_resource path="res://data/shaders/1_charactershader.tres" type="Shader" id=1] [ext_resource path="res://data/shaders/1_standard_shader.tres" type="Shader" id=1]
[resource] [resource]
shader = ExtResource( 1 ) shader = ExtResource( 1 )

View File

@ -226,8 +226,11 @@ func prepare_textures() -> void:
var tex : Texture = _texture_packer.get_generated_texture(0) var tex : Texture = _texture_packer.get_generated_texture(0)
var mat : SpatialMaterial = _material as SpatialMaterial # var mat : SpatialMaterial = _material as SpatialMaterial
mat.albedo_texture = tex # mat.albedo_texture = tex
var mat : ShaderMaterial = _material as ShaderMaterial
mat.set_shader_param("texture_albedo", tex)
# mat.albedo_texture = tex
_texture = tex _texture = tex

View File

@ -46,7 +46,6 @@ transform = Transform( -1, 0, -3.25841e-07, 0, 1, 0, 3.25841e-07, 0, -1, 0, 0, 0
[node name="Model" type="Spatial" parent="Rotation_Helper"] [node name="Model" type="Spatial" parent="Rotation_Helper"]
[node name="character" parent="Rotation_Helper/Model" instance=ExtResource( 1 )] [node name="character" parent="Rotation_Helper/Model" instance=ExtResource( 1 )]
refresh_in_editor = false
[node name="GUILayer" parent="." instance=ExtResource( 3 )] [node name="GUILayer" parent="." instance=ExtResource( 3 )]
[connection signal="onc_open_loot_winow_request" from="." to="GUILayer" method="_on_Player_onc_open_loot_winow_request"] [connection signal="onc_open_loot_winow_request" from="." to="GUILayer" method="_on_Player_onc_open_loot_winow_request"]