Fix #109302: baking UDIM displacement normalization wrong #109409

Merged
Philipp Oeser merged 2 commits from lichtwerk/blender:109302 into main 2023-06-28 14:58:59 +02:00
Member

Since UDIM baking support in 6787cc13d4, the normalization of
diplacement heights was always based on the min/max height detected in
the last tile, which could lead to clipping if the last tile had very
subtle (or no) displacement.

Now getting the min/max is spread across all images.
This also takes the first thread into account for getting the min/max (which for some reason was skipped).

Since UDIM baking support in 6787cc13d4, the normalization of diplacement heights was always based on the min/max height detected in the _last_ tile, which could lead to clipping if the last tile had very subtle (or no) displacement. Now getting the min/max is spread across all images. This also takes the first thread into account for getting the min/max (which for some reason was skipped).
Philipp Oeser added 1 commit 2023-06-27 15:13:47 +02:00
6b2e340e6e Fix #109302: baking UDIM displacement normalization wrong
Since UDIM baking support in 6787cc13d4, the normalization of
diplacement heights was always based on the min/max height detected in
the _last_ tile, which could lead to clipping if the last tile had very
subtle (or no) displacement.

Now min/max is spread across all tiles.
Philipp Oeser requested review from Brecht Van Lommel 2023-06-27 15:13:57 +02:00
Philipp Oeser added this to the Render & Cycles project 2023-06-27 15:14:02 +02:00
Brecht Van Lommel requested changes 2023-06-28 13:49:32 +02:00
@ -614,4 +614,0 @@
/* construct bake result */
result->height_min = handles[0].height_min;
result->height_max = handles[0].height_max;

The loop below needs to be changed to:

for (i = 0; i < tot_thread; i++) {
The loop below needs to be changed to: ``` for (i = 0; i < tot_thread; i++) { ```
@ -1475,6 +1471,10 @@ static void bake_images(MultiresBakeRender *bkr, MultiresBakeResult *result)
for (link = static_cast<LinkData *>(bkr->image.first); link; link = link->next) {
Image *ima = (Image *)link->data;
/* construct bake result */

This should be outside the loop over images, otherwise it will use the height from the last image for all images.

This should be outside the loop over images, otherwise it will use the height from the last image for all images.
Author
Member

Yeah, I stumbled over this as well, but left it alone because this was always the case afaict and would mean a change in behavior (a good one though, so will change...)

Yeah, I stumbled over this as well, but left it alone because this was always the case afaict and would mean a change in behavior (a good one though, so will change...)
Philipp Oeser added 1 commit 2023-06-28 14:28:26 +02:00
6849609e5e address review
- take first thread into account as well
- take other images into account as well (not just the last)
Brecht Van Lommel approved these changes 2023-06-28 14:31:40 +02:00
Philipp Oeser merged commit 128c95438f into main 2023-06-28 14:58:59 +02:00
Philipp Oeser deleted branch 109302 2023-06-28 14:59:00 +02:00
Author
Member

From the commit message

This also takes the first thread into account for getting the min/max (which for some reason was skipped).

Sorry for this bogus, previously the first thread was to initialize, then the remaining were lopped over (which made total sense), so the commit message is a bit weak here...

From the commit message >This also takes the first thread into account for getting the min/max (which for some reason was skipped). Sorry for this bogus, previously the first thread was to initialize, then the remaining were lopped over (which made total sense), so the commit message is a bit weak here...
Sign in to join this conversation.
No reviewers
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 Assignees
2 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#109409
No description provided.