Created
August 24, 2023 07:53
-
-
Save CGArtPython/96abf841bd732ee54a6c89643df45cab to your computer and use it in GitHub Desktop.
Blender Python: seting custom split normals
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bpy | |
mesh_data = bpy.context.object.data | |
# Create a list with the same number of elements as the number of loops (so we can do this `new_loop_normals[loop_index]`) | |
new_loop_normals = [None for _ in mesh_data.loops] | |
for face in mesh_data.polygons: | |
for loop_index in face.loop_indices: | |
new_loop_normals[loop_index] = face.normal | |
mesh_data.use_auto_smooth = True | |
mesh_data.normals_split_custom_set(new_loop_normals) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment