godotengine / godot

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

Godot crashes in some cases importing .obj files that include objects that have no UV maps #97152

Open rubberduck9999 opened 1 day ago

rubberduck9999 commented 1 day ago

Tested versions

4.3

System information

Windows 10

Issue description

I encountered crashes exporting objects, originally ones that I modeled with the ND extension. I noticed that some objects there had no UV maps. I then experimented a bit with plain cubes, where I removed the UV map on one and had again a crash, in a brand new godot project even.

Steps to reproduce

try to open the MRP, it includes a basic godot project with the obj that leads godot to crash. it has also the blend file where I exported the cubes. Objects are inside collections, and somehow, in collection 4, which includes like the first collection - one object with and one without UV map, but the one from the 4th collection doesn't crash godot I also got this output when starting it with the windows console. Doesn't look that helpful though

Edit: I just something in the console that I have overseen

ERROR: UVs are required to generate tangents.
   at: (scene/resources/surface_tool.cpp:1161)
ERROR: FATAL: Index p_index = 2 is out of bounds (size() = 0).
   at: get (./core/templates/cowdata.h:205)

CrashHandlerException: Program crashed with signal 4
Engine version: Godot Engine v4.3.stable.official (77dcf97d82cbfe4e4615475fa52ca03da645dbd8)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[1] error(-1): no debug info in PE/COFF executable
[2] error(-1): no debug info in PE/COFF executable
[3] error(-1): no debug info in PE/COFF executable
[4] error(-1): no debug info in PE/COFF executable
[5] error(-1): no debug info in PE/COFF executable
[6] error(-1): no debug info in PE/COFF executable
[7] error(-1): no debug info in PE/COFF executable
[8] error(-1): no debug info in PE/COFF executable
[9] error(-1): no debug info in PE/COFF executable
[10] error(-1): no debug info in PE/COFF executable
[11] error(-1): no debug info in PE/COFF executable
[12] error(-1): no debug info in PE/COFF executable
[13] error(-1): no debug info in PE/COFF executable
[14] error(-1): no debug info in PE/COFF executable
[15] error(-1): no debug info in PE/COFF executable
[16] error(-1): no debug info in PE/COFF executable
[17] error(-1): no debug info in PE/COFF executable
[18] error(-1): no debug info in PE/COFF executable
[19] error(-1): no debug info in PE/COFF executable
[20] error(-1): no debug info in PE/COFF executable
[21] error(-1): no debug info in PE/COFF executable
[22] error(-1): no debug info in PE/COFF executable
[23] error(-1): no debug info in PE/COFF executable
-- END OF BACKTRACE --

Minimal reproduction project (MRP)

OBJ_Import_Crash.zip

anderlli0053 commented 1 day ago

Here is the crash dump:

godot.exe.7460.zip

matheusmdx commented 1 day ago

Bisecting points to #88738 as the culprit, @clayjohn

image

Backtrace ``` ERROR: Condition "!(format & Mesh::ARRAY_FORMAT_TEX_UV)" is true. at: SurfaceTool::generate_tangents (scene\resources\surface_tool.cpp:1151) ERROR: FATAL: Index p_index = 2 is out of bounds (size() = 0). at: CowData::get (C:\Users\Matheus\Downloads\Godot Source\core/templates/cowdata.h:205) ================================================================ CrashHandlerException: Program crashed Engine version: Godot Engine v4.3.dev.custom_build (ce994a453a44ae035a44a144996b160862b448b2) Dumping the backtrace. Please include this when reporting the bug to the project developer. [0] CowData::get (C:\Users\Matheus\Downloads\Godot Source\core\templates\cowdata.h:205) [1] Vector::operator[] (C:\Users\Matheus\Downloads\Godot Source\core\templates\vector.h:97) [2] _parse_obj (C:\Users\Matheus\Downloads\Godot Source\editor\import\3d\resource_importer_obj.cpp:424) [3] ResourceImporterOBJ::import (C:\Users\Matheus\Downloads\Godot Source\editor\import\3d\resource_importer_obj.cpp:577) [4] EditorFileSystem::_reimport_file (C:\Users\Matheus\Downloads\Godot Source\editor\editor_file_system.cpp:2132) [5] EditorFileSystem::reimport_files (C:\Users\Matheus\Downloads\Godot Source\editor\editor_file_system.cpp:2406) [6] EditorFileSystem::_update_scan_actions (C:\Users\Matheus\Downloads\Godot Source\editor\editor_file_system.cpp:701) [7] EditorFileSystem::_notification (C:\Users\Matheus\Downloads\Godot Source\editor\editor_file_system.cpp:1299) [8] EditorFileSystem::_notificationv (C:\Users\Matheus\Downloads\Godot Source\editor\editor_file_system.h:146) [9] Object::notification (C:\Users\Matheus\Downloads\Godot Source\core\object\object.cpp:848) [10] SceneTree::_process_group (C:\Users\Matheus\Downloads\Godot Source\scene\main\scene_tree.cpp:954) [11] SceneTree::_process (C:\Users\Matheus\Downloads\Godot Source\scene\main\scene_tree.cpp:1031) [12] SceneTree::process (C:\Users\Matheus\Downloads\Godot Source\scene\main\scene_tree.cpp:510) [13] Main::iteration (C:\Users\Matheus\Downloads\Godot Source\main\main.cpp:3972) [14] OS_Windows::run (C:\Users\Matheus\Downloads\Godot Source\platform\windows\os_windows.cpp:1476) [15] widechar_main (C:\Users\Matheus\Downloads\Godot Source\platform\windows\godot_windows.cpp:182) [16] _main (C:\Users\Matheus\Downloads\Godot Source\platform\windows\godot_windows.cpp:204) [17] main (C:\Users\Matheus\Downloads\Godot Source\platform\windows\godot_windows.cpp:218) [18] WinMain (C:\Users\Matheus\Downloads\Godot Source\platform\windows\godot_windows.cpp:232) [19] __scrt_common_main_seh (D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288) [20] -- END OF BACKTRACE -- ================================================================ ```