Cycles baking artifacts #52573

Closed
opened 2017-08-29 03:12:15 +02:00 by marc dion · 11 comments

System Information
Windows 10 16GB, GTX 965 2GB

Blender Version
Broken: 2.78.5(2acd05b) is broken along with every newer version that I tested.
Worked: 2.78.4(67bef6b) works as expected

Short description of error

There are strange dark artifacts showing up for simple blocks that are placed near one another. The artifacts that show up look like they are being baked in from some hidden object but there are no other objects hidden in the scene nor are there objects on any other layer.

The error happens for both CPU and GPU and also for 'Combined' and 'Ambient Occlusion' bakes.

correct.png errors.png

Exact steps for others to reproduce the error
Open the included blend file and press bake.

bevelNode.blend

**System Information** Windows 10 16GB, GTX 965 2GB **Blender Version** Broken: 2.78.5(2acd05b) is broken along with every newer version that I tested. Worked: 2.78.4(67bef6b) works as expected **Short description of error** There are strange dark artifacts showing up for simple blocks that are placed near one another. The artifacts that show up look like they are being baked in from some hidden object but there are no other objects hidden in the scene nor are there objects on any other layer. The error happens for both CPU and GPU and also for 'Combined' and 'Ambient Occlusion' bakes. ![correct.png](https://archive.blender.org/developer/F736725/correct.png) ![errors.png](https://archive.blender.org/developer/F736727/errors.png) **Exact steps for others to reproduce the error** Open the included blend file and press bake. [bevelNode.blend](https://archive.blender.org/developer/F736732/bevelNode.blend)
Author

Changed status to: 'Open'

Changed status to: 'Open'
Author

Added subscriber: @MarcClintDion

Added subscriber: @MarcClintDion

Added subscriber: @dfelinto

Added subscriber: @dfelinto
Bastien Montagne was assigned by Dalai Felinto 2017-08-29 12:35:11 +02:00

This was introduced in ae1c1cd8c0.
(and @MarcClintDion thanks for nailing down the bad/good range, it sped up the git bisecting here)

This was introduced in ae1c1cd8c0. (and @MarcClintDion thanks for nailing down the bad/good range, it sped up the git bisecting here)
Author

@dfelinto It looks like I can get away with saying "you're welcome" since no one else is subscribed yet(no one around to annoy with undue email notifications ;). I just wish I had noticed it earlier, I've been too busy to use Blender much since last winter, I just wanted to test the bevel node.

@dfelinto It looks like I can get away with saying "you're welcome" since no one else is subscribed yet(no one around to annoy with undue email notifications ;). I just wish I had noticed it earlier, I've been too busy to use Blender much since last winter, I just wanted to test the bevel node.
Bastien Montagne removed their assignment 2017-08-30 16:27:18 +02:00

Added subscriber: @mont29

Added subscriber: @mont29

Face splitting code is not the issue here. Took me some time to dig the culprit out of the shadows: our (old) quad rule stating that 'forth vertex of quad cannot be first one in mesh array (i.e. one with index 0), because we use zero forth vert index in our old (now only used for tessellation) Face data to mark it as a triangle. So... funny tessellation code has to rotate quad faces which happen to end on zeroth vertex.

Fun fact is, after faces have been split, two of the three that were using zeroth vert are now using newly generated ones, with higher indices, which mean tessellation will not rotate them anymore.

So, the issue here is the mismatch between Cycles code (object_to_mesh() in blender_utils.h) and baking code (bake_mesh_new_from_object() in object_bake_api.c), the later always splitting faces, while the former only does in in some specific cases. This leads to mismatches between generated meshes, in some unfortunate cases, a few faces will be rotated.

Am not sure how to solve this right (first and simplest idea would be to bring face splitting or not in baking code to match the one in Cycles - but we do not have access to Cycles subsurf stuff here afaik). But this is not my area of code really, should be handled by someone understanding baking/Cycles code better.

And this is not actually a regression, at least not from ae1c1cd8c0. The issue potentially exists since we use BMesh and polygons, it just did not triggered for some reason in this example with previous (rather broken) splitting code, but pretty sure one could forge faulty cases with previous code as well. It's mostly a matter of specific unfortunate corner case here.

Face splitting code is not the issue here. Took me some time to dig the culprit out of the shadows: our (old) quad rule stating that 'forth vertex of quad **cannot** be first one in mesh array (i.e. one with index 0), because we use zero forth vert index in our old (now only used for tessellation) Face data to mark it as a triangle. So... funny tessellation code has to rotate quad faces which happen to end on zeroth vertex. Fun fact is, after faces have been split, two of the three that were using zeroth vert are now using newly generated ones, with higher indices, which mean tessellation will not rotate them anymore. So, the issue here is the mismatch between Cycles code (`object_to_mesh()` in blender_utils.h) and baking code (`bake_mesh_new_from_object()` in object_bake_api.c), the later always splitting faces, while the former only does in in some specific cases. This leads to mismatches between generated meshes, in some unfortunate cases, a few faces will be rotated. Am not sure how to solve this right (first and simplest idea would be to bring face splitting or not in baking code to match the one in Cycles - but we do not have access to Cycles subsurf stuff here afaik). But this is not my area of code really, should be handled by someone understanding baking/Cycles code better. And this is not actually a regression, at least not from ae1c1cd8c0. The issue potentially exists since we use BMesh and polygons, it just did not triggered for some reason in this example with previous (rather broken) splitting code, but pretty sure one could forge faulty cases with previous code as well. It's mostly a matter of specific unfortunate corner case here.
Author

This comment was removed by @MarcClintDion

*This comment was removed by @MarcClintDion*
Author

This comment was removed by @MarcClintDion

*This comment was removed by @MarcClintDion*

This issue was referenced by fadc079740

This issue was referenced by fadc0797403070adb517ebe0f02801470334c9ab

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
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
Asset Browser Project
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#52573
No description provided.