The two results of python and blender are quite different. The result of blender is a bit better. How can I modify the code to achieve the result of blender?
from vedo import *
import numpy as np
mesh = Mesh("CWom0012-HD2-O02P13-S-1.obj").computeNormals()
normals = mesh.getPointArray("Normals")
# print(np.linalg.norm(normals, axis=1))
normals[:, 0] = normals[:, 0] / (2.0)
normals[:, 1] = normals[:, 1] / (-2.0)
normals[:, 2] = normals[:, 2] / (2.0)
normals = ((normals + 0.5) * 255).astype(np.int)
# normals = 100 * 0.5 + normals * 0.5
# print(normals)
mesh.addPointArray(normals, 'mynorms').mapPointsToCells()
cellsRGB = mesh.getCellArray('mynorms')
mesh.cellIndividualColors(cellsRGB).computeNormals()
show(mesh, axes=0)
result of code:
result of Blender: