don't flame me for asking stupid questions cause i'm totaly new to blender :) The only thing i need is to export a blender object (designed by a fellow) as an *.obj (alias) file. There are lots of example scripts for doing that. But the normal information isn't correct. The simplest example. A standard cube (not smoothed) and triangulated. So there have to be normals like
(+/- 1, 0, 0), (0, +/-1, 0) and (0, 0, +/-1). But the information caught by
for f in Object.Get().getData().faces:
for v in f.v
# only pseudocode to demonstrate my problem
there are values like:
+/-0.577349 +/-0.577349 +/-0.577349
Is anybody familiar to this problem?
ah, but vertex normals don't care about wether or not the face is smoothed
those values are ones I would expect, a vertex normal considers all faces the vertex is used in [regardless of smoothing attributes, at least in the python api]
so, either get the face normal, or if it isn't there it is easy enough to calculate with a cross product
the point is... i need the *.obj files as sources for a game (with LWJGL therefor: OpenGL) and it depends on the normals how an material responds to light... i not always need normals that are realy 'normal' to the surface...
as i know, it depends on the normals if an object consisting of triangles looks sharp edged or smooth?
and it's simply so, that BLENDER returns wrong normal information. Is that a bug?
sorry, naturally it was my fault... i totally mixed up vertex normals with face normals
thnx anyway for your respond, without that i wouldnt have the solution til now
I have that problem too. I need per vertex per face normal. I am trying to do a game exporter, but i need a per vertex normal.. per face normal not allow high quality graphics in an engine. Do you make this feature early in python scripting? Thanks for read this.
PD:My english is bad
EDITED: I think per face normal isnt enough, because i can use a 3d model with some "smoothing groups". An example is a cube, each vertex have three normals, it havent one smoothing (this is my problem that i want resolve). The solution can be use per face normal, but, what happen if a face of the cube are a lot of triangles in sphere form?
Thanks for read this. PDPD: I think my english is very very bad, hehe
I met this problem as well, and have seen how it has been handled in a couple of commercial games. Blender doesn't support vertices with more than one normal set, it wouldn't make sense. How would you decide what face the normal belongs to? the way to work around this problem is to 'split' the mesh along the sharp edges. By this I mean that whenever you have a sharp edge you should duplicate the vertex, so that the faces are no longer 'connected' by an edge, but you actually have two coincident edges. This should also make it easier for your 3D engine to render the model. I am also working on a little script to individually edit vertex normals, but I am still in the concept phase, so don't expect it any time soon.
I think that smoothing group is needed in this case (or a some in this way), or simply make a per vertex normal.
One question, if i want smooth a part of a figure, must i make that figure in two figures? this solution is not enough i think. I hope this was resolve early, i like blender very much, but this problem stop me for follow develop over Blender. Ideal way was that when i export face.v[i].no ..no ..no, this write in the file the normals transformed (with smoothed if it have and solid if havent it).
Thx for replay.
PD: My English is bad.. (maybe i said something wrong)
Hm, no, the current Blender mesh supports face normals and vertex normals, but no 'per face' vertex normals.
What I meant was this: you don't need to create new meshes, but whenever two faces belong to two different 'smoothing groups' they should not share vertices. they can be attached to coincident vertices, but not to the same vertex. So if you have 4 vertices v1,v2,v3,v4, and two faces f1.v=[v1,v2,v3], f2.v=[v2,v3,v4] in order for them to have a sharp edge you must add to the mesh two new vertices, v2' and v3', so that the first face is still f1.v=[v1,v2,v3], and the second face becomes f2.v=[v2',v3',v4] instead. as long as v2.co = v2'.co and v3.co = v3'.co the mesh won't have a visible seam, but if v2.no != v2'.no and v3.no != v3'.no the edge will show as an hard edge.
The bottom line is that if you want realy nice smoothing for game models your going to needto code your own smoothing code that generates normals etc.
Useualy the problem is that normals in openGL require one vertex per normal. so a single blender vert needs to be split into many. each with there own normal.
There is a script that does some autosmoothing like this for you- its called autosmooth... look on elysuin.
|ideasman wrote: |
|There is a script that does some autosmoothing like this for you- its called autosmooth... look on elysuin. |
[yes, I wrote it]
Thank you to all. I try for a cube normals, and it did it!, normals are solids and not smoothed. I have only tried whit a cube but i think that this script is very usefull for 3D engine GNU developers. Thx z3r0_d for the script
Hi, ive got a newbie question... I've got the same problem whit normals in obj exporting, so downloaded the script autosmooth. To use the script I must select the "meshes, press alt+p with the cursor in the text window". Where is the text window? How do i know the script has worked?
PS:sorry about the stupid question