Edit vertex normals by Phyton?

[QUOTE] Originally Posted by m.bruening

Are there any news for editing vertex-normals?

Originally Posted by arexma

Nope. However it should be something an addon with python could address. You might want to ask over in the addon coders subforum.
I guess for somone already into addon coding it is an easy task to manipulate normals.[/QUOTE]

Hi Python-Gurus,

is there a chance to manipulate the vertex normals in blender by python?

This would be awesome for alle 3d realtime artist.

the images on this polish blog should explain my problem perfect!

thanks for your help in advance

All the best
Martin

You cannot with current Blender code. Blender always regenerate smooth (vertex) normals even if you modify them.

2.5 Info:

  • If the vertex pertains to one or more faces, its normal is the interpolated value of all the normals of these faces.
  • If the vertex does not pertain to any face, its normal is aligned with the line from the object’s center passing through this vertex.

(only thing you can do is ‘flip’ normals)

thanks for your quick reply!

:frowning: oh no!

is there a chance that we can manipulate the vertex normals in future blender versions?

This would help game-developers a lot.

indirectly you can affect the face’s normal with a bump or normal map!
but may be not good enough for your problem !

happy 2.5

This issue with Blender and vertex normals affects import from MoI 3D, too, producing bad smoothing artifacts on imported meshes.

Thanks for that patch scorpius, it’s a great start :smiley:

I think the only needed normal manual editing method would be very simple: just select a vertex, press the MMB and trackball-rotate its normal freely.
Can’t really imagine why one would want to do that but an additional option could be to rotate multiple vertex normals by the same angle.

Hi scorpius,

thanks for your help!

I tried your OSX version and zeffii’s code snippet to manipulate the vertex normals but they flipped back after i exit/entered the edit mode :frowning:

I hope there is a solution for it!

# gives you the normal of vertex with index 0
>>> bpy.context.object.data.vertices[0].normal

>>> bpy.context.object.data.vertices[3].normal.zero()
>>> bpy.context.object.data.vertices[3].normal
Vector((0.0, 0.0, 0.0))

>>> bpy.context.object.data.vertices[3].normal = Vector((1,1,1))
>>> bpy.context.object.data.vertices[3].normal
Vector((0.5773491859436035, 0.5773491859436035, 0.5773491859436035))

OK my fault :frowning:

I found the check box under preferences > system > preserve imported normals :slight_smile:

Thanks a lot!

THIS FORUM IS AWESOME :slight_smile:

Hey scorpius,

this is a great first step for editing normals in blender but unfortunately all the vertex normal editing will be lost if you move a vertex in edit mode :frowning:

Would be awesome if a Guru like you could implement a way to edit vertex normals permanetly maybe in the way mikemayday mentioned.

I can’t make any promises, but it seems that something like that can be done with a script.

That would be great! :slight_smile:

As a game artist I can say that a tool for vertex normals editing is absolutely must have thing. Sadly I have had to quit with Blender and buy 3ds max for that single reason. Otherwise I would prefer Blender any time. It’s just impossible to do a number of things for games without such a tool.

Hi guys
not sure what the result of discussion is now. In 2.59 I don’t see any option to preserve vertex normals when importing.
I wrote import script where I set vertices.normals, then I will just export it right away, but normals are already changes (recalculated by Blender?) - is there a way to prevent it? And work with imported normals or have them change only when user forces recalculation of vertex normals ?

i’ve made a script that can change vertex normal(i posted a thread like your some days ago), i only need some change, but i can’t export the normal as i want, each time i export it they are recalculated. there is a solution??

not sure what the result of discussion is now. In 2.59 I don’t see any option to preserve vertex normals when importing.

There is no such option in normal blender releases. That’s what scorpius’ patch is for!

i’ve made a script that can change vertex normal(i posted a thread like your some days ago), i only need some change, but i can’t export the normal as i want, each time i export it they are recalculated. there is a solution??

If they are recalculated in the export script, then you can disable it by modifying the script. Otherwise, store the modified normals somewhere else and modify the export script to use the modified normals - or try and see if scorpius’ patch still works.