Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lightmap baking crashes the engine when baking a certain mesh #45529

Closed
xtremezero opened this issue Jan 28, 2021 · 6 comments
Closed

Lightmap baking crashes the engine when baking a certain mesh #45529

xtremezero opened this issue Jan 28, 2021 · 6 comments

Comments

@xtremezero
Copy link

**Godot version:3.2.4.rc.1

OS/device including version: Linux 5.4.89-1-MANJARO x86_64 - GNU/Linux
GPU: GTX1070, Nvidia driver 460.32.03, GLES3

Issue description:
When baking a certain mesh, the engine crashes and produce an error

ERROR: operator[]: FATAL: Index p_index = 4 is out of bounds (count = 4).
   At: ./core/local_vector.h:163.
handle_crash: Program crashed with signal 4
Dumping the backtrace. Please include this when reporting the bug on https://github.com/godotengine/godot/issues
[1] /usr/lib/libc.so.6(+0x3d6a0) [0x7fcc8e27f6a0] (??:0)
[2] /home/mohammedzero43/Downloads/Godot_v3.2.4-rc1_x11.64() [0x2c011af] (<artificial>:?)
[3] /home/mohammedzero43/Downloads/Godot_v3.2.4-rc1_x11.64() [0x2be226c] (<artificial>:?)
[4] /home/mohammedzero43/Downloads/Godot_v3.2.4-rc1_x11.64() [0x2be22d6] (<artificial>:?)
[5] /home/mohammedzero43/Downloads/Godot_v3.2.4-rc1_x11.64() [0x26f1ab0] (<artificial>:?)
[6] /usr/lib/libpthread.so.0(+0x93e9) [0x7fcc8ded93e9] (??:0)
[7] /usr/lib/libc.so.6(clone+0x43) [0x7fcc8e342293] (??:0)
-- END OF BACKTRACE --

Steps to reproduce:
1- Select Lightmapper
2- Press Bake

Minimal reproduction project:
PLEASE RENAME THE ARCHIVE TO "LightMapBug3.2.4.rc1.7z" (remove ".zip" extention)

LightMapBug3.2.4.rc1.7z.zip

@akien-mga
Copy link
Member

Confirmed with the MRP on Linux, here's a backtrace from a debug build:

ERROR: operator[]: FATAL: Index p_index = 4 is out of bounds (count = 4).
   At: ./core/local_vector.h:163.

Thread 26 "godot-3.2" received signal SIGILL, Illegal instruction.
[Switching to Thread 0x7fffbd1ee640 (LWP 1529165)]
0x0000000001ba21e1 in LocalVector<int, unsigned int, false>::operator[] (this=0x14f97580, p_index=4) at ./core/local_vector.h:163
163                     CRASH_BAD_UNSIGNED_INDEX(p_index, count);
(gdb) bt
#0  0x0000000001ba21e1 in LocalVector<int, unsigned int, false>::operator[] (this=0x14f97580, p_index=4) at ./core/local_vector.h:163
#1  0x0000000001b95e21 in LightmapperCPU::_plot_triangle (this=0x1496acc0, p_vertices=0x155bc510, p_positions=0x151a0610, p_normals=0x153a0630, p_uvs=0x159fc630, p_albedo=..., p_emission=..., p_size=..., 
    r_lightmap=..., r_lightmap_indices=...) at modules/lightmapper_cpu/lightmapper_cpu.cpp:496
#2  0x0000000001b9404a in LightmapperCPU::_generate_buffer (this=0x1496acc0, p_idx=0, p_unused=0x0) at modules/lightmapper_cpu/lightmapper_cpu.cpp:314
#3  0x0000000001b936c6 in LightmapperCPU::_thread_func_wrapper (this=0x1496acc0, p_idx=0, p_thread_data=0x7fffffff8be0) at modules/lightmapper_cpu/lightmapper_cpu.cpp:220
#4  0x0000000001ba4e18 in ThreadArrayProcessData<LightmapperCPU, LightmapperCPU::ThreadData*>::process (this=0x7fffbd1edc50, p_index=0) at ./core/os/threaded_array_processor.h:49
#5  0x0000000001ba1d8f in thread_process_array<LightmapperCPU, void (LightmapperCPU::*)(unsigned int, LightmapperCPU::ThreadData*), LightmapperCPU::ThreadData*> (p_elements=1, p_instance=0x1496acc0, p_method=
    (void (LightmapperCPU::*)(LightmapperCPU * const, unsigned int, LightmapperCPU::ThreadData *)) 0x1b9363a <LightmapperCPU::_thread_func_wrapper(unsigned int, LightmapperCPU::ThreadData*)>, 
    p_userdata=0x7fffffff8be0) at ./core/os/threaded_array_processor.h:76
#6  0x0000000001b93636 in LightmapperCPU::_thread_func_callback (p_thread_data=0x7fffffff8be0) at modules/lightmapper_cpu/lightmapper_cpu.cpp:211
#7  0x0000000002787ef9 in ThreadPosix::thread_callback (userdata=0x147e18f0) at drivers/unix/thread_posix.cpp:74
#8  0x00007ffff7c1cdea in start_thread () from /lib64/libpthread.so.0
#9  0x00007ffff781d81f in clone () from /lib64/libc.so.6

@NHodgesVFX
Copy link
Contributor

@JFonS mentions he has a fix here #45296 (comment)

@xtremezero
Copy link
Author

@NHodgesVFX a simple fix was to simply Unwrap UV2 in the engine, but the error reason is unknown, that's why I posted it

@xtremezero xtremezero changed the title Lightmapping baking crashes the engine when baking a certain mesh Lightmap baking crashes the engine when baking a certain mesh Jan 29, 2021
@akien-mga
Copy link
Member

Fixed by #45752.

@TokisanGames
Copy link
Contributor

I get this error on a tree mesh that uses a detail mask with UV2, which crashes the engine. The UV2 map is scaled up quite large, which works fine in blender and in the godot material.

image

If I remake the UV2 layer in Godot, it allows the mesh to be baked but the result is very dark and splotchy like the tree has burned, and the detail mask has been destroyed. And trees that are not marked for baked lighting now glow.

image

I can lighten up the dark tree by forcing the environment min light, but I'm sure that has ramifications I don't want. And the UV maps are still messed up.

Godot Engine v3.4.beta.custom_build.0b4080ba4 - https://godotengine.org
OpenGL ES 3.0 Renderer: NVIDIA GeForce GTX 1060/PCIe/SSE2
Win10/64

@Calinou
Copy link
Member

Calinou commented Jul 25, 2021

@tinmanjuggernaut Please open a new issue with a minimal reproduction project attached.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants