STEAM GROUP
Blender Source Tools BleST
STEAM GROUP
Blender Source Tools BleST
62
IN-GAME
521
ONLINE
Founded
November 8, 2013
All Discussions > Bug Reports > Topic Details
Edward Feb 15, 2018 @ 5:20pm
Errors in importing models
Hello. Been importing models without a hitch for about a year now. However, after upgrading Blender to 2.79 and Source Tools to 2.9.1 I get strange errors.

https://i.imgur.com/5a0MpmO.png

First off, a good deal of the polys seem to be missing. But then I realize that it is just the normals that seem to have been inverted. The problem there is that I have to remember to check the option "Preserve SMD Polygons & Normals" because by default that option is unchecked.

The next problem is that after importing the "reference" model and resize the skeleton (because source models are huge), then import the VTA, appending it to the "reference" (select model not skeleton only and Import), and try something like jaw_open, it seems like only every other vertex responds.

I went back to check other models I've managed to import successfully in the past and the same thing happens to them as well! What has happened?
Last edited by Edward; Feb 15, 2018 @ 5:20pm
Originally posted by Edward:
The new version 2.10.2 has fixed this bug. Everything imports as it should (with the exception of dmx animations being turned but that's another problem).
< >
Showing 1-7 of 7 comments
Zappy Feb 16, 2018 @ 2:04am 
I definitely don't know why the normals would be flipped without "Preserve SMD Polygons & Normals" enabled, but I know that the issue you're experiencing with importing the VTA(s) is (mostly) a result of having "Preserve SMD Polygons & Normals" enabled.

(A much shorter explanation than the below wall of text is near the bottom of the comment.)



SMD mesh files only store independant triangles, where the only information each triangle has is the material of the triangle, and each of the triangles' vertices' 3D positions, "normal" directions, UV-mapping, and bone influences (weight-mapping).
Well, of course, SMD mesh files also store a skeleton/armature, with bone positions, rotations, and parenting all kept intact, but the point is that for a flat square, it doesn't store a 4-sided polygon, and it also doesn't store 4 vertices where it says which 3 vertices form one of the two triangles, but instead it stores 2 completely independant triangles.


So when importing SMD mesh files into Blender with "Preserve SMD Polygons & Normals" disabled, the SMD mesh gets imported with basic smooth shading, and then a "remove doubles" thing gets applied automatically, in order to make it so you get 4 vertices that are connected as 2 triangles.

But when importing them with "Preserve SMD Polygons & Normals" enabled, you get 3 vertices that form a triangle, and 3 other vertices that form another independant triangle. Even though 2 of the vertices from the two triangles may share the exact same position in 3D space and such, they will still be 2 independant vertices, so you have 2 different vertices there. This effect just gets "amplified" the more triangle vertices that are there.
(The reason the shading looks fine instead of blocky this way is because it also imports the "normals" of the triangles' vertices when doing this, which for various reasons can't be done when the "remove doubles" thing gets applied when "Preserve SMD Polygons & Normals" is disabled.)


Now, the way VTA flex files work is that they have a "base" position with a vertex in place for each vertex of the model they're intended to affect, and then they have different "vertex animation" frames where those same vertexes/vertices are moved to where they should be in the different flexes.

Both Source's StudioMDL (model compiler) and the Blender Source Tools have VTA flexes work roughly by simply comparing the VTA file's "base" position vertices to the vertices of the mesh the VTA is applied to, and then assigning that mesh vertex to that VTA vertex, having that mesh vertex do the same movements for the various flexes as the same vertex of the VTA file.

As you may remember, having "Preserve SMD Polygons & Normals" enabled when importing an SMD mesh file with the Blender Source Tools makes it so that each triangle is not connected to any other triangle, so there will be many different vertices at the exact same point, while the VTA file only has a single vertex at that point. And even if the mesh has multiple vertices in the same spot, only a single one of those vertices can be considered the "closest" to the VTA's vertex there, meaning that only one of the triangles will have a vertex that moves from flexes there, with the rest of the triangles having their vertices be stuck in place there.


I know you may be wondering why StudioMDL doesn't have this problem, and the short answer is that it simply is able to merge multiple SMD mesh vertices into one where they are in the same spot, while also being able to keep the custom per-triangle shading intact unlike Blender's "remove doubles" thing. The long answer is the same thing, just lengthier.

So if you still don't get why the flexes screw up when imported onto a "Preserve SMD Polygons & Normals"-imported SMD mesh, it's because that setting will make there be multiple vertices in the same spot instead of just one, while the VTA expects there to only be one vertex there.





TL;DR: "Preserve SMD Polygons & Normals" makes each triangle of SMD files be imported separately, not connected to each other, while VTA flex importing basically requires them to be connected to each other.

Again, I don't know why having "Preserve SMD Polygons & Normals" disabled would result in some of the triangles being flipped, but that's kind of the "main" problem you should focus on. The broken VTA flex importing is simply a result of "Preserve SMD Polygons & Normals" being enabled.
ZeqMacaw Feb 16, 2018 @ 2:52am 
Hiya, Edward! It's been a long time since we chatted. We can probably help with your model issue(s) in the Dead4Mods Discord[discord.gg].
Last edited by ZeqMacaw; Feb 16, 2018 @ 2:52am
Edward Feb 16, 2018 @ 3:43am 
Well, until a solution is found and added to the next update, I can only think of 3 workarounds...
Try to force Double-Sided rendering, find all flipped normals and flip them manually, or use an older version of Blender to import the models then work on them in the newer version.
Zappy Feb 16, 2018 @ 3:47am 
Originally posted by Edward:
Well, until a solution is found and added to the next update, I can only think of 3 workarounds... Try to force Double-Sided rendering, find all flipped normals and flip them manually, or use an older version of Blender to import the models then work on them in the newer version.
What about importing the mesh with "Preserve SMD Polygons & Normals" disabled, then selecting the whole mesh and using "recalculate normals" (or something like that)? I believe that should automatically try to figure out what is "outwards" and then make all faces face that way.
Edward Feb 16, 2018 @ 12:33pm 
Edit Mode -> Mesh -> Faces -> Recalculate Normals did not fix the normals.
Paynamia Mar 14, 2018 @ 2:04pm 
I'm getting the same issue, importing without "Preserve Polygons and Normals" no longer works correctly. A way around it is to import the model with preserve polygons enabled, go into edit mode and use "Remove Doubles" followed by "Clear custom split normals data".
EDIT: Then go to the Object Data tab and either uncheck "auto smooth" or turn it up to 180. Unless you want it to do it, of course.
Last edited by Paynamia; Mar 14, 2018 @ 2:06pm
A moderator of this forum has indicated that this post answers the original topic.
Edward Apr 21, 2018 @ 8:36am 
The new version 2.10.2 has fixed this bug. Everything imports as it should (with the exception of dmx animations being turned but that's another problem).
< >
Showing 1-7 of 7 comments
Per page: 15 30 50

All Discussions > Bug Reports > Topic Details