Add full 3d version of prototype 2 with shadow support, changed rendering to Forward+

This commit is contained in:
tiredbun 2023-12-12 22:46:46 +03:00
parent ccdf3827a8
commit fbef58f211
9 changed files with 320 additions and 105 deletions

View File

@ -3,25 +3,26 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://oblvfn4a7jgr"
path="res://.godot/imported/down-stay.png-8f04363183504ef4c5894d1e8b79ee12.ctex"
path.s3tc="res://.godot/imported/down-stay.png-8f04363183504ef4c5894d1e8b79ee12.s3tc.ctex"
metadata={
"vram_texture": false
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://Prototypes/tiredbun-prototype-1/player/down-stay.png"
dest_files=["res://.godot/imported/down-stay.png-8f04363183504ef4c5894d1e8b79ee12.ctex"]
dest_files=["res://.godot/imported/down-stay.png-8f04363183504ef4c5894d1e8b79ee12.s3tc.ctex"]
[params]
compress/mode=0
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
@ -31,4 +32,4 @@ process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
detect_3d/compress_to=0

View File

@ -0,0 +1,48 @@
extends CharacterBody3D
@export var SPEED = 3.5
@export var JUMP_VELOCITY = 4.5
@export var PlayerSprite: AnimatedSprite3D
# Get the gravity from the project settings to be synced with RigidBody nodes.
var gravity = ProjectSettings.get_setting("physics/3d/default_gravity")
func _physics_process(delta):
# Add the gravity.
if not is_on_floor():
velocity.y -= gravity * delta
# Handle Jump. (currently removed)
#if Input.is_action_just_pressed("ui_accept") and is_on_floor():
# velocity.y = JUMP_VELOCITY
# Get the input direction and handle the movement/deceleration.
# TODO: replace UI actions with custom gameplay actions.
var input_dir = Input.get_vector("ui_left", "ui_right", "ui_up", "ui_down")
var direction = (transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized()
if direction:
velocity.x = direction.x * SPEED
velocity.z = direction.z * SPEED
else:
velocity.x = move_toward(velocity.x, 0, SPEED)
velocity.z = move_toward(velocity.z, 0, SPEED)
if direction.x < 0 and !direction.z:
PlayerSprite.animation = "left-go"
if direction.x > 0 and !direction.z:
PlayerSprite.animation = "right-go"
if direction.z < 0:
PlayerSprite.animation = "up-go"
if direction.z > 0:
PlayerSprite.animation = "down-go"
# Check if animation should play
if (velocity.x == 0) and (velocity.z == 0): # if not
PlayerSprite.frame = 0 # set to first animation frame
PlayerSprite.stop() # stop animation
else: # if yes
PlayerSprite.play() # play animation
move_and_slide() # apply changes to position

View File

@ -0,0 +1,14 @@
[gd_resource type="SpriteFrames" load_steps=2 format=3 uid="uid://cu4q8xj7q5scf"]
[ext_resource type="Texture2D" uid="uid://dur4276gi0rkm" path="res://Prototypes/tiredbun-prototype-2/randomBush/1.png" id="1_xskc3"]
[resource]
animations = [{
"frames": [{
"duration": 1.0,
"texture": ExtResource("1_xskc3")
}],
"loop": true,
"name": &"default",
"speed": 5.0
}]

View File

@ -0,0 +1,11 @@
extends AnimatedSprite3D
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
var camera_position
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
camera_position = get_viewport().get_camera_3d().position

View File

@ -0,0 +1,57 @@
[gd_resource type="SpriteFrames" load_steps=9 format=3 uid="uid://djriv2tu2f30"]
[ext_resource type="Texture2D" uid="uid://oblvfn4a7jgr" path="res://Prototypes/tiredbun-prototype-1/player/down-stay.png" id="1_6hnp2"]
[ext_resource type="Texture2D" uid="uid://bn3ak3pxua6kr" path="res://Prototypes/tiredbun-prototype-1/player/down-go.png" id="2_ety8t"]
[ext_resource type="Texture2D" uid="uid://ryqgr3iw2cna" path="res://Prototypes/tiredbun-prototype-1/player/lef-stay.png" id="3_hjwiv"]
[ext_resource type="Texture2D" uid="uid://cr4m035rj17ob" path="res://Prototypes/tiredbun-prototype-1/player/lef-go.png" id="4_rhjdh"]
[ext_resource type="Texture2D" uid="uid://d11jduno6wolt" path="res://Prototypes/tiredbun-prototype-1/player/right-stay.png" id="5_17tq0"]
[ext_resource type="Texture2D" uid="uid://bp5p8knf7n06i" path="res://Prototypes/tiredbun-prototype-1/player/right-go.png" id="6_tic1y"]
[ext_resource type="Texture2D" uid="uid://jduoxes2e4uh" path="res://Prototypes/tiredbun-prototype-1/player/up-stay.png" id="7_vf04i"]
[ext_resource type="Texture2D" uid="uid://bup48pdr00h7a" path="res://Prototypes/tiredbun-prototype-1/player/up-go.png" id="8_f6u63"]
[resource]
animations = [{
"frames": [{
"duration": 1.0,
"texture": ExtResource("1_6hnp2")
}, {
"duration": 1.0,
"texture": ExtResource("2_ety8t")
}],
"loop": true,
"name": &"down-go",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": ExtResource("3_hjwiv")
}, {
"duration": 1.0,
"texture": ExtResource("4_rhjdh")
}],
"loop": true,
"name": &"left-go",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": ExtResource("5_17tq0")
}, {
"duration": 1.0,
"texture": ExtResource("6_tic1y")
}],
"loop": true,
"name": &"right-go",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": ExtResource("7_vf04i")
}, {
"duration": 1.0,
"texture": ExtResource("8_f6u63")
}],
"loop": true,
"name": &"up-go",
"speed": 5.0
}]

View File

@ -3,25 +3,26 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://dur4276gi0rkm"
path="res://.godot/imported/1.png-02577de67e305906c53828957662cdef.ctex"
path.s3tc="res://.godot/imported/1.png-02577de67e305906c53828957662cdef.s3tc.ctex"
metadata={
"vram_texture": false
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://Prototypes/tiredbun-prototype-2/randomBush/1.png"
dest_files=["res://.godot/imported/1.png-02577de67e305906c53828957662cdef.ctex"]
dest_files=["res://.godot/imported/1.png-02577de67e305906c53828957662cdef.s3tc.ctex"]
[params]
compress/mode=0
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
@ -31,4 +32,4 @@ process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
detect_3d/compress_to=0

View File

@ -1,17 +1,9 @@
[gd_scene load_steps=21 format=3 uid="uid://c31gp7om5lww4"]
[gd_scene load_steps=11 format=3 uid="uid://c31gp7om5lww4"]
[ext_resource type="Texture2D" uid="uid://b0bmwarkx2fxb" path="res://Prototypes/tiredbun-prototype-1/mpv-shot0001.jpg" id="1_fbk20"]
[ext_resource type="Script" path="res://Prototypes/tiredbun-prototype-2/camera-test.gd" id="2_4b25q"]
[ext_resource type="Script" path="res://Prototypes/tiredbun-prototype-2/Player3D.gd" id="3_j7jmd"]
[ext_resource type="Texture2D" uid="uid://oblvfn4a7jgr" path="res://Prototypes/tiredbun-prototype-1/player/down-stay.png" id="4_lqg8o"]
[ext_resource type="Texture2D" uid="uid://bn3ak3pxua6kr" path="res://Prototypes/tiredbun-prototype-1/player/down-go.png" id="5_78ws4"]
[ext_resource type="Texture2D" uid="uid://ryqgr3iw2cna" path="res://Prototypes/tiredbun-prototype-1/player/lef-stay.png" id="6_ki7wl"]
[ext_resource type="Texture2D" uid="uid://cr4m035rj17ob" path="res://Prototypes/tiredbun-prototype-1/player/lef-go.png" id="7_c0fx0"]
[ext_resource type="Texture2D" uid="uid://d11jduno6wolt" path="res://Prototypes/tiredbun-prototype-1/player/right-stay.png" id="8_hmhe2"]
[ext_resource type="Texture2D" uid="uid://bp5p8knf7n06i" path="res://Prototypes/tiredbun-prototype-1/player/right-go.png" id="9_ugr25"]
[ext_resource type="Texture2D" uid="uid://jduoxes2e4uh" path="res://Prototypes/tiredbun-prototype-1/player/up-stay.png" id="10_gmxvm"]
[ext_resource type="Texture2D" uid="uid://bup48pdr00h7a" path="res://Prototypes/tiredbun-prototype-1/player/up-go.png" id="11_vwm5d"]
[ext_resource type="Texture2D" uid="uid://dur4276gi0rkm" path="res://Prototypes/tiredbun-prototype-2/randomBush/1.png" id="12_7gptv"]
[ext_resource type="Script" path="res://Prototypes/tiredbun-prototype-2/Player3D_true_3d.gd" id="2_xo2kw"]
[ext_resource type="SpriteFrames" uid="uid://djriv2tu2f30" path="res://Prototypes/tiredbun-prototype-2/player_anim.tres" id="3_3tva1"]
[ext_resource type="SpriteFrames" uid="uid://cu4q8xj7q5scf" path="res://Prototypes/tiredbun-prototype-2/bush_anim.tres" id="4_thfon"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_tw6je"]
albedo_texture = ExtResource("1_fbk20")
@ -31,68 +23,10 @@ ambient_light_energy = 2.85
reflected_light_source = 1
[sub_resource type="SphereShape3D" id="SphereShape3D_1tnpf"]
radius = 0.205485
[sub_resource type="SpriteFrames" id="SpriteFrames_ep00u"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": ExtResource("4_lqg8o")
}, {
"duration": 1.0,
"texture": ExtResource("5_78ws4")
}],
"loop": true,
"name": &"down-go",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": ExtResource("6_ki7wl")
}, {
"duration": 1.0,
"texture": ExtResource("7_c0fx0")
}],
"loop": true,
"name": &"left-go",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": ExtResource("8_hmhe2")
}, {
"duration": 1.0,
"texture": ExtResource("9_ugr25")
}],
"loop": true,
"name": &"right-go",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": ExtResource("10_gmxvm")
}, {
"duration": 1.0,
"texture": ExtResource("11_vwm5d")
}],
"loop": true,
"name": &"up-go",
"speed": 5.0
}]
radius = 0.265227
[sub_resource type="BoxShape3D" id="BoxShape3D_cns20"]
size = Vector3(0.977401, 0.5, 0.16768)
[sub_resource type="SpriteFrames" id="SpriteFrames_ev0qv"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": ExtResource("12_7gptv")
}],
"loop": true,
"name": &"default",
"speed": 5.0
}]
size = Vector3(1.86457, 1.64705, 0.16768)
[node name="test-scene3d" type="Node3D"]
@ -108,16 +42,12 @@ shape = SubResource("BoxShape3D_3q2fk")
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
environment = SubResource("Environment_vvato")
[node name="Player" type="Node3D" parent="." node_paths=PackedStringArray("AnimatedSprite", "Camera", "CharacterBody")]
script = ExtResource("2_4b25q")
AnimatedSprite = NodePath("CharacterBody3D/PlayerSprite")
Camera = NodePath("CharacterBody3D/Camera3D")
CharacterBody = NodePath("CharacterBody3D")
[node name="Player" type="Node3D" parent="."]
[node name="CharacterBody3D" type="CharacterBody3D" parent="Player" node_paths=PackedStringArray("PlayerSprite")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5, 0)
script = ExtResource("3_j7jmd")
PlayerSprite = NodePath("PlayerSprite")
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.690832, 0)
script = ExtResource("2_xo2kw")
PlayerSprite = NodePath("AnimatedSprite3D")
[node name="CollisionShape3D" type="CollisionShape3D" parent="Player/CharacterBody3D"]
shape = SubResource("SphereShape3D_1tnpf")
@ -125,24 +55,41 @@ shape = SubResource("SphereShape3D_1tnpf")
[node name="Camera3D" type="Camera3D" parent="Player/CharacterBody3D"]
transform = Transform3D(1, 0, 0, 0, 0.897405, 0.441208, 0, -0.441208, 0.897405, 0, 1.47635, 2.63733)
[node name="PlayerSprite" type="AnimatedSprite2D" parent="Player/CharacterBody3D"]
position = Vector2(177, 68)
sprite_frames = SubResource("SpriteFrames_ep00u")
[node name="AnimatedSprite3D" type="AnimatedSprite3D" parent="Player/CharacterBody3D"]
billboard = 1
shaded = true
alpha_cut = 2
alpha_antialiasing_edge = 0.75
sprite_frames = ExtResource("3_3tva1")
animation = &"down-go"
[node name="Bush" type="Node3D" parent="." node_paths=PackedStringArray("AnimatedSprite", "Camera", "CharacterBody")]
script = ExtResource("2_4b25q")
AnimatedSprite = NodePath("AnimatedSprite2D")
Camera = NodePath("../Player/CharacterBody3D/Camera3D")
CharacterBody = NodePath("StaticBody3D")
[node name="Bush" type="Node3D" parent="."]
[node name="StaticBody3D" type="StaticBody3D" parent="Bush"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.85931, 0, 0)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.85931, 0.308904, 1.03874)
[node name="CollisionShape3D" type="CollisionShape3D" parent="Bush/StaticBody3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.220076)
shape = SubResource("BoxShape3D_cns20")
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="Bush"]
position = Vector2(299, 64)
sprite_frames = SubResource("SpriteFrames_ev0qv")
[node name="AnimatedSprite3D" type="AnimatedSprite3D" parent="Bush/StaticBody3D"]
billboard = 1
shaded = true
alpha_cut = 2
sprite_frames = ExtResource("4_thfon")
[node name="SpotLight3D" type="SpotLight3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 0.624221, 0.781248, 0, -0.781248, 0.624221, -2.3085, 2.43161, 0)
light_energy = 1.385
shadow_enabled = true
shadow_bias = 0.045
shadow_blur = 1.574
spot_range = 4.02633
[node name="SpotLight3D2" type="SpotLight3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 0.461563, 0.887108, 0, -0.887108, 0.461563, 2.55379, 2.43161, 2.65901)
light_energy = 1.385
shadow_enabled = true
shadow_bias = 0.045
shadow_blur = 1.574
spot_range = 4.02633

View File

@ -0,0 +1,137 @@
[gd_scene load_steps=20 format=3 uid="uid://daltmdjn02ig7"]
[ext_resource type="Texture2D" uid="uid://b0bmwarkx2fxb" path="res://Prototypes/tiredbun-prototype-1/mpv-shot0001.jpg" id="1_rogvf"]
[ext_resource type="Script" path="res://Prototypes/tiredbun-prototype-2/camera-test.gd" id="2_vwipe"]
[ext_resource type="Script" path="res://Prototypes/tiredbun-prototype-2/Player3D.gd" id="3_e8wms"]
[ext_resource type="Texture2D" uid="uid://oblvfn4a7jgr" path="res://Prototypes/tiredbun-prototype-1/player/down-stay.png" id="4_6aa06"]
[ext_resource type="Texture2D" uid="uid://bn3ak3pxua6kr" path="res://Prototypes/tiredbun-prototype-1/player/down-go.png" id="5_yncu6"]
[ext_resource type="Texture2D" uid="uid://ryqgr3iw2cna" path="res://Prototypes/tiredbun-prototype-1/player/lef-stay.png" id="6_56x1e"]
[ext_resource type="Texture2D" uid="uid://cr4m035rj17ob" path="res://Prototypes/tiredbun-prototype-1/player/lef-go.png" id="7_cbddp"]
[ext_resource type="Texture2D" uid="uid://d11jduno6wolt" path="res://Prototypes/tiredbun-prototype-1/player/right-stay.png" id="8_udivj"]
[ext_resource type="Texture2D" uid="uid://bp5p8knf7n06i" path="res://Prototypes/tiredbun-prototype-1/player/right-go.png" id="9_qf0od"]
[ext_resource type="Texture2D" uid="uid://jduoxes2e4uh" path="res://Prototypes/tiredbun-prototype-1/player/up-stay.png" id="10_hfe2n"]
[ext_resource type="Texture2D" uid="uid://bup48pdr00h7a" path="res://Prototypes/tiredbun-prototype-1/player/up-go.png" id="11_5rf6j"]
[ext_resource type="SpriteFrames" uid="uid://cu4q8xj7q5scf" path="res://Prototypes/tiredbun-prototype-2/bush_anim.tres" id="12_r8gbv"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_tw6je"]
albedo_texture = ExtResource("1_rogvf")
[sub_resource type="PlaneMesh" id="PlaneMesh_tet4n"]
material = SubResource("StandardMaterial3D_tw6je")
size = Vector2(10, 10)
[sub_resource type="BoxShape3D" id="BoxShape3D_3q2fk"]
size = Vector3(10.084, 1, 9.89738)
[sub_resource type="Environment" id="Environment_vvato"]
background_mode = 1
background_color = Color(0.729412, 0.729412, 0.729412, 1)
ambient_light_color = Color(1, 1, 1, 1)
ambient_light_energy = 2.85
reflected_light_source = 1
[sub_resource type="SphereShape3D" id="SphereShape3D_1tnpf"]
radius = 0.205485
[sub_resource type="SpriteFrames" id="SpriteFrames_ep00u"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": ExtResource("4_6aa06")
}, {
"duration": 1.0,
"texture": ExtResource("5_yncu6")
}],
"loop": true,
"name": &"down-go",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": ExtResource("6_56x1e")
}, {
"duration": 1.0,
"texture": ExtResource("7_cbddp")
}],
"loop": true,
"name": &"left-go",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": ExtResource("8_udivj")
}, {
"duration": 1.0,
"texture": ExtResource("9_qf0od")
}],
"loop": true,
"name": &"right-go",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": ExtResource("10_hfe2n")
}, {
"duration": 1.0,
"texture": ExtResource("11_5rf6j")
}],
"loop": true,
"name": &"up-go",
"speed": 5.0
}]
[sub_resource type="BoxShape3D" id="BoxShape3D_cns20"]
size = Vector3(0.977401, 0.5, 0.16768)
[node name="test-scene3d" type="Node3D"]
[node name="Floor" type="MeshInstance3D" parent="."]
mesh = SubResource("PlaneMesh_tet4n")
[node name="StaticBody3D" type="StaticBody3D" parent="Floor"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.5, 0)
[node name="CollisionShape3D" type="CollisionShape3D" parent="Floor/StaticBody3D"]
shape = SubResource("BoxShape3D_3q2fk")
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
environment = SubResource("Environment_vvato")
[node name="Player" type="Node3D" parent="." node_paths=PackedStringArray("AnimatedSprite", "Camera", "CharacterBody")]
script = ExtResource("2_vwipe")
AnimatedSprite = NodePath("CharacterBody3D/PlayerSprite")
Camera = NodePath("CharacterBody3D/Camera3D")
CharacterBody = NodePath("CharacterBody3D")
[node name="CharacterBody3D" type="CharacterBody3D" parent="Player" node_paths=PackedStringArray("PlayerSprite")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5, 0)
script = ExtResource("3_e8wms")
PlayerSprite = NodePath("PlayerSprite")
[node name="CollisionShape3D" type="CollisionShape3D" parent="Player/CharacterBody3D"]
shape = SubResource("SphereShape3D_1tnpf")
[node name="Camera3D" type="Camera3D" parent="Player/CharacterBody3D"]
transform = Transform3D(1, 0, 0, 0, 0.897405, 0.441208, 0, -0.441208, 0.897405, 0, 1.47635, 2.63733)
[node name="PlayerSprite" type="AnimatedSprite2D" parent="Player/CharacterBody3D"]
position = Vector2(177, 68)
sprite_frames = SubResource("SpriteFrames_ep00u")
animation = &"down-go"
[node name="Bush" type="Node3D" parent="." node_paths=PackedStringArray("AnimatedSprite", "Camera", "CharacterBody")]
script = ExtResource("2_vwipe")
AnimatedSprite = NodePath("AnimatedSprite2D")
Camera = NodePath("../Player/CharacterBody3D/Camera3D")
CharacterBody = NodePath("StaticBody3D")
[node name="StaticBody3D" type="StaticBody3D" parent="Bush"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.85931, 0, 0)
[node name="CollisionShape3D" type="CollisionShape3D" parent="Bush/StaticBody3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.220076)
shape = SubResource("BoxShape3D_cns20")
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="Bush"]
position = Vector2(299, 64)
sprite_frames = ExtResource("12_r8gbv")

View File

@ -16,5 +16,4 @@ config/icon="res://icon.svg"
[rendering]
renderer/rendering_method="gl_compatibility"
renderer/rendering_method.mobile="gl_compatibility"