Replies: 34 (Who?), Viewed: 26909 times.
Page 1 of 2
Pettifogging Legalist!
retired moderator
Original Poster
#1 Old 25th Jun 2010 at 9:29 PM
Default Aligning vertex normals? (blender 2.49)
Is it possible to edit/align vertex normals in blender 2.49, and if so, how?

I'm asking because of this kind of situation:

This is an EA mesh; it has a seam down one side which means there's two vertices and the edge will be slightly visible in game (depending on lighting). For all I know, aligning the vertex normals so they point in the same direction would be the only way to get rid of that seam completely (short of remaking the whole thing and mapping it cylindrically – with this object that would even be possible, but that's not always an option). Am I on the right track with this?
Screenshots

Stuff for TS2 · TS3 · TS4 | Please do not PM me with technical questions – we have Create forums for that.

In the kingdom of the blind, do as the Romans do.
Advertisement
Field Researcher
#2 Old 25th Jun 2010 at 9:58 PM
Pettifogging Legalist!
retired moderator
Original Poster
#3 Old 25th Jun 2010 at 10:07 PM Last edited by plasticbox : 25th Jun 2010 at 10:25 PM.
Oh, no no =) I'm not asking about the vertices, but about the vertex *normals*.

I want the light to be seamless so that the edge looks smooth under all circumstances (basically hide the fact that it is an edge at all), and to my knowledge that can only be done either by merging the vertices (i.e. removing the edge – which the game can't digest unless I remap so that the map is also seamless), or aligning the vertex normals. If there's any other way to acheive the same result, I'd be glad to know.

I don't know why EA mapped this like they did, but the current map isn't cylindrical like one might expect, it's flat (at least this round part is flat, didn't check the boxy bits since those can have seams all they want). For TS3 this means there has to be an edge in the mesh as well (see this thread where I'm quoting Wes explaining why: http://www.modthesims.info/showthread.php?t=389933 ). I'd prefer not to remap it because I want to use it as a default override, without shuffling around existing textures in game if I can avoid it.


On the other hand .. now that I can check this out textured in blender, I realise I only see the seam in Solid mode, not textured .. which gives me hope that the seam won't be visible in game. Maybe. I don't know what the game exactly does with the normals, of course.

Stuff for TS2 · TS3 · TS4 | Please do not PM me with technical questions – we have Create forums for that.

In the kingdom of the blind, do as the Romans do.
Sockpuppet
#4 Old 26th Jun 2010 at 2:18 AM Last edited by Base1980 : 26th Jun 2010 at 2:28 AM.
I dont know if Blender has the option of manual editinging but if it does you could copy its setting from one vertice to the other.

However, looking at the screenshots the nr1 looks alligned to me tho.
The only seam i see is the vertical line wich goes all the way up starting at nr2
The horizontal line is alligned correct.

Does Blender have a autosmooth function and if so can you turn it off?
Then you can weld the verts with autosmooth on, turn autosmooth off and ungroup the parts that need a seam, then regroup them all back.
This is not a good way when the mesh has morphs tho!
Alchemist
#5 Old 26th Jun 2010 at 2:31 AM
In Maya, you would select the edge and use the "soften edge" command. This would leave two vertices and normals, but the normals would be averaged and both set the same. I suspect blender has something similar (Maya also has a vertex normal editing capability, but I found that you can make everything worse pretty quickly trying to do it by eye).

If you like to say what you think, be sure you know which to do first.
Pettifogging Legalist!
retired moderator
Original Poster
#6 Old 26th Jun 2010 at 3:25 AM Last edited by plasticbox : 27th Jun 2010 at 7:34 AM.
Base: both of the screenshots above show the exact same thing, I only switched to Object Mode for the second one (which turns off the display of edges/vertices/normals), to show the seam better.

The option of manual editing (or hopefully, a script) is exactly what I'm looking for =).

Blender has smoothing, but that's per object (or maybe vertex group) for all I can tell you can select parts and set them to "smooth" or "solid". It's "auto" in the sense of, if you set something to smooth it'll always be smooth unless you change it back to solid (edit: I also found the Auto Smooth option meanwhile (duh), see post #15 – this applies smooth/solid based on the angle between faces, with a threshold the user defines. This is off by default and I haven't used it for this). You also can define hard edges in a smooth object, but for this issue I need the exact opposite.

Problem is, blender knows nothing about the special needs of TS3 – it sees the user has made a seam, so the user wants a seam, so I'll give him a seam. I need a seam that acts as un-seam-like as possible, I just need to tell blender that somehow =P.

I'm not exactly sure what you mean by "turn autosmooth off and ungroup the parts that need a seam" but I believe it is also the exact opposite of what I'm trying to do – I want to visually get rid of the seam, while keeping two edges. I can't weld the vertices (that would be super easy) because the game can't deal with that in combination with how EA have mapped this object.

Also, this is a static object (it's the EA country column), no morphs involved.


Wes: I also suspect that blender has this =) .. I just need to find it. When I googled this I found a few discussions about how blender needs this, and they were all from 2004 or something so I hope someone has implemented it in the meantime. I've already looked through the Vertex, Edge, and Normals menus – I was hoping for a script or a yet-undiscovered button panel submenu or something. Most likely it's gonna be an easy to remember "N shift shift ctrl-E cmd-alt-F8" hotkey ..


I'm attaching another screenshot, perhaps this makes it easier to understand (rather than the two screenshots above) – I moved the selected faces away a little bit to show where the seam is.
Screenshots

Stuff for TS2 · TS3 · TS4 | Please do not PM me with technical questions – we have Create forums for that.

In the kingdom of the blind, do as the Romans do.
Sockpuppet
#7 Old 26th Jun 2010 at 4:35 AM
I understand wat your trying to achieve.
Just turn autosmooth on and weld those vertices on the seam wich makes it dissapear.
Then you should turn the autosmoothing off, and divide the object again on that spot.
Keep autosmooth off and regroup the parts back
Pettifogging Legalist!
retired moderator
Original Poster
#8 Old 26th Jun 2010 at 5:15 AM Last edited by plasticbox : 26th Jun 2010 at 5:43 AM.
Tested (as best as I can repro those steps in blender) but it doesn't seem to work like that – I believe what you mean by "divide the object" is, make a seam again, i.e. split the edge? When I do that, blender immediately adjusts the normals to where they were before – pointing away from each other at an angle. There is no "intermediate" phase where the edge is split but the normals are still in the "old" position.

I don't know what you mean by "regroup the parts back" in this context – are you referring to the "smoothing groups" in Milkshape? I think the equivalent are linked parts in blender. .. actually I just realised you can set arbitrary parts to smooth/solid in blender, no need to group anything.


Exact steps that I took, maybe there is an alternative approach that would work better:

1. select two of the edges at the seam
2. Vertex > RemoveDouble (two are removed – this is the equialent to "weld" I would think) – now the vertex normals point where that of the righthand one was before
3. Normals > Recalculate – now the edge is smooth (just like I want it to look – but without the seam that I need)
4. Edge > Mark Sharp; Modifier: SplitEdge / From Sharp / Apply – now I have a seam but the normals are back where they were before.

..

I fiddled around a bit more and realised that when I have the whole object solid, the minimum I can set to smooth is one face. I can't select just an edge and make it smooth (technically I can, but nothing changes). Does that perhaps mean that the vertex normals in blender are calculated from the face normals? I don't know how this is in other editors – maybe Maya does it the other way around and that's why one can smooth individual edges there?

I also realised: when I select two vertices and Merge > At Center (or Merge > At Cursor), I get "Removed 1 vertex" and 1 vertex remains. When I select the same vertices and Merge > Collapse, I get "Removed 0 vertices" and 1 vertex remains. Is this a glitch or is there a deeper meaning behind that?

Stuff for TS2 · TS3 · TS4 | Please do not PM me with technical questions – we have Create forums for that.

In the kingdom of the blind, do as the Romans do.
Field Researcher
#9 Old 26th Jun 2010 at 6:12 AM
If you select the vertices on the seam and press W with one of the align options maybe?
Pettifogging Legalist!
retired moderator
Original Poster
#10 Old 26th Jun 2010 at 6:25 AM Last edited by plasticbox : 26th Jun 2010 at 6:57 AM.
Vertex selection and W gives me this:

.. is this what you mean? I see no Align, do you mean the Merge options? That's what I did above (Remove Double is just faster when you have more than one pair selected, since it removes doubles in each pair but without merging them all together. I also tested individual pairs and Merge (that's why I saw the "0 Removed" thing), but no difference).


Um, but .. I just googled again and looking at the date of the last post in this thread: http://www.blender.org/forum/viewtopic.php?t=5156 .. it's been bumped on Dec 11, 2009, with "Bumping again years later because 2.5 is being worked on and IMO this problem has persisted long enough" – this makes me think it might not have been implemented, at least not in 2.49 (2.49 was already out in December, wasn't it?). I'm not familiar with the blender forums though; maybe that's just one stray thread and the feature/ability/script exists, just under a different name (I was searching for align "vertex normals").

e: also http://www.blender.org/forum/viewtopic.php?p=75374 .. "I can't believe its been 4 years since this need has been put out there and this detailed discussion has happened and Blender STILL doesn't let you edit vertex normals." (also from late 2009)
Screenshots

Stuff for TS2 · TS3 · TS4 | Please do not PM me with technical questions – we have Create forums for that.

In the kingdom of the blind, do as the Romans do.
Field Researcher
#11 Old 26th Jun 2010 at 7:15 AM Last edited by Ceixari : 26th Jun 2010 at 7:42 AM.
Trying to find where I saw that

EDIT:

My mistake... I was looking at some text in a PDF on my harddrive not taking into consideration that the area it described was UV not mesh. My bad

MORE EDIT:

The website below has a normal smoothing script. The text that surrounds it is also interesting (for me at least):

http://www.macouno.com/tag/blender/page/2/
Sockpuppet
#12 Old 26th Jun 2010 at 1:02 PM
Quote:
Originally Posted by plasticbox
– I believe what you mean by "divide the object" is, make a seam again, i.e. split the edge? When I do that, blender immediately adjusts the normals to where they were before –


There must be a setting to avoid that, i thought turning autosmooth off in the mesh tab would prevent it.
I can not imagine there isn't a way to turn autosmooth off because it will mess up every mesh you import that has been edited on the normals, like sims 3 clothing meshes for example.
Here are 2 identical boxes, one with autosmooth on and one with alligned normals.
There is a huge diffrence between the 2, try if you can import them without changing the normals?
Download - please read all instructions before downloading any files!
File Type: rar boxes.rar (621 Bytes, 13 downloads) - View custom content
Field Researcher
#13 Old 26th Jun 2010 at 2:18 PM
Auto smooth should be off by default.
Sockpuppet
#14 Old 26th Jun 2010 at 2:27 PM
yes, but Blender still recalculates the normals on import
Its something sims 2 meshers couldn't figure out and it prevents them from making clothing meshes as those have edited normals on the neck seam(same with sims 3)
Maybe this is helpfull?
http://www.insimenator.org/index.ph.../topicseen.html
Last post
Pettifogging Legalist!
retired moderator
Original Poster
#15 Old 26th Jun 2010 at 2:47 PM Last edited by plasticbox : 26th Jun 2010 at 3:00 PM.
(Typing slow so I missed your last two posts)

Ceixari: thank you, I looked through that page before, but unless I'm missing something major those scripts are about (what blender calls) "smoothing" the actual mesh, i.e. moving vertices around, and this script offers the option to do so along the angle of the vertex normal. It doesn't seem to be doing anything with the vertex normal itself. But thanks for the link, I wanted to bookmark it anyway =).


Base: when I import the boxes they look identical to me – on import I can either use the SmoothGroups option or not ("surrounds Smooth Groups with hard edges"), then they're either both smooth or both solid. There's other import options too but this is the only one that makes a difference with regards to smoothing. Screenshots below. I know nothing about clothing meshes and have never opened one in blender, so I don't know whether this is to be expected or not.

But I now realised that with "autosmooth" you didn't mean the Milkshape thing (duh! I thought you were talking about that since you were asking at first whether it even exists) – yes, there is one, it's off by default (can't remember I ever used it). I repeated the test above, turning it on before merging the edge and off after that like you said, but it doesn't change anything. I believe all this does is that it sets faces to smooth/solid automatically based on the angle the user defines (and since the faces in question have no neighbouring face on that side, the angle is 360° so it won't make them smooth). Here's the documentation of this feature: http://wiki.blender.org/index.php/D...eshes/Smoothing


I quickly tested another (would have been very laborious) approach: merging the edge and duplicating or extruding it, but that also recalculates the normals immediately. blender seems to like recalculating normals.
Screenshots

Stuff for TS2 · TS3 · TS4 | Please do not PM me with technical questions – we have Create forums for that.

In the kingdom of the blind, do as the Romans do.
Field Researcher
#16 Old 26th Jun 2010 at 3:25 PM
Quote:
Originally Posted by Base1980
yes, but Blender still recalculates the normals on import


It's calculating normals because I'm telling it to recalculate the normals on import.

It is possible for me to show a window for the users to choose whether they want to recalculate the normals or not, but many of the S3ObjTool .s3ascg files do not contain normal coordinates at all, so the script recalculating the normals during import is seen as a help at least for myself.

I'm thinking the same is occurring on the TS2 .smd files, but I haven't looked at the files themselves. I'm guessing that's why bobcatben was recalculating the normals in his scripts.
Sockpuppet
#17 Old 26th Jun 2010 at 3:51 PM Last edited by Base1980 : 26th Jun 2010 at 4:05 PM.
You shouldn't recalculate them on import, it messes up every mesh you import.
It gave plasticbox his seam on the collum wich prolly isn't there on the default mesh.

I agree that on objects it wont make much diffrence but you can not use this setup for clothing meshes.
You will end up with a ugly visible seam on the neck/head, the waist(tops and bottoms seperates) and were the calves meet the feet/shoes.

The boxes should look like this when imported.
Pettifogging Legalist!
retired moderator
Original Poster
#18 Old 26th Jun 2010 at 4:07 PM Last edited by plasticbox : 26th Jun 2010 at 4:35 PM.
I'm not sure I can follow the connection between recalculating normals in various import scripts, and the ability to align/edit them in an existing mesh (and export). Are you having this discussion because of the idea that when all of the relevant import scripts recalculate the normals anyway, it would be pointless to be able to edit them since one could never import them the same way again? Or is it more like: because blender recalculates normals all the time anyway (like for example when you split an edge), there's no point in importing any "special" normals and that's why neither .obj nor .s3ascg does it?

Edit: Base, um .. are you aware that the tone of your last post is rather harsh? I can't tell if that's how you mean it or not since English is apparently not your first language, so it might be unintended.

Also, Ceixari's scripts are s3ascg import/export .. I'm not aware that s3ascg is being used for body meshes.

Stuff for TS2 · TS3 · TS4 | Please do not PM me with technical questions – we have Create forums for that.

In the kingdom of the blind, do as the Romans do.
Field Researcher
#19 Old 26th Jun 2010 at 4:48 PM
I'm not offended, PB

I can provide you with a test import script where the normals are not recalculated, let's see how that works.

As PB mentioned, the scripts will only work for objects.
Download - please read all instructions before downloading any files!
File Type: zip s3asc_import_test.zip (6.0 KB, 13 downloads) - View custom content
Description: Import Script without the calcNormals
Field Researcher
#20 Old 26th Jun 2010 at 4:53 PM
I've been looking at various Blender documentation and websites mentioning anything about normals and so far I've not been able to establish that Blender does actually do this automatically. It might do this because ot the recalc in that it know that you've asked for it (indirectly in the import script) and tries to continue doing it. I tend to do a manual recalc (CTRL-N) in any case during my meshing to make sure it's not pointing inwards, but that more a peace of mind type thing for me.
Sockpuppet
#21 Old 26th Jun 2010 at 5:48 PM
i am so sorry, i am dutch and just trying to help....
Ill keep my mouth shut for now
Field Researcher
#22 Old 26th Jun 2010 at 5:58 PM
Please comment all you want Base. Your opinion is as valid as anyone else's and as we're all from different parts of the world we all at times say something which to us is straight-forward, but may sound otherwise to someone else. I've been around for a long time supporting IT so I take things as they come and don't worry too much.
Alchemist
#23 Old 26th Jun 2010 at 7:23 PM
Quote:
Originally Posted by Ceixari
It's calculating normals because I'm telling it to recalculate the normals on import.


This is actually a new variant on an old issue.

Leaning on my experience in writing importers (back through TS2), I leave the normals unchanged. Generally, it is the shadow meshes that have no normals, they just display black. How I manage this is I set the normals to zero, then when the normals are parsed, I overwrite that with the actual value. When no normals are present, the values are always zero and the object shows black... users can smooth them, but on export what they are set to is discarded anyway.

We have done enough "user training" over the years that MilkShape users know not to use "Autosmooth", because it was designed to force a normal recalculation.

As for tweaking PlasticBox's issue, if you can determine the vertex index value of the two vertices, and the group index, you can tweak those two normals using a calculator and notepad at the .s3asg file level. Normals are lines in the 'vbuf' section that look like this:
Quote:
0 1 -0.007813 -0.007813 0.992188

The first digit is the vertex index (starts at zero and goes to number of vertices-1).
The second digit is the data type, 1 is the normal. The last three numbers are the normal data; X, Y and Z.

For smoothing, average the two X values and then replace both with that. Ditto for Y and Z. Recompile and you should be good to go.

Standard disclaimers on backing up your work, etc. As long as you are careful to have properly formatted numbers, the compiler will happily use the supplied values.

I know this is not the optimal solution, but if there are not too many problem seams then it could help rescue the work done already while a new solution is found.

<* Wes *>

If you like to say what you think, be sure you know which to do first.
Alchemist
#24 Old 26th Jun 2010 at 7:38 PM
Sorry to poke in a little OT...but I have a question about those black shadows in MS. If I bring the MLOD1 mesh in with Autosmooth off, sure enough, the shadow comes in solid black. (And I've never known why until now...lol)

This makes it pretty tough to work with it so it conforms to my new object instead of the old one. I can see the thing properly in the TCE but I can't see what changes are gonna look like in the view screen since all I see is solid black. So it's a little bit of work-around to deal with it. I have to bring the mesh in with Autosmooth on to see the shadow. Am I missing a setting or something that would make this task easier? Sorry again to be OT.
Field Researcher
#25 Old 26th Jun 2010 at 7:45 PM
I had a quick look through the standard import scripts that comes with Blender. In these the following scripts does a calcNormals() as standard during the import:
- 3ds_import
- ac3d_import
- import_dxf
- import_obj
- import_smd (not standard... this is the TS2 import scripts)
- import_web3d
- ply_import

In two of the scripts I found the following comments:

ac3d_import
Some objects may be imported with wrong normals due to wrong information in the model itself. This can be noticed by strange shading, like darker than expected parts in the model. To fix this, select the mesh with wrong normals, enter edit mode and tell Blender to recalculate the normals, either to make them point outside (the usual case) or inside.<br>

import_smd
9/12/2007 version 0.3: reAdded importing of normals(results in some duplicate vertices's but fixes the normal problem, still recalculating them, but this keeps it from merging vertices's with different normals)

get the vertex data, excluding normals as they dont like to import correctly so we will just have blender recalculate normals at the end, after we remove duplicate vertices


Other Info:
The scripts that did not to a CalcNormal() mostly ignored the normals outright during the import.


Please Note:

As Wes notes above, if the imported files (groups) did not contain normals to start with I'm not exporting anything out.
Page 1 of 2
Back to top