Page MenuHome

Crash Baking Dynamic Paint using Liquid Simulation as Brush
Closed, ResolvedPublicBUG


System Information
Operating system: Windows-10-10.0.18362-SP0 64 Bits
Graphics card: GeForce MX150/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 445.75

Blender Version
Broken: version: 2.83 (sub 11), branch: master, commit date: 2020-03-24 23:23, hash: rB188ccfb0dd67
Worked: never

Short description of error
[Please fill out a short description of the error here]
Blender Crashes while baking dynamic paint if liquid simulation is used as a brush. If you use a plane or a cube as a canvas and priviously midified it with sculpting -> dyntopo enabled the baking makes blender crash. Once you set up everything and click bake on the dynamic paint the cpu will be of maximum usage and the process bar stops at 2% and then crashes after a while. No image will be baked.
Also testet on Windows 10 with Intel i7 6700K and NVIDIA GTX 970 same result (Blender crashed)

Interstlingly enough, it seems to work normal if the dyntopo isn't used and it was just modified with the normal brushes. Maybe the extra geometry added with dyntopo caused the crash.

Exact steps for others to reproduce the error
[Please describe the exact steps needed to reproduce the issue]
[Based on the default startup or an attached .blend file (as simple as possible)]
Open attached blend.file
Bake the Liquid Simulation
Go to the Plane and to the dynamic paint setting and click bake image sequence


Event Timeline

Can not read memory of l1

blender.exe!closest_to_line_v2(float * r_close, const float * p, const float * l1, const float * l2) Line 3266 C

	blender.exe!closest_to_line_segment_v2(float * r_close, const float * p, const float * l1, const float * l2) Line 362	C
	blender.exe!dist_squared_to_line_segment_v2(const float * p, const float * l1, const float * l2) Line 346	C
	blender.exe!dist_squared_to_looptri_uv_edges(const MLoopTri * mlooptri, const MLoopUV * mloopuv, int tri_index, const float * point) Line 2441	C
	blender.exe!dynamic_paint_find_island_border(const DynamicPaintCreateUVSurfaceData * data, DynamicPaintFindIslandBorderData * bdata, int tri_index, const float * pixel, int in_edge, int depth) Line 2711	C
	blender.exe!dynamic_paint_find_neighbor_pixel(const DynamicPaintCreateUVSurfaceData * data, const MeshElemMap * vert_to_looptri_map, const int w, const int h, const int px, const int py, const int n_index) Line 2539	C
	blender.exe!dynamicPaint_createUVSurface(Scene * scene, DynamicPaintSurface * surface, float * progress, short * do_update) Line 3027	C
	blender.exe!dynamicPaint_bakeImageSequence(DynamicPaintBakeJob * job) Line 385	C
	blender.exe!dpaint_bake_startjob(void * customdata, short * stop, short * do_update, float * progress) Line 469	C
	blender.exe!do_job_thread(void * job_v) Line 397	C
	[External Code]
Richard Antalik (ISS) changed the task status from Needs Triage to Confirmed.Mar 26 2020, 4:43 PM
Richard Antalik (ISS) updated the task description. (Show Details)
Germano Cavalcante (mano-wii) changed the subtype of this task from "Report" to "Bug".Mar 26 2020, 6:28 PM

Part of the reason for the crash is probably the dependency cycle:

Dependency cycle detected:
  OBCube.002/Geometry Component/GEOMETRY_EVAL() depends on
  OBPlane/Geometry Component/GEOMETRY_EVAL() via 'Fluid Effector'
  OBCube.002/Geometry Component/GEOMETRY_EVAL() via 'Dynamic Paint Brush'
Dependency cycle detected:
  OBCube.002/PointCache Component/POINT_CACHE_RESET() depends on
  OBPlane/Geometry Component/GEOMETRY_EVAL() via 'Point Cache'
  OBCube.002/Geometry Component/GEOMETRY_EVAL() via 'Dynamic Paint Brush'
  OBCube.002/PointCache Component/POINT_CACHE_RESET() via 'Point Cache -> Geometry'
Detected 2 dependency cycles

However, it still should not crash.

With this is it does not crash anymore. But I do not know yet, what is actually happening there.

diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c
index a704e199007..2ec9c9bda73 100644
--- a/source/blender/blenkernel/intern/dynamicpaint.c
+++ b/source/blender/blenkernel/intern/dynamicpaint.c
@@ -2701,15 +2701,16 @@ static void dynamic_paint_find_island_border(const DynamicPaintCreateUVSurfaceDa
+    int final_tri_index = tempPoints[final_index].tri_index;
     /* If found pixel still lies on wrong face ( mesh has smaller than pixel sized faces) */
-    if (tempPoints[final_index].tri_index != target_tri) {
+    if (final_tri_index != target_tri && final_tri_index >= 0) {
       /* Check if it's close enough to likely touch the intended triangle. Any triangle
        * becomes thinner than a pixel at its vertices, so robustness requires some margin. */
       const float final_pt[2] = {((final_index % w) + 0.5f) / w, ((final_index / w) + 0.5f) / h};
       const float threshold = square_f(0.7f) / (w * h);
-      if (dist_squared_to_looptri_uv_edges(
-              mlooptri, mloopuv, tempPoints[final_index].tri_index, final_pt) > threshold) {
+      if (dist_squared_to_looptri_uv_edges(mlooptri, mloopuv, final_tri_index, final_pt) >
+          threshold) {