Wednesday, December 18, 2019
Since there are several skin materials, editing them consistently is tedious and error prone. The Mini Material Editor addresses this to some extent, but its power is quite limited. With UDIMs we can combine all skin materials into a single one, which we can then edit using the powerful node editor.
The textures nodes have been changed like this. A "T_" has been added in front of the texture name, extension = Clip, and source = Tiled.
In the UV editor, we can now see the tiles of the tiled texture. Notice that the tile labels equal the old material names.
Sunday, December 15, 2019
Monday, December 2, 2019
Bitbucket has decided to remove Mercurial support from Bitbucket Cloud and its API. Mercurial features and repositories will be officially removed from Bitbucket and its API on June 1, 2020. This affects the DAZ Importer.
The Mercurial repo, including all history, has been renamed to DAZ Importer Archive, and the DAZ Importer has been changed to a brand new git repo. Actually, I think it can be a good thing to clean out ancient stuff from the repo and make it more lightweight.
The old Mercurial repo is here.
The old issue tracker is here.
The new git repo is here.
The new issue tracker is here.
The current version can be downloaded as a zip file from here. Actually, that should be the same as before.
Wednesday, October 30, 2019
However, these buttons could be used in another way: to edit the materials in Blender, either because the Daz Importer does not convert materials to Blender perfectly, or because you want to change the look and feel. For a single material, the simplest and most versatile way to do that is of course directly in the shader editor. However, Daz meshes often have many materials, and to apply the same change across multiple materials can be quite tedious and error prone.
To solver this problem, the bump buttons have been expanded into a Mini Material Editor. A few buttons allows you to quickly apply changes across multiple materials for the same mesh. The Material Editor is located at the bottom of the Materials section:
- Active Channel: The channel affected by the change. The following channels are currently supported:
- Factor/Value: Multiply the value of the active channel by this value, or set the value to this value. For scalar channels. For vector channels, e.g. Subsurface Radius, all components are multiplied with the same factor.
- Color Factor/Value: Multiply the value of the active channel by this value, or set the value to this value. For color channels.
- Absolute Values: Determines whether the channel should be multiplied with the factor or set to the value.
- Material Type: Only change materials of the given type:
- Active Channel = Bump Strength
- Factor/Value = 0.5
- Absolute Values = False
- Material Type = Skin
Friday, October 11, 2019
Daz textures are often very large and detailed, which leads to high memory consumption during rendering, and often one can reduce their size without affecting the final render quality very much. Some time ago I implemented a stand-alone tool for resizing textures, and wrote about it here.
Update: Installing OpenCV is no longer necessary, because the DAZ Importer now uses a call to Blender's API to resize textures.
However, running a python program from the terminal window is inconvenient, so I never used that tool very often. To make resizing textures more usable, the tool can now be run from within Blender.
Actually, the resize tool can not be executed entirely within Blender, because it uses OpenCV which is not included with Blender python. Instead the add-on makes a system call to python, running the tool as a stand-alone script under the hood. This means that in order to use the resize tool, python 3 and OpenCV must be installed on your system.
For Python 3, I use Anaconda, which can be downloaded from here. Installing OpenCV was a bit tricky and unfortunately I don't remember how I did it, but there are many instructions on the web, e.g. this one. The rest of this post assumes that your system has python 3 and OpenCV installed.
When the scene has been imported into Blender, save the blend file. At the top of the Materials section, Save Local Textures and save the blend file again. This copies the textures to a local folder where you can modify them. You don't want to mess up the original textures that belong to Daz Studio.
There are two options:
- Steps: The number of steps that the image size is reduced. Each step reduces the linear size with a factor of two, so the number of pixels is reduced by a factor of four.
- Overwrite Files: Whether the original images be overwritten or not. If we choose not to overwrite, new lower-resolution images are created but the original files are kept. The new files are named by adding "-resN" to the file name, where N is the number of steps. Note that the naming convention has changed compared to the stable version 1.4.
After Resize Textures has been pressed, we can follow the progress in the terminal window. First the standalone script creates the downscaled textures. Since we choose to resize the textures two steps and the original textures are 4096 x 4096, the new textures have the size 1024 x 1024.
Of course the resized textures must exist. If the original file is called foo.jpg, the file name of the textures resized N steps is foo-resN.jpg. If no such file is found, the original texture is kept.
Here is a comparison of different resolutions.
|Original resolution, 4096 x 4096. Memory use 1161M.|
|Resized 2 steps, 1024 x 1024. Memory use 342M|
|Resized 4 steps, 256 x 256. Memory use 291M.|
|Resized 8 steps, 16 x 16. Memory use 288M.|
Monday, August 12, 2019
Stable version 1.4 can be found at: https://www.dropbox.com/s/dvredkkiyyp1rp8/import-daz-v1.4-20190807.zip. It is identical to the development version as of today.
The documentation has also been updated to agree with this version: https://diffeomorphic.blogspot.com/p/daz-importer-version-14.html.
Tuesday, July 9, 2019
Recently user engetudouiti wrote a script for setting roll angles. Although the script appears to be useful, I have not studied it in detail and don't have time to support it. Instead, I thought it might be a good idea to create a mechanism that lets users add functionality to the Daz importer. In short, an add-on system.
Blender of course already has an add-on system, and you could write Blender add-ons that invoke the import-daz module, but that approach has some drawbacks. In particular, such "horizontal" calling will break if the name of the import-daz module is changed, e.g. to diffeomorphic-import-daz-bb15d1ca5708. A cleaner solution would be that add-ons for the Daz importer could be handled by the importer itself. The new add-on system in the development version does just that. This is work in progress and details will almost certainly change in the near future.
A Daz importer add-on is a python file that you put in the addons directory (under the import-daz directory, which itself is located under Blender's addon directory). It must contain the same information as a Blender add-on: a bl_info dict, and a register and an unregister function. Packages are supported; in that case the file __init__.py, must contain the bl_info dict and the register and unregister functions.
The file __init__.py in the addons folder should not be touched. It is an empty file which is necessary to make the addons directory into a Python package.
Information about the add-ons is found in the new Add-Ons menu. When no add-ons are loaded, it only contains the buttons Refresh and Save Settings.
https://docs.blender.org/manual/en/latest/preferences/addons.html. Each add-on has an arrow button, an enable checkbox, and the name of the add-on. The arrow button displays more information about the add-on, which is extracted from the bl_info dict.
When the checkbox is enabled, the add-on's register function is executed.
Saturday, April 27, 2019
Install OpenCVThe script which resizes images cannot be used from inside Blender, because it uses the OpenCV library which is not included in Blender python. Installing OpenCV is quite complex, but the instructions at https://www.learnopencv.com/ are very useful.
Other operating systems: https://www.learnopencv.com/?s=install.
On Windows you start by installing the following software:
- Visual Studio.
- Anaconda. I installed the Python 3 version but Python 2 will probably work too.
- Git for Windows.
UsageIn Blender, import a DAZ scene as usual. Save the blend file and press Save Local Textures. This creates a subdirectory called textures and copies all used textures there. Note that this button has been moved from the Finishing section to the Materials section in the Setup panel.
The downsizing script is called resize.py and is located in the standalone folder. Once OpenCV has been installed, open the command prompt, go to the standalone folder, and type
python resize.py <path to texture directory> <resize steps>
This creates new textures whose resolution is 1/2^steps of the original resolution, where steps is an integer between 0 and 4. E.g., if the original image has 4096x4096 pixels and steps = 2, the downsized image has 1024x1024 pixels. The total number of pixels is thus reduced by a factor 16.
ResultsHere are the results on my computer for a scene with a single nude Genesis 8 Female:
|Step||Total size||Render time|
|Original||0||24.9 Mb||59.24 s|
|25%||2||3.79 Mb||55.92 s|
|6.25%||4||342 kb||56.23 s|
When going to maximal downsizing, the total disk space occupied by the textures is reduced by more than a factor 70. This is less than the factor 256 that one would naively expect for a bitmap, because the images are stored in compressed formats such as jpg or png. On the other hand, the render time (with Cycles on Blender 2.79b) does not change significantly in this case, because all textures fit into RAM memory. In realistic scenes, which contain multiple characters with hair and clothes, the original textures may fill up RAM memory and Blender starts swapping to disk. In that case the reduction in render time will be dramatic.
Update July 28, 2019:
When the Resize Textures button is pressed, a pop-up menu appears and asks for the number of rescale steps; one step means that the texture is rescaled by 50% in each direction, two steps that the scale factor is 25%, etc.
|Steps||Scale factor||File name|
This button only replaces the textures in the Blender materials; the rescaled textures must already exist in the same directory. If you have access to some other program that resizes image files, you can of course use that instead of the standalone script bundled with the DAZ Importer, as long as you follow the naming convention above.
If you know that you will never need the original, high-resolution image files, you can alternatively overwrite the original filenames with the scaled files and reload the blend file.
Sunday, March 31, 2019
A. Tran, T. Hassner, I. Masi, G. Medioni, "Regressing Robust and Discriminative 3D Morphable Models with a very Deep Neural Network", in CVPR, 2017. The preprint version is available as arXiv:1612.04904 [cs.CV].
Code for this has generously been made available at Github, https://github.com/fengju514/Expression-Net.
The Expression-Net script analyzes a single input image and outputs a 3D shape in the form of weights for a set of 99 morphs labelled 00 to 98. The location of a mesh vertex is
The Expression-Net script also describes the 99 morphs, but only for a modified Basel Face Model (BFM), which appears to be popular among AI researchers. The BFM is a high-density face mesh, and as such rather unusable for artists, who prefer a medium-density full body mesh, which is rigged and textured. A key contribution of AutoFace is to translate the morphs from the modified BFM into shapekeys for two useful meshes, the Genesis 8 Male and Female characters used in DAZ Studio.
The pictures below show the first few morphs, for the modified BFM, Genesis 8 Male, and Genesis 8 Female. First the original meshes with no shapekeys applied.
|Basic shapes - unmorphed meshes|
- The shapekeys in AutoFace are ten times stronger than the original ones, and hence the coefficients must be reduced by the same factor of ten. The reason is that higher shapekeys are quite subtle and difficult to detect.
- The Genesis shapekeys taper off near the boundary of the BFM, in order to avoid a sharp transition to the rest of the head mesh. In particular a fattened jawline, such as the one in shapekey 00, is not transferred correctly. This problem may be affecting the example with president Trump.
- They eyes, including the skin behind the eyes, are not morphed. Instead the eye vertices are scaled and translated based on the movement of the corners of the eyes. This ensures that the eyes remain round, which is desirable when posing.
- Similarly, the inside of the mouth is scaled based on the movement of the corners of the mouth, in order to ensure that the jaws and teeth remain inside the face.
- The shapekeys shown in this post are more or less symmetric. Higher shapekeys are less pronounced, and some of them are asymmetric.