Bake Normal problem when adjoining faces have different UV orientation #96942
Labels
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
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#96942
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
System Information
Operating system: Windows-10-10.0.19043-SP0 64 Bits
Graphics card: NVIDIA GeForce GTX 970/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 497.09
Blender Version
Broken: version: 3.1.0, branch: master, commit date: 2022-03-08 18:16, hash:
c77597cd0e
Worked: None. Tested with 2.83 LTS and 2.93 LTS and I get the same behaviour.
Short description of error
Baking normals from a high-poly mesh and some faces have completely weird normals generated.
I created the low-poly UV Map using Smart UV Project.
Some faces on the mesh were at a high enough angle that Smart UV Project put them into separate UV islands.
When the islands have a different face orientation (e.g. rotated) this causes the normal calculation problem.
Exact steps for others to reproduce the error
I have reproduced the problem in a simple test file attached here.
Bake Normal problem when UV Island orientation changed.blend
Open the file and click on Bake. The normals from the warped plane underneath the flat object will be baked. (The normal map is displayed as the surface colour.)
Go to UV Editing. Select the Bake Active object only, then select this face from the UV Editor window.
Rotate the face 180 degrees.
Return to the UV Layout window, and observe the image (normal) has now changed for the centre face.
Select "Bake Selected", then Ctrl click on "Bake Active", and click on Bake again.
The generated normal is still back-to-front (rotated 180 degrees) on the active object.
Switching to the Shading editor, you can view the UV map with more detail.
The section that was rotated still shows a cyan to magenta transition (from top-to-bottom) suggesting that the code generating the UV is not aware of the UV island orientation.
However the code to extract data from the UV map (either for image display, or for use as a normal) must be UV island orientation aware.
Also, the margin region beyond the top/bottom of the faces shows the opposite colour as expected.
Another symptom of this problem (in a real world scenario) is edges highlighted around the problem faces.
This is the normal map view of the same section.
There is no difference observed whether using Bake from MultiRes or Bake from Selected to Active.
I tried Lightmap Pack but it appears to have the same problem where random faces have non blending UVs.
Standard UV Unwrap will also orient faces/islands differently.
Added subscriber: @MarkStead-2
Added subscriber: @lichtwerk
Changed status from 'Needs Triage' to: 'Needs User Info'
Not sure about this. Since this is tangent space, it might actually be OK if this looks inverted (if looked at in color) for the island, the result [when used as a normal map in the Normal Map node] might still be correct (your "real world example" also suggest this, the faces themselves seem to shade correctly, it is at the borders where we see the problems.
This is where the real "problem" is.
In 2.93 (3.0, too) for example, the margin was always extended, you dont get the problem there the margin regions just extend, no borders/seams when used as a normalmap.
There was a new margin method introduced in 3.1, see
449db0a
which uses adjacent faces, you can run into the situation where this does not work well, like in this report with rotated UV islands.So, do you still get the seams/edges around problem faces when you bake with margin type
Extend
(instead ofAdjacent Faces
)?Added subscriber: @Baardaap
@Baardaap: opinions?
Added subscriber: @mano-wii
I don't think it's a bug.
Note that normals need an orientation space to indicate which is up (Y) and which is right (X).
In this case, the orientation is defined by the "Tangent" of the face. See https://docs.blender.org/manual/en/3.2/render/cycles/baking.html#bpy-types-bakesettings-normal-space
Tangent Space
is calculated based on the UV.This is the same space calculated and used when you use the
Normal Map
node with theTangent Space
.So even though the normal is weird, it works correctly with the
Tangent Space
settings.The glitch noted is because the margin is set to
Adjacent Faces
whileExtend
seems to be more appropriate in this case.https://docs.blender.org/manual/en/3.2/render/cycles/baking.html#margin
Hm. That is a situation where I can see 'Adjacent faces' screw up indeed. I think @mano-wii hits the nail on the head.
Maybe we should set the default back to 'Extend' for normal baking. Fixing this in the "Adjacent Faces' margin generation would be quite hairy I think.
@lichtwerk
No, using margin type Extend does not cause those edge halos.
@mano-wii
I've done testing the results are comparable between an actual warped object and a flat plane with the normal map applied. The normal map is interpreted correctly in both Eevee and Cycles.
Flat plane with normal map applied (cycles):
Warped plane without normal (cycles):
Anyway this got me thinking about how the rotation/transformation in UV space was handled, and I will do some follow-up testing of irregular polygons.
Just heading out to grab some lunch - will post my findings soon.
I'm all good. As discussed the only problem is the edge halos that sometimes show when bake Margin Type is set to Adjacent Faces.
I can work around this by using Extend mode.
Thanks for your great work guys.
Changed status from 'Needs User Info' to: 'Archived'
It would only be tangent space, object space would not have this problem.
We could keep this in mind (and I would agree that this sounds like the better default for this kind of baking), @Baardaap feel free to create a TODO task for this and check with #render_cycles devs on how to proceed.
Will close then.
This issue was referenced by
811371a6bd
Changed status from 'Archived' to: 'Resolved'