Texture dialation - Adjacent faces margin type dialates pixels inside uv island #119393

Open
opened 2024-03-12 18:57:36 +01:00 by Marko Tatalovic · 10 comments

System Information
Operating system: Windows 10
Graphics card: GeForce 2080 TI

Blender Version
Broken: (example: 4.0.2, 9be62e85b7, master, 2023-12-05, as found on the splash screen)
Worked: (3.6.8)

Short description of error
Not sure if new behaviour is inteded or a bug:

Baking with 'Adjacent faces' as the margin type in version 4.0.2 dialates pixels inside the uv shell.

Exact steps for others to reproduce the error

  1. Open provided file in Blender 3.6
  2. Select "selected" object then select "active" object
  3. Press Bake
  4. Open provided file in Blender 4.0.2
  5. Select "selected" object then select "active" object
  6. Press Bake!
  7. See the difference

B 4.0.2:
image

B 3.6.8:
image

**System Information** Operating system: Windows 10 Graphics card: GeForce 2080 TI **Blender Version** Broken: (example: 4.0.2, 9be62e85b727, master, 2023-12-05, as found on the splash screen) Worked: (3.6.8) **Short description of error** Not sure if new behaviour is inteded or a bug: Baking with 'Adjacent faces' as the margin type in version 4.0.2 dialates pixels inside the uv shell. **Exact steps for others to reproduce the error** 1. Open provided file in Blender 3.6 2. Select "selected" object then select "active" object 3. Press Bake 4. Open provided file in Blender 4.0.2 5. Select "selected" object then select "active" object 6. Press Bake! 7. See the difference B 4.0.2: ![image](/attachments/77f9c029-3b17-4e38-9ef7-fbe919008113) B 3.6.8: ![image](/attachments/5e75363a-6aa6-40ed-aae8-5c89fd94394e)
Marko Tatalovic added the
Status
Needs Triage
Priority
Normal
Type
Report
labels 2024-03-12 18:57:37 +01:00
Marko Tatalovic changed title from Texture dialation - Adjacent faces margin type has dialates pixels inside uv island to Texture dialation - Adjacent faces margin type dialates pixels inside uv island 2024-03-12 18:59:21 +01:00
Member

Hi, thanks for the report. Can confirm.
Broke between 7be0d1481c67 - 827baed610b8
@lichtwerk , can you help bisecting? 😅

Hi, thanks for the report. Can confirm. Broke between `7be0d1481c67 - 827baed610b8` @lichtwerk , can you help bisecting? 😅
Member

Can check later (currently need to fix a backport first)

Can check later (currently need to fix a backport first)

It was an intentional change in #109500 to fix another bug.

Is the new behavior a problem?

It was an intentional change in #109500 to fix another bug. Is the new behavior a problem?

Hello,

We are developing automatisation tools for baking LODs at our company.

We were relying on the behaviour from 3.6.8 to detect where are the holes in the higher LODs (for windows and doors) by relying on the ray missing, which is not possible in newer versions. I would say for potential ray misses on the seams/hard edges new behaviour might be better.

For fixing ray misses on the seams we do another bake with smooth cage, and blend it in with the first bake.

Right now for the 4.0.2 + we had to implement our own padding in python. We do fill in windows and doors with non alpha color so padding doesn't affect those areas.

I think it would be useful feature to have option for dialation to skip transparent pixels inside the uvshell.

In 3.6.8 Adjacent faces margin type did dialate alpha pixels on the uv border which is not ideal, but that can be easily fixed by doing second bake with smooth cage as I mentioned above.

Hello, We are developing automatisation tools for baking LODs at our company. We were relying on the behaviour from 3.6.8 to detect where are the holes in the higher LODs (for windows and doors) by relying on the ray missing, which is not possible in newer versions. I would say for potential ray misses on the seams/hard edges new behaviour might be better. For fixing ray misses on the seams we do another bake with smooth cage, and blend it in with the first bake. Right now for the 4.0.2 + we had to implement our own padding in python. We do fill in windows and doors with non alpha color so padding doesn't affect those areas. I think it would be useful feature to have option for dialation to skip transparent pixels inside the uvshell. In 3.6.8 Adjacent faces margin type did dialate alpha pixels on the uv border which is not ideal, but that can be easily fixed by doing second bake with smooth cage as I mentioned above.

@Baardaap I guess we can add an option for this?

Maybe the right default behavior is even the old one. It's probably less common to bake to multiple texture maps with adjacent islands, than to bake incrementally to a single texture map where you don't want it to overwrite other UV islands.

@Baardaap I guess we can add an option for this? Maybe the right default behavior is even the old one. It's probably less common to bake to multiple texture maps with adjacent islands, than to bake incrementally to a single texture map where you don't want it to overwrite other UV islands.

I guess I should try to make it so that only edges of which the adjacent polygon is in the current bake as well get a generated border, while edges where the border is not an outside border of the uv map shoudl be ignored.

I'll try to find some time to look into it.

I guess I should try to make it so that only edges of which the adjacent polygon is in the current bake as well get a generated border, while edges where the border is not an outside border of the uv map shoudl be ignored. I'll try to find some time to look into it.
Brecht Van Lommel added this to the 4.2 LTS milestone 2024-03-15 14:15:38 +01:00

I did start to look into it a bit.

@Fuxna : Am I correct in understanding that the old 'extend' method has exactly the same problem?

It's not totally trivial to fix in a clean way, and I disagree with @brecht that the 4.0.2 behaviour could be the correct one as
a) That did not match the behaviour of the 'extend' method.
b) That could mess up edges of the UV map that were not part of the bake as well, along the outer edge of the UV map for polygons that were not part of the bake.

To fix this I'd need to actively suppress generating a border along edges which border polygons not part of the bake. Which could be done for the 'Adjacent Faces', but would be hard for the 'Extend' method as that is purely an image filter and has no info about the polygons. I also use 'Extend' as a in 'Adjacent Faces' to fill some holes not filled by the adjacent faces algorithm, so that's sl;ightly problematic (though apparently it was no problem in 4.0.2? I don't fully understand that yet, need to investigate that a bit more).

I did start to look into it a bit. @Fuxna : Am I correct in understanding that the old 'extend' method has exactly the same problem? It's not totally trivial to fix in a clean way, and I disagree with @brecht that the 4.0.2 behaviour could be the correct one as a) That did not match the behaviour of the 'extend' method. b) That could mess up edges of the UV map that were not part of the bake as well, along the outer edge of the UV map for polygons that were not part of the bake. To fix this I'd need to actively suppress generating a border along edges which border polygons not part of the bake. Which could be done for the 'Adjacent Faces', but would be hard for the 'Extend' method as that is purely an image filter and has no info about the polygons. I also use 'Extend' as a in 'Adjacent Faces' to fill some holes not filled by the adjacent faces algorithm, so that's sl;ightly problematic (though apparently it was no problem in 4.0.2? I don't fully understand that yet, need to investigate that a bit more).

@Fuxna : Am I correct in understanding that the old 'extend' method has exactly the same problem?

@Baardaap Yes it pads all alpha pixels. Also I need to update how it behaved before (for the 'ADJACENT'). I wrongly thought that there is no padding for the windows and doors. but it actually does some padding altho it doesn't fill the hole all the way.

image
image

in the test file its also there but only few pixels, so that's why me ( and I guess all of uss missed it).

Right now we moved to using compositor nodes to solve our problem. Not sure what to do about this one.

> @Fuxna : Am I correct in understanding that the old 'extend' method has exactly the same problem? @Baardaap Yes it pads all alpha pixels. Also I need to update how it behaved before (for the 'ADJACENT'). I wrongly thought that there is no padding for the windows and doors. but it actually does some padding altho it doesn't fill the hole all the way. ![image](/attachments/1e0fc07a-448d-46be-8b24-4c452c7e5bc1) ![image](/attachments/c4a8dba4-2d81-4b6a-9085-cdb010940209) in the test file its also there but only few pixels, so that's why me ( and I guess all of uss missed it). Right now we moved to using compositor nodes to solve our problem. Not sure what to do about this one.
Blender Bot added
Status
Archived
and removed
Status
Confirmed
labels 2024-04-08 18:41:33 +02:00

I am an idiot I did the comment and close again... Move the button somewhere else :D

I am an idiot I did the comment and close again... Move the button somewhere else :D
Blender Bot added
Status
Needs Triage
and removed
Status
Archived
labels 2024-04-08 18:42:37 +02:00
Philipp Oeser added
Status
Confirmed
and removed
Status
Needs Triage
labels 2024-04-09 09:41:11 +02:00

I have been playing a bit with possible fixes, but all things I tried up to now I wasn't really satisfied with, because they all involved creating a full copy of the mask and also involved quite a bi more lookup per pixel.

Since I currently don't have too much time for blender coding I'm afraid I won't be able to get something in for this before 4.2.

Also I'm not really sure this qualifies as a bug per-se, though it would of course be a nice option to have. The original 'extend' border generation did not support this either, and the way it mostly worked out in 3.6 was a side effect of an actual bug (and I think it wasn't really guaranteed to work either, as it would create borders around the outside edges of the complete UV map, which will still generate unwanted borders in place you don't want them.

I will try to get something working for post 4.2

I have been playing a bit with possible fixes, but all things I tried up to now I wasn't really satisfied with, because they all involved creating a full copy of the mask and also involved quite a bi more lookup per pixel. Since I currently don't have too much time for blender coding I'm afraid I won't be able to get something in for this before 4.2. Also I'm not really sure this qualifies as a bug per-se, though it would of course be a nice option to have. The original 'extend' border generation did not support this either, and the way it mostly worked out in 3.6 was a side effect of an actual bug (and I think it wasn't really guaranteed to work either, as it would create borders around the outside edges of the complete UV map, which will still generate unwanted borders in place you don't want them. I will try to get something working for post 4.2
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#119393
No description provided.