Decimate modifier gives different result on every evaluation #100250

Closed
opened 2022-08-06 21:04:07 +02:00 by Yegor · 18 comments

System Information
Operating system: Linux-5.4.0-122-generic-x86_64-with-glibc2.31 64 Bits
Graphics card: NVIDIA GeForce GTX 1080 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 470.129.06

Blender Version
Broken: version: 3.2.2, branch: master, commit date: 2022-08-02 18:15, hash: bcfdb14560, 3.3 latest
Broken: 3.1.2
Worked: 3.1.0
Worked: 2.93.8

Caused by fb2cb0324a

Short description of error
A mesh with decimate modifier gets topology rebuilt on each frame of Cycles render. Notice that a new cones object on the right is not broken.
There's something wrong with the left object. I checked every property I could think of.
0001-0250.mp4
decimate_bug.blend

Exact steps for others to reproduce the error
Open the file. Render a sequence.

**System Information** Operating system: Linux-5.4.0-122-generic-x86_64-with-glibc2.31 64 Bits Graphics card: NVIDIA GeForce GTX 1080 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 470.129.06 **Blender Version** Broken: version: 3.2.2, branch: master, commit date: 2022-08-02 18:15, hash: `bcfdb14560`, 3.3 latest Broken: 3.1.2 Worked: 3.1.0 Worked: 2.93.8 Caused by fb2cb0324a **Short description of error** A mesh with decimate modifier gets topology rebuilt on each frame of Cycles render. Notice that a new cones object on the right is not broken. There's something wrong with the left object. I checked every property I could think of. [0001-0250.mp4](https://archive.blender.org/developer/F13341291/0001-0250.mp4) [decimate_bug.blend](https://archive.blender.org/developer/F13341295/decimate_bug.blend) **Exact steps for others to reproduce the error** Open the file. Render a sequence.
Author

Added subscriber: @YegorSmirnov

Added subscriber: @YegorSmirnov

#101108 was marked as duplicate of this issue

#101108 was marked as duplicate of this issue
Author

Found a clue. If you change the shadow terminator geometry offset value, the mesh will wiggle in the viewport as well. But setting to 0 doesn't fix the problem on render.
image.png

Found a clue. If you change the shadow terminator geometry offset value, the mesh will wiggle in the viewport as well. But setting to 0 doesn't fix the problem on render. ![image.png](https://archive.blender.org/developer/F13341359/image.png)
Member

Added subscriber: @lichtwerk

Added subscriber: @lichtwerk
Member

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

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

Can confirm, will check

Can confirm, will check
Philipp Oeser changed title from Decimate modifier rebuilds the mesh on each frame to Cycles: Decimate modifier rebuilds the mesh on each frame 2022-08-08 14:01:05 +02:00
Brecht Van Lommel changed title from Cycles: Decimate modifier rebuilds the mesh on each frame to Decimate modifier gives different result on every evaluation 2022-08-08 14:29:25 +02:00

Added subscribers: @HooglyBoogly, @brecht

Added subscribers: @HooglyBoogly, @brecht

This is not a Cycles or rendering issue, anything to trigger the modifiers to be re-evaluated will change the result, like dragging the Factor slider in the modifier.

fb2cb0324a enabled multi-threaded vertex normal computation, which gives slightly different results each time due to different order or float addition, which gives different results due to limited precision. The decimation algorithm is sensitive to this.

This is not a Cycles or rendering issue, anything to trigger the modifiers to be re-evaluated will change the result, like dragging the Factor slider in the modifier. fb2cb0324a enabled multi-threaded vertex normal computation, which gives slightly different results each time due to different order or float addition, which gives different results due to limited precision. The decimation algorithm is sensitive to this.
Member

In #100250#1401522, @brecht wrote:
This is not a Cycles or rendering issue, anything to trigger the modifiers to be re-evaluated will change the result, like dragging the Factor slider in the modifier.

fb2cb0324a enabled multi-threaded vertex normal computation, which gives slightly different results each time due to different order or float addition, which gives different results due to limited precision. The decimation algorithm is sensitive to this.

OK, thx checking, just want to note that eevee does not suffer from this (and scratching my head why that is... that is why i was fooled into thinking this is a cycles issue)

> In #100250#1401522, @brecht wrote: > This is not a Cycles or rendering issue, anything to trigger the modifiers to be re-evaluated will change the result, like dragging the Factor slider in the modifier. > > fb2cb0324a enabled multi-threaded vertex normal computation, which gives slightly different results each time due to different order or float addition, which gives different results due to limited precision. The decimation algorithm is sensitive to this. OK, thx checking, just want to note that eevee does not suffer from this (and scratching my head why that is... that is why i was fooled into thinking this is a cycles issue)
Member

So is this something that will have no solution?
CC @HooglyBoogly

So is this something that will have no solution? CC @HooglyBoogly

Eevee animation render uses "persistent data" automatically, so the mesh is not recreated. So it's not an issue in that case, though if you e.g. distribute that over a render farm it's going to be an issue again.

I think it can be solved. The easy workaround would be to disable multi-threading for computing vertex normals in the decimate modifier.

Ideally vertex normal computation would give consistent results, and perhaps also eliminate the atomic operations. It could store the weighted face normals in an array per-loop, and then threads could sum them per-vertex in some consistent order. This is probably not very efficient though.

Decimation could round away some bits of the vertex normal to remove slight precision differences, though I'm not sure if this will be entirely reliable.

Eevee animation render uses "persistent data" automatically, so the mesh is not recreated. So it's not an issue in that case, though if you e.g. distribute that over a render farm it's going to be an issue again. I think it can be solved. The easy workaround would be to disable multi-threading for computing vertex normals in the decimate modifier. Ideally vertex normal computation would give consistent results, and perhaps also eliminate the atomic operations. It could store the weighted face normals in an array per-loop, and then threads could sum them per-vertex in some consistent order. This is probably not very efficient though. Decimation could round away some bits of the vertex normal to remove slight precision differences, though I'm not sure if this will be entirely reliable.
Member

Rounding away the lower bits in vertex normals for decimate sounds like a reasonable approach. I guess that would affect wherever normals are accessed in the decimate modifier.

For making computed normals more consistent, another approach would be caching vertex -> face corner and face corner -> face topology maps in the mesh.
That would be useful for lots of other operations too, and the memory requirement would just be like storing a second MLoop array.
Then the normal calculation would be a simple loop over those indices, without any atomics.
I'm not sure if that should be required for calculating normals though, the current method seems like it has a place too.

Rounding away the lower bits in vertex normals for decimate sounds like a reasonable approach. I guess that would affect wherever normals are accessed in the decimate modifier. For making computed normals more consistent, another approach would be caching vertex -> face corner and face corner -> face topology maps in the mesh. That would be useful for lots of other operations too, and the memory requirement would just be like storing a second MLoop array. Then the normal calculation would be a simple loop over those indices, without any atomics. I'm not sure if that should be required for calculating normals though, the current method seems like it has a place too.
Member

Added subscribers: @Deehn, @JacquesLucke, @iss, @sbchild

Added subscribers: @Deehn, @JacquesLucke, @iss, @sbchild

Added subscriber: @yebutno

Added subscriber: @yebutno

Ill just add that information in the opening post that claims 3.1 works is wrong. All 3.x versions have this bug, it is just that it is less severe in 3.1 and below. It works fine only if you go down to 2.93. I am attaching file with simple rock that is very sensitive to this quite frankly critical and workflow breaking bug. I simply use hotkeys to switch between object mode and sculpt mode and the rocks shape drastically changes. I don't understand how something this glaring goes unnoticed by users for so long.

rocks_test.blend

Ill just add that information in the opening post that claims 3.1 works is wrong. All 3.x versions have this bug, it is just that it is less severe in 3.1 and below. It works fine only if you go down to 2.93. I am attaching file with simple rock that is very sensitive to this quite frankly critical and workflow breaking bug. I simply use hotkeys to switch between object mode and sculpt mode and the rocks shape drastically changes. I don't understand how something this glaring goes unnoticed by users for so long. [rocks_test.blend](https://archive.blender.org/developer/F13835774/rocks_test.blend)
Author

Not sure if it's the same bug, but decimate modifier recalculates on every frame when you add a cloth modifier (even disabled).
2022-11-27 21-58-29_01.mp4

decimate_cloth_bug.blend

Not sure if it's the same bug, but decimate modifier recalculates on every frame when you add a cloth modifier (even disabled). [2022-11-27 21-58-29_01.mp4](https://archive.blender.org/developer/F13973667/2022-11-27_21-58-29_01.mp4) [decimate_cloth_bug.blend](https://archive.blender.org/developer/F13973674/decimate_cloth_bug.blend)
Philipp Oeser removed the
Interest
Modeling
label 2023-02-09 15:27:23 +01:00
Member

This should be solved by 5052e0d407

This should be solved by 5052e0d4073d74cdc8d513034a208004fd44d593
Member

Indeed, ran the test again and there is no more flickering.

Indeed, ran the test again and there is no more flickering.
Hans Goudey added
Type
Bug
Status
Resolved
and removed
Type
Report
Status
Confirmed
labels 2023-11-13 10:47:10 +01:00
Blender Bot added
Status
Archived
Type
Report
and removed
Status
Resolved
Type
Bug
labels 2023-11-13 10:47:59 +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
6 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#100250
No description provided.