From e5206f896b4cacbf4913e879097183dfe0fcee03 Mon Sep 17 00:00:00 2001 From: Nitwel Date: Tue, 27 Feb 2024 16:37:22 +0100 Subject: [PATCH] improve performance and fix render issues --- .vscode/settings.json | 3 +++ addons/godot-xr-tools/xr/start_xr.gd | 4 ++++ assets/canvas.png.import | 14 ++++++++------ content/entities/light/light.tscn | 12 +++++++----- content/functions/occludable.gd | 4 ++++ content/main.gd | 1 + export_presets.cfg | 2 +- project.godot | 10 +++++++++- 8 files changed, 37 insertions(+), 13 deletions(-) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..317eb5a --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "godotTools.editorPath.godot4": "c:\\Users\\NilsPC\\Desktop\\Godot_v4.2-stable_win64.exe" +} \ No newline at end of file diff --git a/addons/godot-xr-tools/xr/start_xr.gd b/addons/godot-xr-tools/xr/start_xr.gd index 590ba15..3c85a92 100644 --- a/addons/godot-xr-tools/xr/start_xr.gd +++ b/addons/godot-xr-tools/xr/start_xr.gd @@ -186,6 +186,10 @@ func _set_enable_passthrough(p_new_value : bool) -> void: else: xr_interface.stop_passthrough() + var modes = xr_interface.get_supported_environment_blend_modes() + if xr_interface.XR_ENV_BLEND_MODE_ALPHA_BLEND in modes: + xr_interface.set_environment_blend_mode(xr_interface.XR_ENV_BLEND_MODE_ALPHA_BLEND) + # Perform WebXR setup func _setup_for_webxr() -> bool: diff --git a/assets/canvas.png.import b/assets/canvas.png.import index 56156bb..440cfd6 100644 --- a/assets/canvas.png.import +++ b/assets/canvas.png.import @@ -3,25 +3,27 @@ importer="texture" type="CompressedTexture2D" uid="uid://hy2f6is7qjyv" -path="res://.godot/imported/canvas.png-aa470cb9edfe91c0a54e6c5fa29d4c26.ctex" +path.s3tc="res://.godot/imported/canvas.png-aa470cb9edfe91c0a54e6c5fa29d4c26.s3tc.ctex" +path.etc2="res://.godot/imported/canvas.png-aa470cb9edfe91c0a54e6c5fa29d4c26.etc2.ctex" metadata={ -"vram_texture": false +"imported_formats": ["s3tc_bptc", "etc2_astc"], +"vram_texture": true } [deps] source_file="res://assets/canvas.png" -dest_files=["res://.godot/imported/canvas.png-aa470cb9edfe91c0a54e6c5fa29d4c26.ctex"] +dest_files=["res://.godot/imported/canvas.png-aa470cb9edfe91c0a54e6c5fa29d4c26.s3tc.ctex", "res://.godot/imported/canvas.png-aa470cb9edfe91c0a54e6c5fa29d4c26.etc2.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 +33,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 diff --git a/content/entities/light/light.tscn b/content/entities/light/light.tscn index 45d9921..9296d6e 100644 --- a/content/entities/light/light.tscn +++ b/content/entities/light/light.tscn @@ -113,16 +113,18 @@ transform = Transform3D(1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, -0.15, [node name="CollisionShape3D" type="CollisionShape3D" parent="ColorWheel"] shape = SubResource("ConvexPolygonShape3D_k3ob2") +[node name="Sprite3D" type="Sprite3D" parent="ColorWheel"] +transform = Transform3D(0.15, 0, 0, 0, -6.55671e-09, -0.15, 0, 0.15, -6.55671e-09, 0, 0.004, 0) +flip_v = true +pixel_size = 0.001 +texture = ExtResource("7_ximu1") + [node name="MeshInstance3D" type="MeshInstance3D" parent="ColorWheel"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.002, 0) material_override = SubResource("StandardMaterial3D_7p762") mesh = SubResource("CylinderMesh_c10un") skeleton = NodePath("../..") -[node name="Decal" type="Decal" parent="ColorWheel/MeshInstance3D"] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.005, 0) -size = Vector3(0.15, 0.001, 0.15) -texture_albedo = ExtResource("7_ximu1") - [node name="Clickable" type="Node" parent="ColorWheel"] script = ExtResource("8_1sfll") diff --git a/content/functions/occludable.gd b/content/functions/occludable.gd index 12ff57c..e0bf7a2 100644 --- a/content/functions/occludable.gd +++ b/content/functions/occludable.gd @@ -12,6 +12,10 @@ func _ready(): EventSystem.on_slow_tick.connect(_slow_tick) func _slow_tick(_delta): + if player_camera.is_inside_tree() == false: + printerr("Player camera is not inside the tree") + return + ray.target_position = get_parent().to_local(player_camera.global_position) get_parent().visible = ray.is_colliding() == false diff --git a/content/main.gd b/content/main.gd index bc873e1..f46b74a 100644 --- a/content/main.gd +++ b/content/main.gd @@ -16,6 +16,7 @@ func _ready(): if OS.get_name() == "Android": # OS.request_permissions() environment.environment.sky.set_material(sky_passthrough) + get_viewport().transparent_bg = true else: RenderingServer.set_debug_generate_wireframes(true) diff --git a/export_presets.cfg b/export_presets.cfg index 468efad..ff4c5b1 100644 --- a/export_presets.cfg +++ b/export_presets.cfg @@ -248,7 +248,7 @@ architectures/armeabi-v7a=false architectures/arm64-v8a=true architectures/x86=false architectures/x86_64=false -version/code=10 +version/code=11 version/name="v0.3.1" package/unique_name="de.nitwel.$genname" package/name="Immersive Home" diff --git a/project.godot b/project.godot index a278986..0ca5bc8 100644 --- a/project.godot +++ b/project.godot @@ -25,6 +25,10 @@ EventSystem="*res://lib/globals/event_system.gd" Store="*res://lib/globals/main_store.gd" House="*res://lib/globals/house_body.gd" +[display] + +window/vsync/vsync_mode=0 + [editor_plugins] enabled=PackedStringArray("res://addons/godot-xr-tools/plugin.cfg", "res://addons/godotopenxrvendors/plugin.cfg") @@ -59,13 +63,17 @@ common/physics_ticks_per_second=30 [rendering] -renderer/rendering_method="mobile" +renderer/rendering_method="gl_compatibility" +renderer/rendering_method.mobile="gl_compatibility" textures/vram_compression/import_etc2_astc=true lights_and_shadows/directional_shadow/soft_shadow_filter_quality=4 lights_and_shadows/directional_shadow/soft_shadow_filter_quality.mobile=4 +viewport/transparent_background=true [xr] openxr/enabled=true +openxr/foveation_level=1 +openxr/foveation_dynamic=true openxr/startup_alert=false shaders/enabled=true