Blender crashes if simplify is turned on while baking multires #91171

Closed
opened 2021-09-03 18:21:41 +02:00 by Diogo Valadares Reis dos Santos · 13 comments

System Information
Operating system: Windows-10-10.0.19041-SP0 64 Bits
Graphics card: AMD Radeon RX 5700 XT ATI Technologies Inc. 4.5.14742 Core Profile Context 21.7.2 27.20.22021.1002

Blender Version
Broken: version: 3.0.0 Alpha, branch: master, commit date: 2021-09-02 14:26, hash: 6fc92b296f
Worked: --

Short description of error

Blender crashes if simplify is turned on while baking multires data

Exact steps for others to reproduce the error

  • Grab any object and add multiresolution to if, subdivide at least once.
  • Activate simplify, and turn the max subdivisions on viewport to 0
  • Create a material and try to bake the multiresolution. Blender will crash instead of giving an error message or just baking normally

Test File:
multires_crash.blend

**System Information** Operating system: Windows-10-10.0.19041-SP0 64 Bits Graphics card: AMD Radeon RX 5700 XT ATI Technologies Inc. 4.5.14742 Core Profile Context 21.7.2 27.20.22021.1002 **Blender Version** Broken: version: 3.0.0 Alpha, branch: master, commit date: 2021-09-02 14:26, hash: `6fc92b296f` Worked: -- **Short description of error** Blender crashes if simplify is turned on while baking multires data **Exact steps for others to reproduce the error** - Grab any object and add multiresolution to if, subdivide at least once. - Activate simplify, and turn the max subdivisions on viewport to 0 - Create a material and try to bake the multiresolution. Blender will crash instead of giving an error message or just baking normally Test File: [multires_crash.blend](https://archive.blender.org/developer/F10376924/multires_crash.blend)

Added subscriber: @Diogo_Valadares

Added subscriber: @Diogo_Valadares

Added subscriber: @ThomasDinges

Added subscriber: @ThomasDinges

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

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

Can confirm the crash. multires_crash.blend

Just click on Bake.

Can confirm the crash. [multires_crash.blend](https://archive.blender.org/developer/F10376924/multires_crash.blend) Just click on Bake.
Member

Added subscriber: @leesonw

Added subscriber: @leesonw
Member

It seems to give the following assert when running a debug build

BLI_assert failed: source/blender/blenkernel/intern/mesh_tangent.c:709, BKE_mesh_calc_loop_tangent_ex(), at 'tangent_mask_curr == tangent_mask'

the call stack is in P2504

the above assert does not happen when simplify is switched off so I am guessing this is the root of the problem.

It seems to give the following assert when running a debug build BLI_assert failed: source/blender/blenkernel/intern/mesh_tangent.c:709, BKE_mesh_calc_loop_tangent_ex(), at 'tangent_mask_curr == tangent_mask' the call stack is in [P2504](https://archive.blender.org/developer/P2504.txt) the above assert does not happen when simplify is switched off so I am guessing this is the root of the problem.
Member

This also seems to crash on 2.93 and 2.83 so this seems to go way back :-) There is a bunch of tangent stuff right before this that could possible be the reason (see below). Anyone got a really old version they could test?

commit 429f6bee28
Author: Campbell Barton ideasman42@gmail.com
Date: Wed May 24 22:33:21 2017 +1000

  Fix T51561: Normal maps fail w/ quad + eevee
  
  Generalize derived-mesh tangent calculation so
  it can be used by Batch cache creation too.

commit a6c60affff
Merge: 60a099fb09 d252ac6b95
Author: Campbell Barton ideasman42@gmail.com
Date: Wed May 24 21:16:54 2017 +1000

  Merge branch 'master' into blender2.8

commit d252ac6b95
Author: Campbell Barton ideasman42@gmail.com
Date: Wed May 24 21:13:32 2017 +1000

  Fix possible invalid normal use w/ tangent calc
  
  Was using MFace normals, not MPoly
This also seems to crash on 2.93 and 2.83 so this seems to go way back :-) There is a bunch of tangent stuff right before this that could possible be the reason (see below). Anyone got a really old version they could test? commit 429f6bee2845489a82983b54b6d63cc260a76387 Author: Campbell Barton <ideasman42@gmail.com> Date: Wed May 24 22:33:21 2017 +1000 ``` Fix T51561: Normal maps fail w/ quad + eevee Generalize derived-mesh tangent calculation so it can be used by Batch cache creation too. ``` commit a6c60affffc99270e94a123092d8b9c0942cccaa Merge: 60a099fb095 d252ac6b952 Author: Campbell Barton <ideasman42@gmail.com> Date: Wed May 24 21:16:54 2017 +1000 ``` Merge branch 'master' into blender2.8 ``` commit d252ac6b9528d60b1235e095888f91e202ac4399 Author: Campbell Barton <ideasman42@gmail.com> Date: Wed May 24 21:13:32 2017 +1000 ``` Fix possible invalid normal use w/ tangent calc Was using MFace normals, not MPoly

Anyone got a really old version they could test?

it goes wayy back to 2.8, honestly I had this bug for some time but I didn't think it was this old.

I thought about trying this in blender 2.79b, but I didn't find simplify neither bake from multires because it seems neither of them had been implemented before 2.8: https:*docs.blender.org/manual/en/2.79/render/cycles/render_settings/simplify.html ; https:*docs.blender.org/manual/en/2.79/render/cycles/baking.html

So basically it has been broken since it was implemented I guess.

> Anyone got a really old version they could test? it goes wayy back to 2.8, honestly I had this bug for some time but I didn't think it was this old. I thought about trying this in blender 2.79b, but I didn't find simplify neither bake from multires because it seems neither of them had been implemented before 2.8: https:*docs.blender.org/manual/en/2.79/render/cycles/render_settings/simplify.html ; https:*docs.blender.org/manual/en/2.79/render/cycles/baking.html So basically it has been broken since it was implemented I guess.
Member

Certainly seems that way.

Certainly seems that way.
Philipp Oeser removed the
Interest
Render & Cycles
label 2023-02-09 14:03:00 +01:00
Member

Think I have an idea how to fix, will put on my desk.

Think this should be high prio as well (since it is a crasher that is not too unlikely to run into).

Think I have an idea how to fix, will put on my desk. Think this should be high prio as well (since it is a crasher that is not too unlikely to run into).
Philipp Oeser self-assigned this 2024-03-01 18:22:14 +01:00
Philipp Oeser added
Priority
High
and removed
Priority
Normal
labels 2024-03-01 18:22:23 +01:00
Member

Situation turned out to be more complicated, will leave my notes, but step down for now...

  • Creating the highres and lowres happens with default MultiresFlags
    -- that means it is not taking the render settings for getting the (multires_get_level/get_render_subsurf_level), but always the viewport settings from simplify, is that what we want?
    -- should we possibly use MULTIRES_USE_RENDER_PARAMS for baking?
  • If simplify (with zero subdivisions) is used, we run into crashes (releasing a DerivedMesh that is still in use -- as reported here)
    -- would it possibly make sense to just use MULTIRES_IGNORE_SIMPLIFY? Or would you think people are relying on simplify for baking?
Situation turned out to be more complicated, will leave my notes, but step down for now... - Creating the highres and lowres happens with default `MultiresFlags` -- that means it is not taking the render settings for getting the (multires_get_level/get_render_subsurf_level), but always the viewport settings from simplify, is that what we want? -- should we possibly use `MULTIRES_USE_RENDER_PARAMS` for baking? - If simplify (with zero subdivisions) is used, we run into crashes (releasing a DerivedMesh that is still in use -- as reported here) -- would it possibly make sense to just use `MULTIRES_IGNORE_SIMPLIFY`? Or would you think people are relying on simplify for baking?
Philipp Oeser removed their assignment 2024-03-04 15:20:35 +01:00

I think using MULTIRES_IGNORE_SIMPLIFY for baking is correct. Simplify is mainly meant as a feature to speed up viewport drawing and renders, not so much to affect the behavior of tools. If just using that flag works, it seems like a good fix.

The multires baking usage of viewport and renders levels may be confusing, but best not to touch that since that would break compatibility and potentially some use cases.

I think using `MULTIRES_IGNORE_SIMPLIFY` for baking is correct. Simplify is mainly meant as a feature to speed up viewport drawing and renders, not so much to affect the behavior of tools. If just using that flag works, it seems like a good fix. The multires baking usage of viewport and renders levels may be confusing, but best not to touch that since that would break compatibility and potentially some use cases.

Fixed in d08f63e7cb.

Fixed in d08f63e7cb86f9850ccf9592761ff6c5e0540ced.
Brecht Van Lommel added
Status
Resolved
and removed
Status
Confirmed
labels 2024-03-06 18:05:10 +01:00
Blender Bot added
Status
Archived
and removed
Status
Resolved
labels 2024-03-06 18:06:13 +01:00
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
5 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#91171
No description provided.