A Daz Studio Plugin based on Daz Bridge Library, allowing transfer of Daz Studio characters and props to the Unity game engine.
- About the Bridge
- How to Install
- How to Use
- How to Build
- How to QA Test
- How to Develop
This is a refactored version of the original DazToUnity Bridge using the Daz Bridge Library as a foundation. Using the Bridge Library allows it to share source code and features with other bridges such as the refactored DazToUnreal and DazToBlender bridges. This will improve development time and quality of all bridges.
The DazToUnity Bridge consists of two parts: a Daz Studio plugin which exports assets to a Unity Project and a Unity Package which contains shaders, scripts and other resources to help recreate the look of the original Daz Studio asset in the Unity game engine.
- You can install the Daz Studio plugin automatically through the Daz Install Manager or Daz Central. This will add a new menu option under File -> Send To -> Daz To Unity.
- For the latest release and bugfixes:
- Go to the Release page
- Download the zipped dzunitybridge.dll (libdzunitybridge.dylib** for macOS)
- Unzip and copy it into the Daz Studio plugins folder (example:
\Daz 3D\Applications\64-bit\DAZ 3D\DAZStudio4\plugins
)
- There is now an improved Unity plugin installer which can be accessed in the Advanced Settings section of the DazToUnity Bridge dialog in Daz Studio.
- Start your Unity Project and leave it in running in the background.
- Start Daz Studio and select File -> Send To -> DazToUnity.
- Enable the Advanced Settings checkbox.
- Select your Unity Version and Rendering Pipeline from the dropdown.
- Click "Install Plugin". A window will popup for you to select a Unity Project to which to install the Unity plugin.
- Navigate to your Unity Project's root folder.
- Click "Select Folder". You will see a confirmation dialog stating if the plugin was successfully copied to your Unity Project.
- Depending on your machine and setup, a Unity Import Package dialog may automatically appear. Click Import.
- If an Import Package dialog does not appear, switch to your Unity Project and navigate to the
Assets\Daz3D\Support
folder. - Inside that folder, you will find installation packages for all render-pipelines:
- For HDRP: double-click "DazToUnity HDRP.unitypackage" and click Import.
- For URP: double-click "DazToUnity URP.unitypackage" and click Import.
- For Built-In Render-pipline: double-click "DazToUnity Standard Shader.unitypackage" and click Import.
- If a popup window asks you to Update the Scripts or API, then click "Yes, for these and other all files".
- For HDRP, you will also need to add a diffusion profile: Unity 2019: This list is found in the Material section of each HD RenderPipeline Asset, which can be found in the Quality->HDRP panel of the Project Settings dialog. Unity 2020 and above: This list is found at the bottom of the HDRP Default Settings panel in the Project Settings dialog.
- Start Daz Studio, add a Figure or Prop to your scene.
- Select the top-most node for your Figure or Prop in the Scene Pane.
- Select from the main menu: File->Send To->Daz to Unity.
- Select the Asset Folder for your project.
- Select the desired Asset Type. Tip: for Figures, select "Skeletal Mesh". For Animation, select "Animation". For all others, select "Static Mesh".
- To enable Morphs or Subdivision levels, click the CheckBox to Enable that option, then click the "Choose Morphs" or "Choose Subdivisions" button to configure your selections.
- Click Accept, then wait for a dialog popup to notify you when to switch to the Unity Window.
Requirements: Daz Studio 4.5+ SDK, Qt 4.8.1, Autodesk Fbx SDK, Pixar OpenSubdiv Library, CMake, C++ development environment
Download or clone the DazToUnity github repository to your local machine. The Daz Bridge Library is linked as a git submodule to the DazToBridge repository. Depending on your git client, you may have to use git submodule init
and git submodule update
to properly clone the Daz Bridge Library.
Use CMake to configure the project files. Daz Bridge Library will be automatically configured to static-link with DazToUnity. If using the CMake gui, you will be prompted for folder paths to dependencies: Daz SDK, Qt 4.8.1, Fbx SDK and OpenSubdiv during the Configure process.
The Test folder contains a QA Manual Test Cases.md
document with instructions for performaing manual tests. The Test folder also contains subfolders for UnitTests, TestCases and Results. To run automated Test Cases, run Daz Studio and load the Test/testcases/test_runner.dsa
script, configure the sIncludePath on line 4, then execute the script. Results will be written to report files stored in the Test/Reports
subfolder.
To run UnitTests, you must first build special Debug versions of the DzBridge-Unity and DzBridge Static sub-projects with Visual Studio configured for C++ Code Generation: Enable C++ Exceptions: Yes with SEH Exceptions (/EHa). This enables the memory exception handling features which are used during null pointer argument tests of the UnitTests. Once the special Debug version of DazToUnity dll is built and installed, run Daz Studio and load the Test/UnitTests/RunUnitTests.dsa
script. Configure the sIncludePath and sOutputPath on lines 4 and 5, then execute the script. Several UI dialog prompts will appear on screen as part of the UnitTests of their related functions. Just click OK or Cancel to advance through them. Results will be written to report files stored in the Test/Reports
subfolder.
For more information on running QA test scripts and writing your own test scripts, please refer to How To Use QA Test Scripts.md
and QA Script Documentation and Examples.dsa
which are located in the Daz Bridge Library repository: https://github.com/daz3d/DazBridgeUtils.
Special Note: The QA Report Files generated by the UnitTest and TestCase scripts have been designed and formatted so that the QA Reports will only change when there is a change in a test result. This allows Github to conveniently track the history of test results with source-code changes, and allows developers and QA testers to notified by Github or their git client when there are any changes and the exact test that changed its result.
The Daz Studio Plugin source code is contained in the DazStudioPlugin
folder. The Unity Package source code and resources are available in a separate github repository. Modifications to the Unity Package files can be embedded in the Daz Studio Plugin by exporting a .UnityPackage file from inside Unity. Then copying the updated UnityPackage to the DazStudioPlugin/Resources
folder and replacing the existing .UnityPackage file there.
The DazToUnity Bridge uses a branch of the Daz Bridge Library which is modified to use the "DzUnityNS" namespace. This ensures that there are no C++ Namespace collisions when other plugins based on the Daz Bridge Library are also loaded in Daz Studio. In order to link and share C++ classes between this plugin and the Daz Bridge Library, a custom CPP_PLUGIN_DEFINITION()
macro is used instead of the standard DZ_PLUGIN_DEFINITION macro and usual .DEF (DzUnityBridge.def) file. NOTE: Use of the DZ_PLUGIN_DEFINITION macro and DEF file use will disable C++ class export in the Visual Studio compiler.