gdquest-demos / godot-4-3d-third-person-controller

Godot 4 demo with a plug-and-play 3D Third-Person Shooter (TPS) character controller inspired by games like Ratchet and Clank.
MIT License
684 stars 76 forks source link

Project fails to run in 4.0.2 #18

Closed epicRedHot closed 1 year ago

epicRedHot commented 1 year ago

I'm unsure of if there are further errors hidden behind the ones that are logged, but I don't know how to fix the existing ones myself to check.

Log:

Godot Engine v4.0.2.stable.official.7a0977ce2 - https://godotengine.org Vulkan API 1.3.224 - Forward+ - Using Vulkan Device #0: NVIDIA - NVIDIA GeForce RTX 3060 Ti

USER WARNING: res://Player/Grenade.tscn:4 - ext_resource, invalid UID: uid://d5jny5gc8ntg - using text path instead: res://Player/GrenadeVisuals/grenade/grenade.tscn at: load (scene/resources/resource_format_text.cpp:448) --Main Shader-- 1 | shader_type spatial; 2 | 3 | uniform vec3 shallow_color : source_color; 4 | uniform vec3 deep_color : source_color; 5 | uniform vec3 foam_color : source_color; 6 | uniform float water_scale = 1.0; 7 | uniform float time_scale = 100.0; 8 | uniform sampler2D noise_sampler : hint_normal; 9 | uniform sampler2D small_waves_sampler : hint_normal; 10 | 11 | uniform sampler2D foam_noise : hint_normal; 12 | 13 | 14 | float fresnel(vec3 normal, vec3 view, float intensity){ 15 | return pow(1.0 - clamp(dot(normal, view), 0.0, 1.0), intensity); 16 | } 17 | 18 | void fragment() { 19 |
20 |
21 | vec2 scaled_uv = UV water_scale; 22 | float scaled_time = TIME / time_scale; 23 |
24 |
E 25-> float _log_depth = textureLod(DEPTH_TEXTURE, SCREEN_UV, 0.0).x; 26 | vec3 _depth_ndc = vec3(SCREEN_UV
2.0 - 1.0, _log_depth); 27 | vec4 _depth_view = INV_PROJECTION_MATRIX vec4(_depth_ndc, 1.0); 28 | _depth_view.xyz /= _depth_view.w; 29 | float linear_depth = -_depth_view.z; 30 |
31 | float depth = VERTEX.z + linear_depth; 32 | depth
= 0.2; 33 | depth = clamp(depth, 0.0, 1.0); 34 |
35 | float foam_n = texture(foam_noise, scaled_uv + scaled_time).x; 36 |
37 | float foam_mask = smoothstep(0.0, 0.5 foam_n, depth); 38 |
39 | vec3 screen_color = texture(SCREEN_TEXTURE, SCREEN_UV).rgb; 40 |
41 | vec3 screen_color_depth = mix(screen_color
shallow_color, deep_color, depth); 42 |
43 | vec3 water_color = mix(screen_color_depth, deep_color, fresnel(NORMAL, VIEW, 2.0)); 44 |
45 | ALBEDO = mix(foam_color, water_color, foam_mask); 46 | ROUGHNESS = 0.02; 47 | SPECULAR = 1.0; 48 |
49 |
50 | vec3 normal_map = texture(noise_sampler, scaled_uv + scaled_time).rgb; 51 | vec3 small_waves = texture(small_waves_sampler, scaled_uv - scaled_time).rgb; 52 |
53 | NORMAL_MAP = mix(normal_map, small_waves, 0.5); 54 | NORMAL_MAP_DEPTH = 0.25; 55 | } 56 | USER SHADER ERROR: DEPTH_TEXTURE has been removed in favor of using hint_depth_texture with a uniform. To continue with minimal code changes add 'uniform sampler2D DEPTH_TEXTURE : hint_depth_texture, filter_linear_mipmap;' near the top of your shader. at: (null) (:25) USER ERROR: Shader compilation failed. at: set_code (servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp:137) USER ERROR: Condition "!version" is true. Returning: RID() at: version_get_shader (./servers/rendering/renderer_rd/shader_rd.h:140)

tung-nt-niteco commented 1 year ago

You just need to do what the error said, then it will work, so add to the top of your shader: uniform sampler2D DEPTH_TEXTURE : hint_depth_texture, filter_linear_mipmap; uniform sampler2D SCENE_TEXTURE : hint_scene_texture, filter_linear_mipmap;

NathanLovato commented 1 year ago

This was already fixed by https://github.com/gdquest-demos/godot-4-3d-third-person-controller/pull/13, closing