Tangent normal map bake has irregular values #114111

Open
opened 2023-10-24 17:04:16 +02:00 by Zak-Nelson · 3 comments

System Information
Operating system: Windows 11
Graphics card: NVIDIA GeForce RTX 4080 Laptop GPU

Blender Version
Broken: 3.6.4, 2.79
Worked: None tested

Short description of error
Normal texture bake appears to be baking the difference of the object without custom normals to the object with custom normals. This object has gone through joining of other objects with custom normals, sometimes with weighted normal modifier applied, sometimes using bpy.ops.mesh.customdata_custom_splitnormals_add()
image

Exact steps for others to reproduce the error
See blend file setup and screenshot of file below and click bake.

**System Information** Operating system: Windows 11 Graphics card: NVIDIA GeForce RTX 4080 Laptop GPU **Blender Version** Broken: 3.6.4, 2.79 Worked: None tested **Short description of error** Normal texture bake appears to be baking the difference of the object without custom normals to the object with custom normals. This object has gone through joining of other objects with custom normals, sometimes with weighted normal modifier applied, sometimes using bpy.ops.mesh.customdata_custom_splitnormals_add() ![image](/attachments/dfe9ee5d-49a6-4a7b-b9be-44acf5fc4a6b) **Exact steps for others to reproduce the error** See blend file setup and screenshot of file below and click bake.
Zak-Nelson added the
Status
Needs Triage
Priority
Normal
Type
Report
labels 2023-10-24 17:04:17 +02:00
Iliya Katushenock added the
Interest
Render & Cycles
Interest
Render Pipeline
labels 2023-10-24 17:08:39 +02:00

It doesn't seem to be "based on the mesh normals without custom normals", otherwise, if we remove the custom normals the result should be the same, no?

But I can confirm that the resulting normal map is strange. (I just don't know exactly what's going on).

It doesn't seem to be "based on the mesh normals without custom normals", otherwise, if we remove the custom normals the result should be the same, no? But I can confirm that the resulting normal map is strange. (I just don't know exactly what's going on).
Zak-Nelson changed title from Tangent normal map bake not based on custom normals to Tangent normal map bake has irregular values 2023-10-25 17:47:59 +02:00
Author

I've updated the title and description to more accurately describe the issue.

I've updated the title and description to more accurately describe the issue.
Author

This type of issue seems to be caused when joining a mesh type object without any mesh data, but is still allowed to have split custom normal data saved. The following script shows the steps for recreating the issue and can be run with this accompanying .Blend file below. If you remove everything before the line "# create object with no geometry" the bake is correct, but without removing that section, you will get the error presented.

import bpy
def duplicate_active_and_join_to_empty():
    new_obj_name='Applied Modifiers and joined to empty'
    new_obj=bpy.data.objects.get(new_obj_name)
    if new_obj is not None:
        bpy.data.objects.remove(new_obj)
    obj=bpy.context.active_object
    if obj is None:
        print('Select an active object')
        return
    #Duplicate the original object
    duplicate = obj.copy()
    duplicate.data = duplicate.data.copy()
    duplicate.name = f'~{obj.name}'
    duplicate.matrix_world = obj.matrix_world
    bpy.context.scene.collection.objects.link(duplicate)
    duplicate.location.x=2
    obj.select_set(False)
    duplicate.select_set(True)
    bpy.context.view_layer.objects.active = duplicate
    duplicate.data.use_auto_smooth=True
    bpy.ops.object.convert(target='MESH')
    bpy.ops.mesh.customdata_custom_splitnormals_add()

    # create object with no geometry
    empty_mesh = bpy.data.meshes.new(new_obj_name)
    empty_mesh = bpy.data.objects.new(new_obj_name, empty_mesh)
    bpy.context.scene.collection.objects.link(empty_mesh)
    empty_mesh.location = (0, 0, 0)

    # Create empty object to join geometry to
    empty_mesh.select_set(True)
    empty_mesh.data.use_auto_smooth=True
    bpy.context.view_layer.objects.active = empty_mesh
    bpy.ops.mesh.customdata_custom_splitnormals_add()
    bpy.ops.object.join()
    bpy.context.scene.render.engine = 'CYCLES'
    bpy.ops.object.bake(type='NORMAL')
    bpy.context.view_layer.objects.active = obj
duplicate_active_and_join_to_empty()
This type of issue seems to be caused when joining a mesh type object without any mesh data, but is still allowed to have split custom normal data saved. The following script shows the steps for recreating the issue and can be run with this accompanying .Blend file below. If you remove everything before the line "# create object with no geometry" the bake is correct, but without removing that section, you will get the error presented. ``` import bpy def duplicate_active_and_join_to_empty(): new_obj_name='Applied Modifiers and joined to empty' new_obj=bpy.data.objects.get(new_obj_name) if new_obj is not None: bpy.data.objects.remove(new_obj) obj=bpy.context.active_object if obj is None: print('Select an active object') return #Duplicate the original object duplicate = obj.copy() duplicate.data = duplicate.data.copy() duplicate.name = f'~{obj.name}' duplicate.matrix_world = obj.matrix_world bpy.context.scene.collection.objects.link(duplicate) duplicate.location.x=2 obj.select_set(False) duplicate.select_set(True) bpy.context.view_layer.objects.active = duplicate duplicate.data.use_auto_smooth=True bpy.ops.object.convert(target='MESH') bpy.ops.mesh.customdata_custom_splitnormals_add() # create object with no geometry empty_mesh = bpy.data.meshes.new(new_obj_name) empty_mesh = bpy.data.objects.new(new_obj_name, empty_mesh) bpy.context.scene.collection.objects.link(empty_mesh) empty_mesh.location = (0, 0, 0) # Create empty object to join geometry to empty_mesh.select_set(True) empty_mesh.data.use_auto_smooth=True bpy.context.view_layer.objects.active = empty_mesh bpy.ops.mesh.customdata_custom_splitnormals_add() bpy.ops.object.join() bpy.context.scene.render.engine = 'CYCLES' bpy.ops.object.bake(type='NORMAL') bpy.context.view_layer.objects.active = obj duplicate_active_and_join_to_empty() ```
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
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#114111
No description provided.