Page MenuHome

Quadriflow crash running on a messy mesh
Closed, ResolvedPublic

Description

System Information
Operating system: Windows 10

Blender Version
Broken: blender-2.81-c8df6f2cf9df-windows64

Exact steps for others to reproduce the error


Open the blend file ➞ Go to the object data tab ➞ Remesh ➞ Quad ➞ Click the "Quadriflow Remesh" button ➞ Click "Ok" in the quadriflow remesh popup ➞ crash in few seconds

That messy mesh is a result of a mask extraction. Then I decided to run quadriflow on it and I find out that it crashes all the time.

Event Timeline

Demeter Dzadik (Mets) lowered the priority of this task from 90 to 80.Sep 20 2019, 9:30 AM

Windows-10-10.0.14393 64 Bits
GeForce GTX 1070/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 436.02
rB0547a7753643

I could reproduce.

Pinging @Sebastian Parborg (zeddb)

Philipp Oeser (lichtwerk) lowered the priority of this task from 80 to 50.

ASAN shows a warning that might be related: /extern/quadriflow/src/hierarchy.cpp:272:48: runtime error: division by zero

It's really weird, I run the remesh operator in a Debug and a RelWithDebInfo build with ASAN. In all cases the crash seems to be caused by some code that handles audio.

I have no idea if this is really related, but it seems like so.

/home/jacques/blender-git/blender/extern/quadriflow/src/hierarchy.cpp:272:48: runtime error: division by zero
wrong init 11795 12113!
/home/jacques/blender-git/blender/extern/audaspace/bindings/C/AUD_Device.cpp:224:23: runtime error: member call on null pointer of type 'struct element_type'
ASAN:DEADLYSIGNAL
=================================================================
==19761==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x55d4ab29f7df bp 0x000000000000 sp 0x7ffc3437d6b0 T0)
==19761==The signal is caused by a READ memory access.
==19761==Hint: address points to the zero page.
    #0 0x55d4ab29f7de in AUD_Device_getRate /home/jacques/blender-git/blender/extern/audaspace/bindings/C/AUD_Device.cpp:224
    #1 0x55d4a29d7590 in BKE_sound_scene_playing /home/jacques/blender-git/blender/source/blender/blenkernel/intern/sound.c:868
    #2 0x55d4a35e3873 in wm_event_do_handlers /home/jacques/blender-git/blender/source/blender/windowmanager/intern/wm_event_system.c:3278
    #3 0x55d4a35bee2f in WM_main /home/jacques/blender-git/blender/source/blender/windowmanager/intern/wm.c:417
    #4 0x55d4a231c2cb in main /home/jacques/blender-git/blender/source/creator/creator.c:491
    #5 0x7f3d0c802b96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
    #6 0x55d4a2371859 in _start (/home/jacques/blender-git/build_linux/bin/blender+0xda57859)

The issue here is that the mesh is non manifold. Even the voxel remesher has issues with the mesh provided.

I will try to add check to prevent quadriflow from running if the mesh is non manifold.

The issue here is that the mesh is non manifold …

The Suzanne disagrees:

@Martin Capitanio (capnm) it does work with boundaries of course (otherwise the "preserve boundary" option would not be there).

It does occasionally work with non boundary non manifold edges, but it has a high probability of crashing as the quadriflow code assumes that an edge can only have a maximum of two connected faces.

the quadriflow code assumes that an edge can only have a maximum of two connected faces.

Ah, I see. Would not it be possible to stop the action instead of crashing?

FYI if I do what the comment says,

diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c
index 6cbb01861e2..7e3b0d363a0 100644
--- a/source/blender/blenkernel/intern/sound.c
+++ b/source/blender/blenkernel/intern/sound.c
@@ -865,6 +865,11 @@ int BKE_sound_scene_playing(Scene *scene)
   }
 
   // in case of a "Null" audio device, we have no playback information
+  if (sound_device == NULL) {
+    perror("bad");
+    return -1;
+  }
+
   if (AUD_Device_getRate(sound_device) == AUD_RATE_INVALID) {
     return -1;
   }

it's running (50%) a bit further, perhaps also some multi-threading issue with the progress bar?

[Unknown/Just-In-Time compiled code] (Unknown Source:0)
GHOST_WindowX11::setProgressBar(GHOST_WindowX11 * const this, float progress) (intern/ghost/intern/GHOST_WindowX11.cpp:1608)
wm_jobs_update_progress_bars() (source/blender/windowmanager/intern/wm_jobs.c:260)
wm_jobs_timer(const bContext * C, wmWindowManager * wm, wmTimer * wt) (source/blender/windowmanager/intern/wm_jobs.c:709)
wm_window_timer(const bContext * C) (source/blender/windowmanager/intern/wm_window.c:1538)
wm_window_process_events(const bContext * C) (source/blender/windowmanager/intern/wm_window.c:1576)
WM_main(bContext * C) (source/blender/windowmanager/intern/wm.c:414)
main(int argc, const char ** argv) (source/creator/creator.c:491)

Yes, I suspect that the error you get is an issue with the background job system I'm using for quadriflow.

I must admit that I can't reproduce the crash in the sound system on my end.
What sound system backend are you using?

What sound system backend are you using?

libopenal.so.1!alcCloseDevice (Unknown Source:0)
aud::OpenALDevice::~OpenALDevice(aud::OpenALDevice * const this) (extern/audaspace/plugins/openal/OpenALDevice.cpp:1200)
aud::OpenALDevice::~OpenALDevice(aud::OpenALDevice * const this) (extern/audaspace/plugins/openal/OpenALDevice.cpp:1201)
std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release(std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2> * const this) (/usr/include/c++/7/bits/shared_ptr_base.h:154)
std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count() (/usr/include/c++/7/bits/shared_ptr_base.h:684)
std::__shared_ptr<aud::IDevice, (__gnu_cxx::_Lock_policy)2>::~__shared_ptr() (/usr/include/c++/7/bits/shared_ptr_base.h:1123)
std::__shared_ptr<aud::IDevice, (__gnu_cxx::_Lock_policy)2>::operator=(std::__shared_ptr<aud::IDevice, (__gnu_cxx::_Lock_policy)2> * const this) (/usr/include/c++/7/bits/shared_ptr_base.h:1213)
std::shared_ptr<aud::IDevice>::operator=(std::shared_ptr<aud::IDevice> * const this) (/usr/include/c++/7/bits/shared_ptr.h:319)
aud::DeviceManager::releaseDevice() (extern/audaspace/src/devices/DeviceManager.cpp:81)
BKE_sound_exit_once() (source/blender/blenkernel/intern/sound.c:333)
libc.so.6!__run_exit_handlers(int status, struct exit_function_list ** listp, _Bool run_list_atexit, _Bool run_dtors) (/build/glibc-OTsEL5/glibc-2.27/stdlib/exit.c:108)
libc.so.6!__GI_exit(int status) (/build/glibc-OTsEL5/glibc-2.27/stdlib/exit.c:139)
qflow::subdivide_edgeDiff(Eigen::MatrixXi & F, Eigen::MatrixXd & V, Eigen::MatrixXd & N, Eigen::MatrixXd & Q, Eigen::MatrixXd & O, Eigen::MatrixXd * S, Eigen::VectorXi & V2E, Eigen::VectorXi & E2E, Eigen::VectorXi & boundary, Eigen::VectorXi & nonmanifold, std::vector<Eigen::Matrix<int, 2, 1, 0, 2, 1>, std::allocator<Eigen::Matrix<int, 2, 1, 0, 2, 1> > > & edge_diff, std::vector<qflow::DEdge, std::allocator<qflow::DEdge> > & edge_values, std::vector<Eigen::Matrix<int, 3, 1, 0, 3, 1>, std::allocator<Eigen::Matrix<int, 3, 1, 0, 3, 1> > > & face_edgeOrients, std::vector<Eigen::Matrix<int, 3, 1, 0, 3, 1>, std::allocator<Eigen::Matrix<int, 3, 1, 0, 3, 1> > > & face_edgeIds, std::vector<int, std::allocator<int> > & sharp_edges, std::map<int, int, std::less<int>, std::allocator<std::pair<int const, int> > > & singularities, int max_len) (extern/quadriflow/src/subdivide.cpp:504)
qflow::Parametrizer::ComputeIndexMap(qflow::Parametrizer * const this, int with_scale) (extern/quadriflow/src/parametrizer.cpp:83)
QFLOW_quadriflow_remesh(QuadriflowRemeshData * qrd, void (*)(void *, float, int *) update_cb, void * update_cb_data) (intern/quadriflow/quadriflow_capi.cpp:210)
BKE_mesh_remesh_quadriflow(void * update_cb_data, void * update_cb, _Bool adaptive_scale, _Bool preserve_boundary, _Bool preserve_sharp, int seed, int target_faces, Mesh * input_mesh) (source/blender/blenkernel/intern/mesh_remesh_voxel.c:212)
BKE_mesh_remesh_quadriflow_to_mesh_nomain(Mesh * mesh, int target_faces, int seed, _Bool preserve_sharp, _Bool preserve_boundary, _Bool adaptive_scale, void * update_cb, void * update_cb_data) (source/blender/blenkernel/intern/mesh_remesh_voxel.c:274)
quadriflow_start_job(void * customdata, short * stop, short * do_update, float * progress) (source/blender/editors/object/object_remesh.c:244)
do_job_thread(void * job_v) (source/blender/windowmanager/intern/wm_jobs.c:383)
libpthread.so.0!start_thread(void * arg) (/build/glibc-OTsEL5/glibc-2.27/nptl/pthread_create.c:463)
libc.so.6!clone() (/build/glibc-OTsEL5/glibc-2.27/sysdeps/unix/sysv/linux/x86_64/clone.S:95)

And it crashes still if you use Null or SDL?

Edit: it will exit from quadriflow because it can't handle the mesh still, just to be clear.

And it crashes still if you use Null or SDL?

I didn't compiled the SDL m…
It crashes with null or openal soft:

Aha, I see what is happening now. It is just crashing after quadriflow made a mess as it can't handle the non manifold data.
I've posted a fix here: https://developer.blender.org/D5877

But you already know, D5877 also cuts the many non-manifold cases where it works well :-/

Not really, it still supports borders. So I'm unsure which other cases you are talking about.

Not really, it still supports borders. So I'm unsure which other cases you are talking about.

The problem was that it worked before with the triangulation made small face in the nose
that I missed. In such cases, it does not seem to work now:


Those non manifold edges does not help with the remeshing and is undefined behavior that might crash quadriflow. I'm not really sure what you are trying to argue here.
Quadriflow specifically states that it only works on manifold meshes (except that border edges are somewhat supported).

Sure, it might have worked on some meshes, but that is basically pure luck.

Sorry. I have overlooked such face connected to manifold surroundings,
that worked with quadriflow but not with your patch,
so I first thought you removed the border support (the monkey in the middle).
If you say it's luck, it's better to avoid the crash, sure.

I tried to do remesh of objects with a single dimension, because as you can guess we could have big advantages in the repopology of entire surfaces and then be able to assemble them in a single object ... but the remesher hardly manages to keep the precise boundary and preserve sharps ...
it also destroys the holes, and in any case distorts them, while above all they should remain as faithful as possible to the original geometry.


@Sebastian Parborg (zeddb) Reasoning:
The algorithm should first scan the object, identify all the sharpen edges, divide the object into many objects made of hardsurfaces, remesh all of them, keeping the boundary edges precise to the boundary edges of the adjacent hardsurfaces, and then unify the surfaces into a single object by making a vertex merge.

I think it would be also really cool, if the quadflow remesh algorithm could create objects faithful to the original shape of objects made in subdivision surface.
so
original mesh = lowres remeshed object + sundivision surface.
;)
Greetings Masters