Jump to content

New Clothing Body Style Converter Beta v0.89f (10-26-2014)


Recommended Posts

Clothing Converter
Automatically convert clothing from one body style to another!
The tool can process a single nif, multiple nifs, or even an entire directory structure at once.

The latest version provides a dramatic improvement to the quality of all conversions. When working with From and To nifs with compatible UV maps, conversion will often be very nearly nearly flawless.

Core Functions
1. Generate reusable 'Lattice' that can be used again and again to convert any clothing customized for one body style to another body style.
2. Convert Bodies, Clothing, Armor, and Equipment from one body style to another.
Example Conversion Results

DMRA to HGEC A cup.  Complex, high-poly armor.

post-20303-0-99115900-1396225149_thumb.png      -   To   -      post-20303-0-09194800-1396225147_thumb.png
          Before: DMRA                -        -               After: HGEC A-Cup
Using Clothing Converter

Please visit the Clothing Converter Lattice Library to browse and share successful lattices with the community.

Mem404b's guide can be found here

The first step to converting clothing is to generate a reusable 'lattice', using the Make Lattice tool.


Make Lattice works by matching vertices on a target nif to vertices on a template nif. It then uses this information to build a reusable 'lattice', essentially a field of transformation vectors that can be used to transform any mesh placed within that field. The higher the quality of the lattice, the better the quality of the clothing transformations that use that lattice.

Ultimately the final quality of any clothing conversion depends on the ability of the tool to find good matches between the target and the template nif. Make Lattice uses three methods to match vertices between meshes. It has a vertex index search that will precisely match vertices from matching geometry blocks that share itentical vertex indices (such as two different head morphs). It has a UV search that will match vertices based on their position in the same UV maps (such as two different HGEC compatible upper bodies). And it has a basic nearest neighbor search that matches vertices based on their physical proximity to each other.

For best results, use a From and a To nif that either share the same base texture or the same vertex index.
The tool will still work even if the From and To nifs don't share UV or vertex indexes.  However, in that case the quality of the clothing conversion will depend entirely on the degree of physical difference between the template and the target nif.
Using Make Lattice


1. Run 'Make Clothing Converter Lattice.bat' or 'make_lattice.py'. This will open the main Make Clothing Converter Lattice options window.
2. Select the From body style: Click File -> Convert From. Select the nif of the base body style that you are converting from (the template)
3. Select the To body style: Click File -> Convert To. Select the nif of the base body style that you are converting to (the target)

Nif Search Settings

Nif Search Settings tells the tool how to find matches between the two meshes. In general, the default settings should be fine.

4. Search Distance. This tells the tool how far a given vertex on the 'To' nif should search for a match on the 'From' nif before giving up. Default settings are probably find here.
5. Vertex Targets. This tells the tool how many targets within the Search Distance a given vertex on the 'To' nif should attempt to find on the 'From' nif. 3 is is generally a good setting. Increase this number to generate a smoother clothing conversion.
6. Vertex Index Search. This tells the tool to attempt a vertex index match between the nifs. Note: The tool can automatically detect whetehr or not two nifs share compatible vertex indices, so it should be safe to leave this enabled.
7. UV Search. This tells the tool tool to compare the UV texture maps between the nifs to attempt to find good vertex matches. Note: Enable this if the two nifs share the same style of texture. Disable this otherwise.

8. Vertex Normal Search Weight. This feature allows the tool to use Vertex Normals to aid in the search to match vertices between the meshes. Higher values increase the weight of vertex normals on the search.

Using Convert Clothing


1. Run 'Clothing Converter.bat' or 'convert_clothing.py'. This will open the Clothing Converter options window
2. Click File-> Select Lattice. From here, select a lattice that you previously generated.
3. Click File-> Target Mesh Options-> Select Target Folder to convert an entire folder.

Vertex Movement Settings
4. Constrain X-Axis. This removes any conversion movement along the X-Axis for all processed nifs
5. Constrain Y-Axis. This removes any conversion movement along the Y-Axis for all processed nifs
6. Constrain Z-Axis. This removes any conversion movement along the Z-Axis for all processed nifs
7. Customize Meshes. This allows you to selectively control a number of transformation settings for individual meshes.
7.a. 'Constrain Axis': Eliminates vertex movement along any selected axes
7.b. 'Magnify Movement': Increases the magnitude of any transformations on the selected mesh
7.c. 'Growth Bias': If greater than one, magnifies any movement that would make the mesh 'grow'. If less than one, magnifies any movement that would make the mesh 'shrink'
7.d. 'Padding': This essentially adds a buffer of the specified distance. This can be used to give a clothing mesh a small buffer so that it floats above a body mesh, rather than potentially clip through it.
7.e. 'Targets': Set the number of search targets by individual mesh.

Search Settings

8. Search Distance. This tells the tool how far a given vertex should search for a matching node in the lattice before giving up. Default settings are probably find here.
9. Node Targets. This tells the tool how many nodes within the Search Distance a given vertex should attempt to find on the lattice. 3 is is generally a good setting. Increase this number to generate a smoother clothing conversion.

Other Settings
10. Edges Only. Select 'Exclude Edges' to prevent the tool from modifying vertices that lie along seams.
11. Gender. Select the appropriate gender to ensure that the tool only converts nifs that it can identify as matching the selected gender.


Tools RC_89.e.7z

Tools RC_89_k_Upgrade.7z



Portable Package:
1. Extract downloaded .7z file to the folder of your choice.

Upgrade Package:
1. Extract the 'PythonPortable' folder from the downloaded .7z file into your existing Clothing Converter Portable install.
2. Allow it to overwrite any files/folders when prompted

Light Download:
1. Install Python 3.3 or 3.4. http://python.org/download/releases/3.3.3/ (64 bit recommended if you are working with very large nifs)
2. Install Pyffi 3K http://sourceforge.net/projects/pyffi/files/pyffi-py3k/
3. Extract Clothing converter to your preferred location in your computer.
4. *Optional* Extract the .bat files in the 'Optional bat_files.7z'.
4.a open the .bat files with a text editor.
4.b change the 'python.exe' to the path to the python install from step 2 and save
4.c run the tools using the .bat file instead of the .py file.


v.0.85 to v.0.85.a
1. Resolved crash error

v.0.81.a to v.0.85
1. Radical overhaul to back-end skin transform calculator
2. Radical overhaul to back-end skin transform compensation
3. Replaced pyffi Matrix4x4 and Matrix3x3 objects with new composite object that calculates cumulative scale, rotation, and transformation transforms discretely in order to substantially reduce floating point division errors that otherwise arise from the repeated composition and decomposition of 4x4 matrices into scale, rot, translation components
4. Added new full pivot Gaussian array solver function that is used to calculate matrix inversions, barycentric coordinates, and solve unknown matrix x for both Ax = C and xA = C
5. Added ability to automatically merge multiple nifs into a single template for both the From and To nifs in the make lattice tool as well as for the Template in Mesh Rigger.


v.70 to v.72
1. Wrist, Neck, Ankle, and Waist seams should now be converted properly
2. Mesh Names should once again appear correctly in relevant menus
v.42 to v.70

1. Massive improvement in conversion quality, speed, stability, and performance.
2. **See below change log for iterative details from .42 to .70
v.66 to v.68

1. Non Manifold (edge seam) vertices will now be properly transformed by the tool
2. Overall conversion quality has improved dramatically

v.65 to v.66

1. Resolves bug that could cause a crash if no valid targets were found for a given vertex.

v.64 to v.65

1. Resolves bug that could cause a crash after the vertex search.

v.63 to v.64

1. Updated Tangent Space and Normal Vector calculations to eliminate potential zero division errors
2. Improved fidelity of Tangent Space calculations near UV seams
3. Reduced console spam during vertex searches
4. Make Lattice and Convert Clothing tools now split match searches into left side axis and right side axis searches. This should improve the symmetry of both lattices and clothing conversions.

v.62 to v.63

1. Modifies Convert Clothing search to generate improved symmetry along X-Axis
2. Resolves Crash when loading certain types of lattices

v.61 to v.62

1. Resolves crash when loading lattices.

v.60 to v.61

1. Resolves bug that could occur when a Lattice generated from a Normal free mesh was loaded into Clothing Converter.

v.52 to v.60

1. Significant improvement to the back-end face location weighting algorithm allows the tool to precisely match the best fit location on a mesh. Limited testing has shown converted clothing with no UV or vertex distortion.

v.51 to v.52

1. Eliminate potential zero division error

v.50 to v.51

1. Resolves v.50 crash bug that might occur during searches

v.48 to v.50

1. Fast nearest vertex search has been supplemented with a find closest point on nearby faces search. This allows for greater quality and accuracy with lower resolution lattices and searches. The cost is an increase in the per vertex search overhead.
2. Medium Resolution and High Resolution settings have been removed from Make Lattice tool.
3. Lattices now store face data in addition to node data.

v.47 to v.48

1. An issue that could result in the Clothing Converter not modifying a mesh has been resolved:  The 'Exclude Edges' option in Clothing Converter's 'Edge Settings' menu had begun excluding all vertices.  This bug has been resolved, and the 'Exclude Edges' option should once again limit the tool only to non-edge seam vertices.

v.46 to v.47

1. Orphan property type blocks will no longer crash the tool

v.45 to b.46
1. New option added to Convert Clothing: 'Don't Cross X-Axis'. When enabled, it will not allow any vertex transforms to cross the x-axis. This eliminates the 'vertex crash' that otherwise occurs when cleavage collides.
2. Vertex Normal Calculation code improved: Re-calculation of vertex normals will now automatically mend seams caused by vertex doubles (i.e. along UV seams).

v.42 to v.45
1. Significant Improvements to the back-end vertex matching algorithm. This should result in notable improvements to many former problem areas
2. Significant Improvements to the ability of the tool to work with meshes with unusual bone and/or skin transforms.
3. Elimination of 'wayward vertex' problem when converting meshes with bad or incompatible skinning.

41 to 42
1. Make Lattice interface has been streamlined with unneeded or redundant options eliminated.
2. All lattices will now be 'Minimal' lattices. This simply means that the shape of the lattice will correspond to the shape of the 'From' nif rather than as a rectangular grid. Extensive testing has confirmed that this style of lattice generates significantly higher quality clothing conversions with a lower performance overhead.

40 to 41
1. Several Crash bugs have been resolved
2. 'Padding' option in the Customize Meshes screen should now behave properly

33 to 40
1. Several Crash or Freeze bugs have been resolved
2. New Option 'Vertex Normal Search Weight' added
3. Several new options added to the Customize Meshes screen

32 to 33
1. Significant updates to Clothing Converter tool. New Option added: 'Customize Meshes'. This will open a menu that allows you to customize the way that the clothing transformation is applied to each mesh in the nif.
1.a. 'Constrain Axis': Eliminates vertex movement along any selected axes
1.b. 'Magnify Movement': Increases the magnitude of any transformations on the selected mesh
1.c. 'Growth Bias': If greater than one, magnifies growth transforms. If less than one, magnifies shrink transforms
1.d 'Padding': Grows the mesh by the specified magnitude
1.e 'Targets': Set the number of search targets by individual mesh.

31 to 32
1. Resolves bug that could occur when the tool attempted to UV match meshes that shared X-Axis mirrored UV maps. This primarily affected hands/feet that used a single UV map for both the left and right hands/feet.

30 to 31
1. Resolves crash error. The Python Portable package appears to be missing the full 'Time' module, which causes the tool to crash when perf_counter is loaded.

27 to 30
1. New feature added 'High Resolution Search'. This feature greatly improves the quality of the resulting lattice by adding an iterative face partition and edge search to the vertex search. Eliminates the distortion from running the tool with 'From' and 'To' nifs with significantly different vertex counts, such as HGEC to TGND conversions
2. Dramatic improvement to search speed.
3. Several rare bugs from unusual nifs have been resolved.

26 to 27
1. New options to constrain Vertex Movement by X-Axis, Y-Axis, and Z-Axis for all nifs added
2. New options to constrain Vertex Movement by X-Axis, Y-Axis, and Z-Axis on a per mesh basis added

25.F to 26
1. New 'Minimal Lattice' option added. This uses an alternate method to generate a smaller, high quality, high performance minimal lattice.

25.E to 25.F
1. Resolves an error that could sometimes cause the UV Search function to find targets on the wrong nif

25.D to 25.E

1. Resolves an error that would cause the lattice to search the 'To' lattice for node targets rather than the 'From'
2. Resolves an additional error that would cause the morph vectors to be the inverse of the desired

25.C to 25.D

1. Resolves a crash bug if the Bone menu was not selected

25 to 25.C

1. Resolves Bug that caused transformations to be the inverse of the desired transform
2. Adds ability to set maximum node density by local bone types.

Please report any bugs or other issues that you encounter.

Please visit the Clothing Converter Lattice Library to browse and share successful lattices with the community.

Link to comment

It should only be necessary to generate either a _0 or a _1 lattice.


When the tool is run, it will automatically check file names for _0 and _1 nifs. If both are found, it stores the morph vectors that convert one to the other.


It then converts the body style of either the _0 or _1 nif using the lattice (depending on which was used to generate the initial lattice). Once that is complete, it applies the morph vectors to the nif and saves the corresponding nif.


Please test it out and let me know if it behaves itself.

Link to comment

One thing I should note about Clothing Converter. It does not currently re-calculate Tangent Spaces or Vertex Normals (this functionality will be added in a future update)


For the time being, if you notice unusual lighting artifacts after converting a nif, simply open the nif in Nifskope and have it recalculate the tangent spaces and vertex normals.

Link to comment

I must've done something wrong. I tried to make a lattice for UNPB -> 7B Cleavage, it seemed like it worked, but when I used to to convert some armors the output was extremely flat chested.

Link to comment

Send me the source files, I'll take a look






I just looked at the source code and it looks like I reversed the From and To files. Sigh.


Do me a favor...copy this into the python\app\Scripts folder and try making a lattice with this version.


If it works properly, I'll update the main files.

Link to comment

It looks like the lattice Generator is reversing the transform vectors. That's....a new bug. Hmm...I wonder where it came from.


I'm testing out a patch now, I'll post an update once it's ready.




OK, I've done a fair amount of testing with the patch. It looks pretty good so far. *However* I should note that generating a good quality lattice for the 'Cleavage' mesh is proving to be a considerable challenge. The problem is that cleavage...everything converts fairly cleanly (for an automated tool) until you get to the X-Axis where the breasts sort of...crash...together in a not particularly appealing way.


One of the features that I had previously added to my Blender version of this tool was a 'Don't Cross X Axis' option that treated the X-Axis as a hard barrier that could not be crossed when doing transforms. It looks like I may need to add a similar option to this tool. I think I can patch it into 'Convert Clothing' script.


Another feature that I should probably port over was a 'lock Z movement' option that prevented any Z-Axis movement.


For any users of my Blender Clothing Converter, are there any other features that were available in the Blender version of the tool that you would like to see added to the stand-alone version?

Link to comment

Using your latest patch (b_25_A).
I have OS: Windows XP (x86) version 5.1 with Java: 1.7.0_51
It chugs along and gives no errors so good to go!

"Oh why are boobies the angst of man?"
I am wanting to scale down from large (DMRA) thru a mid size (HGCA) to almost nil (FCPA).
I plan on using 2 or 3 steps (lats.) to work it down.
So far, using default settings on a bikini top has been a bit messy.
Would you have recommendations on settings for both the lats and the conversions?
Also, does nifs with BBB cause problems? If so, what would be the best way to
clean them before hand? Re-applying the BBB afterwards should be no problem.


Link to comment

BBB should have no effect on the transform. Note: I may add a Boneweight based matching algorithm to the tool at some point so that BBB will actually improve the results...however, since many meshes have extremely dirty weightpainting, this may just end up causing more problems than it solves.


A DMRA to completely flat is second only to Manga to completely flat in terms of challenge. It won't be easy. Scaling up is always easier than scaling down.


The biggest challenge is going to be the underboob region...large breast meshes tend to be a bit messy there, with breast and torso vertices overlapping and faces crashing through each other. Things can get very ugly when the tool attempts to match the breast vertices without interference from the torso vertices and vice versa.


Your best bet is generate some very high resolution lattices. Since you're running a 32 bit system, you'll need to be careful not to run out of memory.


Here is what I would try.


First work on a DMRA to HGEC C conversion. If possible, see if you can generate a lattice with a .025 as the resolution but set the max node density to 10. If that exceeds your available memory, try decreasing the resolution a bit but keep the max node density at 10 (extremely important for the underboob region.


For search settings...this is a bit tricky. I would recommend experimenting a bit..In general, 3 targets for the vertex search is typically ideal. For the lattice node, I generally recommend 3 as well. However, feel free to experiment with higher numbers or lower numbers to see the effect on the final transformations. This is still an experimental tool, so feedback is very much appreciated.


For the Convert Clothing settings...this generally depends a bit on the resolution of the lattice. The higher the node resolution, the higher the recommended number of node search targets. In general, choose a lower number for a more precise transform, a higher number for a smoother transform. I generally like something in the range of 8 to 15 here, but it really depends on the resolution of the lattice.




Here's my thinking for an experimental initial version of Bone Based matching. Right now, the tool builds a lattice for the entire nif, with a resolution that dynamically increases as local vertex density increases.


But it attempts to match every vertex on the nif.


One potentially useful feature that I could add would be a bone selection menu that limits the tool to generating transformation nodes only for vertices that belong to the selected bone groups.

Link to comment

I'm pretty much brainstorming...On the lattice generation side, the basic idea is to improve the performance/quality balance by allowing you to set the max node density by bone group.


So, for example, I could conceivably design the tool to have a stupidly high node density for regions with a specific end-user specified boneweight (say, OP1) and a much lower node density for every other region of the mesh.


If it works, this would allow the tool to much more accurately model breast conversions without the massive performance hit that you would otherwise get.


On the Clothing Conversion side, I can add a great deal of flexibility in determining which vertices should be modified by the tool. For example, it would be extremely simple to allow you to limit the tool transforms to vertices by bone influence.

Link to comment

Here is a very experimental update.


This update adds a new option to the Make Lattice tool, 'Select Bone Nodes'


When enabled, the tool will open a new menu that lists all of the bones identified on both the template and the target nifs.


Each bone will have a button to turn it on or off and a Bone Node Max density slider. Note: The slider settings will only be read by the tool if the corresponding bone button is enabled.


To generate the lattice for DMRA to HGEC-A conversion, try something like this:


1. Set resolution to .25

2. Set Max node density to 4

3. Enable Select Bone Nodes


On the 'Select Bone Node Density' Menu


1. Enable BIP01 L Op1

2. Set BIP01 L Op1 Bone Node Density to 40 (max value)

3. Enable BIP01 R Op1

4. Set BIP01 R Op1 Bone Node Density to 40 (max value)


This will give the maximum node density for breast regions and a significantly lower node density for other regions.


To improve results further, you can try the following:


1. Increase the resolution setting.

2. Create a custom weightpainting using an otherwise unused bone that covers only the problem area.

Link to comment

Cool. Let me know how it performs. This tool is still in the experimental phase, so any feedback or suggestions can be very helpful.


Right now I'm generating a 1.5 million node test lattice. Very slow going.


I'm clearly going to need to learn C++ so I can compile a faster version of this tool.

Link to comment

This one line caught my attention; it seems rather odd. Figure I'll ask.

"Target Mesh Vertices 658077"


The template mesh I used had 3440 verts, and the target mesh had 3321 verts. Not entirely sure what that was about. The final lattice file is roughly 62.5mb.

I attempted to create a lattice for NM to HGEC B.

For settings, I left everything at default save for the changes you suggested at post #14.


I can attach the log file if needed.

Link to comment

Technically, that's the number of nodes in the lattice and nothing to worry about. It's referred to as the number of 'verts' because most of the functions that process the lattice are generic mesh processing functions that report any coordinates as 'verts' no matter what they actually are.


However, I'm getting some odd results with my latest test lattices...something is not working properly and I haven't yet tracked it down.


For the time being, you might want to stick with the 25.A version posted earlier in the thread, rather than the 25.D update.


I'm going to have to track down what broke, and why.

Link to comment

I decided to test the output using the challenging transform that inspired the latest updates. The results look good. Very good. I ended up with a ~900,000 node lattice with most of the nodes focused on the breast transform. The end result is a very solid 1-step transform.


It takes awhile to load the lattice and build the lattice node dictionary, however since the tool can process an entire folder tree of nifs at once, it should only be necessary to load and process the lattice once.


One caveat: Clothing Converter does not yet update Normals or Tangent space. After converting a folder of DMRA clothing to FCPA, you will want to load the nifs in nifskope, right click on the geometry blocks, and face normals and update tangent space.


I'll be adding this functionality to a future update of clothing converter, once I resolve a couple of technical issues with Pyffi's implementation of the update tangent space function.


DMRA to FCPA.7z contains the test lattice


Test Nifs.7z includes the template files I used to generate the lattice as well as sample output files, before and after nifskope cleaning


Test Nifs.7z

Link to comment

Beta 0.26 is now live.


Now that we've pretty much hit the performance wall with the brute-force approach, I thought I'd try something different.


Beta 0.26 adds a new override option 'Make Minimal Lattice' that uses a new approach to generating high quality lattices with a minimal performance hit.


It's experimental, but tests to date area extremely promising.


When Enabled, 'Make Minimal Lattice' causes the tool to generate a lattice skin around the 'From' nif instead of a larger vector field. This allows the tool to focus all of the resolution enhancements on a relatively small region.


The following settings are ignored when 'Make Minimal Lattice' is enabled:

Under 'Lattice Search Settings': 'Node Targets' and 'Search Distance'

Under 'Lattice Density Settings': 'Lattice Resolution', 'Max Node Density', and 'Select Bone Nodes'


The number of lattice nodes in a Minimal Lattice is now entirely dependent on the number of faces and vertices on the 'From' nif. Specifically, the tool will generate a node for each vertex and four nodes per face.


Please let me know how this experiment performs. Thanks.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...