BLI_assert fails when applying camera image on mesh with subdivision modifier. #78198

Closed
opened 2020-06-24 10:46:08 +02:00 by Martijn Versteegh · 9 comments

System Information
Operating system:
Ubuntu eoan
Graphics card:
Nvidia GeForce GTX 760

Blender Version
Broken:
2.90.0 alpha ,61fa710aa3442, master, 2020-06-23
Worked:
Don't know, as I don't have a debug build of earlier versions available here.

Short description of error
When applying a camera image (with 'apply camera image') on a mesh with the subdivision surface modifier, an assert fails.

Exact steps for others to reproduce the error

  • Debug build of blender
  • default startup
  • add background image to camera (any image will do)
  • add a subdivision surface modifier to the cube
  • add a material to the cube with an image texture for the Base Color
  • go to texture paint mode
  • options->apply camera image

result:
BLI_assert failed: ~/blender-git/blender/source/blender/blenkernel/intern/DerivedMesh.c:896, mesh_calc_modifiers(), at '(mesh_input->id.tag & LIB_TAG_COPIED_ON_WRITE_EVAL_RESULT) == 0'
BLI_assert_failed_on_apply_camera_image_with_subsurf_mesh.blend

I attached a blend file set up to trigger the crash with the cube prepared with a material and and image packed to test it with.

**System Information** Operating system: Ubuntu eoan Graphics card: Nvidia GeForce GTX 760 **Blender Version** Broken: 2.90.0 alpha ,61fa710aa3442, master, 2020-06-23 Worked: Don't know, as I don't have a debug build of earlier versions available here. **Short description of error** When applying a camera image (with 'apply camera image') on a mesh with the subdivision surface modifier, an assert fails. **Exact steps for others to reproduce the error** - Debug build of blender - default startup - add background image to camera (any image will do) - add a subdivision surface modifier to the cube - add a material to the cube with an image texture for the Base Color - go to texture paint mode - options->apply camera image result: BLI_assert failed: ~/blender-git/blender/source/blender/blenkernel/intern/DerivedMesh.c:896, mesh_calc_modifiers(), at '(mesh_input->id.tag & LIB_TAG_COPIED_ON_WRITE_EVAL_RESULT) == 0' [BLI_assert_failed_on_apply_camera_image_with_subsurf_mesh.blend](https://archive.blender.org/developer/F8640229/BLI_assert_failed_on_apply_camera_image_with_subsurf_mesh.blend) I attached a blend file set up to trigger the crash with the cube prepared with a material and and image packed to test it with.
Author
Member

Added subscriber: @Baardaap

Added subscriber: @Baardaap
Member

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'
Member

Added subscriber: @JacquesLucke

Added subscriber: @JacquesLucke
Member

Just for quick reference, because it took me a while to find it ^^
image.png

This seems to solve the issue in this specific case, but might not be entirely correct:

diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c
index 5e3204b6d5a..1d137d71824 100644
--- a/source/blender/editors/sculpt_paint/paint_image_proj.c
+++ b/source/blender/editors/sculpt_paint/paint_image_proj.c
@@ -4057,7 +4057,7 @@ static bool proj_paint_state_mesh_eval_init(const bContext *C, ProjPaintState *p
   /* Workaround for subsurf selection, try the display mesh first */
   if (ps->source == PROJ_SRC_IMAGE_CAM) {
     /* using render mesh, assume only camera was rendered from */
-    ps->me_eval = mesh_create_eval_final_render(depsgraph, scene_eval, ob_eval, &cddata_masks);
+    ps->me_eval = mesh_create_eval_final_render(depsgraph, scene_eval, ob, &cddata_masks);
     ps->me_eval_free = true;
   }
   else {
Just for quick reference, because it took me a while to find it ^^ ![image.png](https://archive.blender.org/developer/F8640299/image.png) This seems to solve the issue in this specific case, but might not be entirely correct: ``` diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c index 5e3204b6d5a..1d137d71824 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.c +++ b/source/blender/editors/sculpt_paint/paint_image_proj.c @@ -4057,7 +4057,7 @@ static bool proj_paint_state_mesh_eval_init(const bContext *C, ProjPaintState *p /* Workaround for subsurf selection, try the display mesh first */ if (ps->source == PROJ_SRC_IMAGE_CAM) { /* using render mesh, assume only camera was rendered from */ - ps->me_eval = mesh_create_eval_final_render(depsgraph, scene_eval, ob_eval, &cddata_masks); + ps->me_eval = mesh_create_eval_final_render(depsgraph, scene_eval, ob, &cddata_masks); ps->me_eval_free = true; } else { ```
Author
Member

Yes, it's a bit hard to find :-). I hoped I was clear enough by writing 'options->apply camera image' but apparently not! Sorry!

Yes, it's a bit hard to find :-). I hoped I was clear enough by writing 'options->apply camera image' but apparently not! Sorry!
Author
Member

I'll try your possible fix and see if it also has any effect on the bug I was actually chasing while finding this one. (But which is too vague/unreproducible to report yet)

I'll try your possible fix and see if it also has any effect on the bug I was actually chasing while finding this one. (But which is too vague/unreproducible to report yet)

Closed as duplicate of #79714

Closed as duplicate of #79714

Added subscriber: @dr.sybren

Added subscriber: @dr.sybren

I merged this task into #79714 as that one has more info & a patch.

I merged this task into #79714 as that one has more info & a patch.
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#78198
No description provided.