Modifying normals from python

Hi to everybody,I would like to know if somebody has succeeded in modifying the normals of an object with python,I need to change the normals not for exporting a mesh but to do some render tricks,like a faked bevel for example.
It seems to me that it’s not possible,even if the vertex normals seems writable(but they look always the same in the interface and when I render).
Sorry for my english

Well, I didn’t know it was possible at all…
But when you use PutRaw to write the mesh, if the third parameter is != 0 then the normals get recalculated. So you should set that to 0.
Just in case you hadn’t noticed that…

anyway, it seems strange, because you are setting the vertexnormals in python, while Blender always shows the facenormals.

And note that if the user wants to edit the mesh later on, the probability is high that he will recalculate the normals using CTRL-N.

Hi wah_tak,you are right,but I don’t understand why I can’t change the normals just before rendering(like a low frequency normal map).My goal was to try to fake subsurfacescattering modyfing the normals of an object,but the current implementation of normals map in Blender does not really work(only planar objects seems to work correctly),if at least the normals could be modifiyed through python I could try in that way but it seems it doesn’t work.

they can be modified [at the vertex level]

however I think the renderer recalculates them
[I know for sure the game engine does, that is why I gave up]

you’d be better off editing the vertex colors in python

Thank you z3r0 d,I think I’ll try another approach(based on camera position).It’s not a real solution,but until someone(I can’t myself,too difficult)implement a more robust implementation of normal mapping in Blender,it’s the only solution,at least that I can think about.

my experience of face nomals, is that the direction they point in is affected by the order in which you add verts to the face list when you create the face, for example:

f = NMesh.Face() f.v.append(v1) f.v.append(v2) f.v.append(v4) f.v.append(v3) me.faces.append(f)

seems to yield different results to:

f = NMesh.Face() f.v.append(v1) f.v.append(v3) f.v.append(v4) f.v.append(v2) me.faces.append(f)

If you are trying to alter faces that exist already, maybe you could save any extra data, colour etc. delete them and recreate them. Hope this helps.

correct, if you reverse the verts the normal would be reversed

[but setting the face normal probably has no effect]