godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
90.83k stars 21.14k forks source link

Occlusion culling will fail if REAL_T_IS_DOUBLE is defined by compiling with precision=double #94638

Open jamie-pate opened 3 months ago

jamie-pate commented 3 months ago

Tested versions

not reproducible in standard builds, REAL_T_IS_DOUBLE is not defined by default. The engine needs to be compiled with precision=double to test this

System information

Godot v4.3.dev (cb5d78ed3) - Ubuntu 22.04.4 LTS 22.04 - X11 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3050 Laptop GPU () - 12th Gen Intel(R) Core(TM) i7-12700H (14 Threads)

Issue description

REAL_T_IS_DOUBLE will not work with embree occlusion culling (as of godot 4.3-beta3) Godot passes RTC_FORMAT_FLOAT3 without checking if REAL_T_IS_DOUBLE is defined.

There doesn't seem to be a type flag for doubles so the Vector3 type would need to be converted to float[3] when precision is double.

Steps to reproduce

enable occlusion culling and compile with precision=double. The Vector3 type becomes double[3] but calls still pass RTC_FORMAT_FLOAT3

Minimal reproduction project (MRP)

icon

Calinou commented 3 months ago

I can confirm this on 4.3.rc 2f2d1a7e68d315e5f26cde30532a51087536c9f6 (Windows, MSVC 2022), even at the world origin. It works on the same configuration with precision=single.

Minimal reproduction project: test_occlusion_culling_double_precision.zip Select nodes in the Scene tree dock, then press F in the 3D viewport to focus on nodes that are far away from the world origin.