Add shader for backfaces of sink blocks
This commit is contained in:
parent
c5df54cab5
commit
70d88bb040
Binary file not shown.
|
@ -0,0 +1,3 @@
|
|||
source_md5="b69e58a3b703963508b0c45580e92b83"
|
||||
dest_md5="0521cc0071c51c7730c641f4be12d07b"
|
||||
|
Binary file not shown.
Binary file not shown.
|
@ -1,2 +1,2 @@
|
|||
43123
|
||||
35121
|
||||
/home/squirrel/.local/bin/godot_mono
|
||||
|
|
Binary file not shown.
|
@ -0,0 +1,37 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path.s3tc="res://.import/stringy_meat.jpg-8af41dda9bee7ed09f987b508cf64292.s3tc.stex"
|
||||
path.etc2="res://.import/stringy_meat.jpg-8af41dda9bee7ed09f987b508cf64292.etc2.stex"
|
||||
metadata={
|
||||
"imported_formats": [ "s3tc", "etc2" ],
|
||||
"vram_texture": true
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/stringy_meat.jpg"
|
||||
dest_files=[ "res://.import/stringy_meat.jpg-8af41dda9bee7ed09f987b508cf64292.s3tc.stex", "res://.import/stringy_meat.jpg-8af41dda9bee7ed09f987b508cf64292.etc2.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=2
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=true
|
||||
flags/filter=true
|
||||
flags/mipmaps=true
|
||||
flags/anisotropic=false
|
||||
flags/srgb=1
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
process/normal_map_invert_y=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=false
|
||||
svg/scale=1.0
|
|
@ -1,4 +1,4 @@
|
|||
extends Area
|
||||
extends Node
|
||||
|
||||
onready var util = get_node("/root/Util")
|
||||
onready var global_event_bus = get_node("/root/GlobalEventBus")
|
|
@ -0,0 +1,24 @@
|
|||
[gd_scene load_steps=5 format=2]
|
||||
|
||||
[ext_resource path="res://effects/meat_sink_block_texture.tres" type="Material" id=1]
|
||||
[ext_resource path="res://effects/SinkBlock.gd" type="Script" id=2]
|
||||
|
||||
[sub_resource type="CubeMesh" id=3]
|
||||
|
||||
[sub_resource type="BoxShape" id=4]
|
||||
|
||||
[node name="SinkBlock" type="MeshInstance"]
|
||||
transform = Transform( 1, 0, 0, 0, 0.264811, 0, 0, 0, 1, 2.72806, 0.561258, 0 )
|
||||
mesh = SubResource( 3 )
|
||||
material/0 = ExtResource( 1 )
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="SinkRegion" type="Area" parent="."]
|
||||
transform = Transform( 1, 0, 0, 0, 3.77628, 0, 0, 0, 1, -2.72806, -2.11947, 0 )
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="SinkRegion"]
|
||||
transform = Transform( 1, 0, 0, 0, 0.264811, 0, 0, 0, 0.988649, 2.72806, 0.561258, 0 )
|
||||
shape = SubResource( 4 )
|
||||
|
||||
[connection signal="body_entered" from="SinkRegion" to="." method="_on_SinkRegion_body_entered"]
|
||||
[connection signal="body_exited" from="SinkRegion" to="." method="_on_SinkRegion_body_exited"]
|
|
@ -0,0 +1,66 @@
|
|||
[gd_resource type="ShaderMaterial" load_steps=5 format=2]
|
||||
|
||||
[ext_resource path="res://assets/stringy_meat.jpg" type="Texture" id=1]
|
||||
|
||||
[sub_resource type="Shader" id=4]
|
||||
code = "shader_type spatial;
|
||||
render_mode unshaded,cull_front;
|
||||
uniform sampler2D texture_albedo : hint_albedo;
|
||||
|
||||
void fragment() {
|
||||
vec2 uv = SCREEN_UV;
|
||||
uv.x += sin((TIME + SCREEN_UV.y) * 5.0)/5.0;
|
||||
ALBEDO = texture(texture_albedo, uv).rgb;
|
||||
}"
|
||||
|
||||
[sub_resource type="ShaderMaterial" id=5]
|
||||
shader = SubResource( 4 )
|
||||
shader_param/texture_albedo = ExtResource( 1 )
|
||||
|
||||
[sub_resource type="Shader" id=3]
|
||||
code = "// NOTE: Shader automatically converted from Godot Engine 3.5.1.stable.mono's SpatialMaterial.
|
||||
|
||||
shader_type spatial;
|
||||
render_mode async_visible,blend_mix,depth_draw_opaque,cull_back,diffuse_burley,specular_schlick_ggx;
|
||||
uniform vec4 albedo : hint_color;
|
||||
uniform sampler2D texture_albedo : hint_albedo;
|
||||
uniform float specular;
|
||||
uniform float metallic;
|
||||
uniform float roughness : hint_range(0,1);
|
||||
uniform float point_size : hint_range(0,128);
|
||||
uniform vec3 uv1_scale;
|
||||
uniform vec3 uv1_offset;
|
||||
uniform vec3 uv2_scale;
|
||||
uniform vec3 uv2_offset;
|
||||
|
||||
|
||||
void vertex() {
|
||||
UV=UV*uv1_scale.xy+uv1_offset.xy;
|
||||
}
|
||||
|
||||
|
||||
void fragment() {
|
||||
vec2 base_uv = UV;
|
||||
vec4 albedo_tex = texture(texture_albedo,base_uv);
|
||||
albedo_tex *= COLOR;
|
||||
ALBEDO = albedo.rgb * albedo_tex.rgb;
|
||||
METALLIC = metallic;
|
||||
ROUGHNESS = roughness;
|
||||
SPECULAR = specular;
|
||||
}
|
||||
"
|
||||
|
||||
[resource]
|
||||
resource_name = "TestMeat"
|
||||
next_pass = SubResource( 5 )
|
||||
shader = SubResource( 3 )
|
||||
shader_param/albedo = Color( 1, 1, 1, 1 )
|
||||
shader_param/specular = 0.5
|
||||
shader_param/metallic = 0.0
|
||||
shader_param/roughness = 1.0
|
||||
shader_param/point_size = 1.0
|
||||
shader_param/uv1_scale = Vector3( 1, 1, 1 )
|
||||
shader_param/uv1_offset = Vector3( 0, 0, 0 )
|
||||
shader_param/uv2_scale = Vector3( 1, 1, 1 )
|
||||
shader_param/uv2_offset = Vector3( 0, 0, 0 )
|
||||
shader_param/texture_albedo = ExtResource( 1 )
|
|
@ -1,15 +0,0 @@
|
|||
extends Node
|
||||
|
||||
onready var camera = get_parent()
|
||||
onready var OnFootPhysics = get_node("../../../../../OnFootPhysics")
|
||||
onready var default_fov = camera.fov
|
||||
onready var max_fov = default_fov + 20
|
||||
var min_speed = 0.5
|
||||
|
||||
func _process(_delta):
|
||||
if OnFootPhysics.velocity.y >= 0.0:
|
||||
return
|
||||
var terminal_velocity = -OnFootPhysics.get_terminal_falling_velocity()
|
||||
var speed = -OnFootPhysics.velocity.y
|
||||
var weight = (terminal_velocity - speed) / (terminal_velocity - min_speed)
|
||||
camera.fov = lerp(max_fov, default_fov, weight)
|
|
@ -0,0 +1,18 @@
|
|||
extends Node
|
||||
|
||||
onready var camera = get_parent()
|
||||
onready var OnFootPhysics = get_node("../../../../../OnFootPhysics")
|
||||
onready var default_fov = camera.fov
|
||||
onready var max_fov = default_fov + 20
|
||||
var min_speed = 0.5
|
||||
|
||||
# Commenting out code only addresses falling, but FOV should also change a bit when sprinting.
|
||||
func _process(_delta):
|
||||
pass
|
||||
#if OnFootPhysics.velocity.y >= 0.0:
|
||||
#
|
||||
# return
|
||||
#var terminal_velocity = -OnFootPhysics.get_terminal_falling_velocity()
|
||||
#var speed = -OnFootPhysics.velocity.y
|
||||
#var weight = (terminal_velocity - speed) / (terminal_velocity - min_speed)
|
||||
#camera.fov = lerp(max_fov, default_fov, weight)
|
|
@ -2,7 +2,7 @@ extends Node
|
|||
|
||||
onready var global_event_bus = get_node("/root/GlobalEventBus")
|
||||
var sink_counter = 0
|
||||
export var SINK_BLOCK_SLOWDOWN_AMOUNT = Vector3(0.8, 0.1, 0.8)
|
||||
export var SINK_BLOCK_SLOWDOWN_AMOUNT = Vector3(0.7, 0.1, 0.7)
|
||||
|
||||
func _ready():
|
||||
global_event_bus.connect("player_entered_meat_sink", self, "on_player_enter_meat_sink")
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
[ext_resource path="res://effects/player/Flashlight.tscn" type="PackedScene" id=8]
|
||||
[ext_resource path="res://effects/player/MovementSounds.tscn" type="PackedScene" id=9]
|
||||
[ext_resource path="res://player/CloseToFloor.gd" type="Script" id=10]
|
||||
[ext_resource path="res://player/FallingFOV.gd" type="Script" id=11]
|
||||
[ext_resource path="res://player/HighSpeedFOV.gd" type="Script" id=11]
|
||||
[ext_resource path="res://player/Overlay.gd" type="Script" id=12]
|
||||
[ext_resource path="res://assets/BloodMush.png" type="Texture" id=13]
|
||||
|
||||
|
@ -51,7 +51,7 @@ root_node = NodePath("../CameraAnimationFSM")
|
|||
[node name="Flashlight" parent="Smoothing/CameraController/Rotation/Camera" instance=ExtResource( 8 )]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.00211835, 0 )
|
||||
|
||||
[node name="FallingFOV" type="Node" parent="Smoothing/CameraController/Rotation/Camera"]
|
||||
[node name="HighSpeedFOV" type="Node" parent="Smoothing/CameraController/Rotation/Camera"]
|
||||
script = ExtResource( 11 )
|
||||
|
||||
[node name="OnFootPhysics" type="KinematicBody" parent="."]
|
||||
|
|
|
@ -1,18 +1,13 @@
|
|||
[gd_scene load_steps=8 format=2]
|
||||
[gd_scene load_steps=5 format=2]
|
||||
|
||||
[ext_resource path="res://player/player.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://tests/sink_block/SinkRegion.gd" type="Script" id=2]
|
||||
[ext_resource path="res://tests/ground_squish/TestMeat.material" type="Material" id=3]
|
||||
[ext_resource path="res://effects/SinkBlock.tscn" type="PackedScene" id=2]
|
||||
|
||||
[sub_resource type="CubeMesh" id=1]
|
||||
|
||||
[sub_resource type="ConcavePolygonShape" id=2]
|
||||
data = PoolVector3Array( -1, 1, 1, 1, 1, 1, -1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, 1, -1, -1, -1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1, 1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, 1, -1, -1, 1, 1, -1, -1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1, 1, 1, 1, -1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1, 1, -1, -1, -1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, 1, -1, -1, -1, -1, -1 )
|
||||
|
||||
[sub_resource type="CubeMesh" id=3]
|
||||
|
||||
[sub_resource type="BoxShape" id=4]
|
||||
|
||||
[node name="Spatial" type="Spatial"]
|
||||
|
||||
[node name="MeshInstance" type="MeshInstance" parent="."]
|
||||
|
@ -26,18 +21,4 @@ shape = SubResource( 2 )
|
|||
|
||||
[node name="Player" parent="." instance=ExtResource( 1 )]
|
||||
|
||||
[node name="SinkBlock" type="MeshInstance" parent="."]
|
||||
transform = Transform( 1, 0, 0, 0, 0.264811, 0, 0, 0, 1, 2.72806, 0.561258, 0 )
|
||||
mesh = SubResource( 3 )
|
||||
material/0 = ExtResource( 3 )
|
||||
|
||||
[node name="SinkRegion" type="Area" parent="SinkBlock"]
|
||||
transform = Transform( 1, 0, 0, 0, 3.77628, 0, 0, 0, 1, -2.72806, -2.11947, 0 )
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="SinkBlock/SinkRegion"]
|
||||
transform = Transform( 1, 0, 0, 0, 0.264811, 0, 0, 0, 0.988649, 2.72806, 0.561258, 0 )
|
||||
shape = SubResource( 4 )
|
||||
|
||||
[connection signal="body_entered" from="SinkBlock/SinkRegion" to="SinkBlock/SinkRegion" method="_on_SinkRegion_body_entered"]
|
||||
[connection signal="body_exited" from="SinkBlock/SinkRegion" to="SinkBlock/SinkRegion" method="_on_SinkRegion_body_exited"]
|
||||
[node name="SinkBlock" parent="." instance=ExtResource( 2 )]
|
||||
|
|
Loading…
Reference in New Issue