Box Mapping a Normal Map looks different whether object has UV map or not #124656

Open
opened 2024-07-13 13:00:25 +02:00 by JanvandenHemel · 4 comments

System Information
Operating system: Windows-10-10.0.19045-SP0 64 Bits
Graphics card: NVIDIA GeForce RTX 2080 SUPER/PCIe/SSE2 NVIDIA Corporation 4.6.0 NVIDIA 552.22

Blender Version
Broken: version: 4.1.1, branch: blender-v4.1-release, commit date: 2024-04-15 15:11, hash: e1743a0317bc
Worked: (newest version of Blender that worked as expected)

Short description of error
Hey, so when I use Generated coordinates and Box mapping, my Normal map has a column of seemingly flipped Normals on the front. This is with any primitive object, like a UV sphere. When there's a UV map, everything looks fine. Without it, there's this flipped Faces column. It's Generated coordinates and box mapping in both cases, so (in my understanding) it should just look the same.

Exact steps for others to reproduce the error
Please see attached file. It's more visible when using an HDRI in either Eevee or Cycles.

**System Information** Operating system: Windows-10-10.0.19045-SP0 64 Bits Graphics card: NVIDIA GeForce RTX 2080 SUPER/PCIe/SSE2 NVIDIA Corporation 4.6.0 NVIDIA 552.22 **Blender Version** Broken: version: 4.1.1, branch: blender-v4.1-release, commit date: 2024-04-15 15:11, hash: `e1743a0317bc` Worked: (newest version of Blender that worked as expected) **Short description of error** Hey, so when I use Generated coordinates and Box mapping, my Normal map has a column of seemingly flipped Normals on the front. This is with any primitive object, like a UV sphere. When there's a UV map, everything looks fine. Without it, there's this flipped Faces column. It's Generated coordinates and box mapping in both cases, so (in my understanding) it should just look the same. **Exact steps for others to reproduce the error** Please see attached file. It's more visible when using an HDRI in either Eevee or Cycles.
JanvandenHemel added the
Type
Report
Severity
Normal
Status
Needs Triage
labels 2024-07-13 13:00:26 +02:00

After a lot of back & forth on the chat, I've come to the conclusion that this is just an inherent limitation of the tangent space. I'm not exactly sure how the x and y directions of the tangent space are generated in the absence of a UV map but it looks like a default 'uv' based on polar coordinates is used where the interpolation from 1.0 back to 0.0 creates a flipped tangent space in that segment of the mesh.

On some normal maps it seems to work ok, but it turns out this is just because the seam gets hidden in the pattern.

The attached picture shows the effect for a constant normal pertubation. Showing very clearly that the tangent space is flipped in the segment where the polar coordinates flip.

I'm tempted to close it just as 'known limitation' but I'll leave it open for now in case someone knows of some trick to get the tangent space be defined in box-mapped terms as well.

After a lot of back & forth on the chat, I've come to the conclusion that this is just an inherent limitation of the tangent space. I'm not exactly sure how the x and y directions of the tangent space are generated in the absence of a UV map but it looks like a default 'uv' based on polar coordinates is used where the interpolation from 1.0 back to 0.0 creates a flipped tangent space in that segment of the mesh. On some normal maps it seems to work ok, but it turns out this is just because the seam gets hidden in the pattern. The attached picture shows the effect for a constant normal pertubation. Showing very clearly that the tangent space is flipped in the segment where the polar coordinates flip. I'm tempted to close it just as 'known limitation' but I'll leave it open for now in case someone knows of some trick to get the tangent space be defined in box-mapped terms as well.

It looks like the normal map node first generates radial UV coordinates in the absence of a UV map, and then generates a tangent space based on the UV coordinates interpolated between the vertices.

If you 'manually' reproject the normals from the normal map directly to a radially generated tangent space , as demonstrated in the attached blend the problem more or less goes away.

It should be possible for the 'normal map' node to just always calculate the tangent space this way (in the absence of a UV map) I think.

It looks like the normal map node first generates radial UV coordinates in the absence of a UV map, and then generates a tangent space based on the UV coordinates interpolated between the vertices. If you 'manually' reproject the normals from the normal map directly to a radially generated tangent space , as demonstrated in the attached blend the problem more or less goes away. It should be possible for the 'normal map' node to just always calculate the tangent space this way (in the absence of a UV map) I think.

@Baardaap I barely follow what you said, but I would agree, that such manual setup should not be necessary to use the node. So, I will confirm and let module decide, whether this is something that can be improved.

Also not quite sure what module this would belong to. There are some differences between Eevee and Cycles. None With the file you have provided, these are even bigger.

@Baardaap I barely follow what you said, but I would agree, that such manual setup should not be necessary to use the node. So, I will confirm and let module decide, whether this is something that can be improved. Also not quite sure what module this would belong to. There are some differences between Eevee and Cycles. None With the file you have provided, these are even bigger.
Richard Antalik added
Status
Confirmed
Module
Render & Cycles
and removed
Status
Needs Triage
labels 2024-07-15 09:52:00 +02:00
Author

Okay, so in the end it turns out, that the issue indeed was with the Normal map texture itself. At some point, it was probably saved incorrectly. Interestingly, you can add a Mix Color node to it, before the Normal Map node, and set it to Add and the value to 1. This more or less fixes the issue visually (though you can still faintly see that seam). But of course the real "fix" is just re-baking the Normal map and paying attention to making sure it gets saved correctly in terms of color spaces. My sincere apologies for wasting your time on this. And full credit to Jim Morren for the Mix Color node solution. Apparently this is a common issue he runs into this when importing game textures.

Okay, so in the end it turns out, that the issue indeed was with the Normal map texture itself. At some point, it was probably saved incorrectly. Interestingly, you can add a Mix Color node to it, before the Normal Map node, and set it to Add and the value to 1. This more or less fixes the issue visually (though you can still faintly see that seam). But of course the real "fix" is just re-baking the Normal map and paying attention to making sure it gets saved correctly in terms of color spaces. My sincere apologies for wasting your time on this. And full credit to Jim Morren for the Mix Color node solution. Apparently this is a common issue he runs into this when importing game textures.
Bart van der Braak added
Type
Bug
and removed
Type
Report
labels 2024-08-14 12:56:50 +02:00
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
Code Documentation
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
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
Viewport & EEVEE
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
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
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
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
3 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#124656
No description provided.