Simply speed-up complex scene loading
A while ago I posted a problem, I was having with excessively long load times for complex scenes. I got some interesting advice and so today (7/4/23 – our Nation’s birthday), I decided to get a few brews and build a simple speed-up solution. I’d appreciate any constructive advice from you guys. So, here’s the step by step of what I did.
1. I had three different Daz3D source file locations, so I merged them into a single folder called DAZ3D-Library. I found some duplicate files during the merge and kept the most recent.
2. I wrote a simple batch file called 01-TRANSFER-DFS-FILES-TO-MASTER.bat that moves all the dfs files from the DAZ3D-Library to a Master-DFS-Files folder retaining original directory structure.
3. As a test, in the DAZ Studio app I Included the DAZ3D-Library and the Master-DFS-Files folders in the DAZ Studio Formats setting. Under these conditions DAZ3D worked as before with all installed morphs etc. available for creating new scene content.
4. But I wanted to speed-up the load time for existing complex scenes. So I removed the Master-DFS-Files folder from the DAZ Studio Formats setting and replaced it with a new Current-DFS-Files folder that was initially empty.
5. I then had Daz Studio load a scene. Almost immediately Daz displayed a missing files window and stopped the load. I manually copied all the text from the missing files window into a text file, Missing-Files.txt and ran another simple batch file 02-COPY-REQUIRED-DFS-FILES-TO-CURRENT.bat that adds the missing dsf files to the Current-DFS-Files folder with the appropriate directory structure. I then allowed the load to continue which was successful.
6. I then did a quick comparison test by loading the same scene twice, once with all the dfs files (Master-DFS-Files) in the DAZ Studio Formats path and then with only the dfs files missing from the scene (Current-DFS-Files) in the path. Here are the results:
Test 1, all dfs file in path
Load time: 13 minutes
Scene size in memory: 18.8 GB
Warnings: duplicate formulas found
Test 2, current dfs files in path
Load time: 3 minutes - includes manual copy / current dfs generation
Scene size in memory: 12.2 GB
Warnings: none
BATCH FILES: (note my DAZ stuff’s on drive Q:)
01-TRANSFER-DFS-FILES-TO-MASTER.bat
echo on
rem Moves all dfs files to Master-DFS-Files folder retaining original directory structure.
q:
cd "\DAZ\00 DAZ 3D\Studio"
RoboCopy.exe "Q:\DAZ\00 DAZ 3D\Studio\DAZ3D-Library\." "Q:\DAZ\00 DAZ 3D\Studio\Master-DFS-Files\." *.dsf /MOV /FP /NP /IS /Z /E
Pause
02-COPY-REQUIRED-DFS-FILES-TO-CURRENT.bat
rem Clears Current-DFS-Files then populates it based on the files listed in the Missing-Files.txt document
echo Y|del "Q:\DAZ\00 DAZ 3D\Studio\Current-DFS-Files\*.*"
for /F "usebackq tokens=*" %%A in ("C:\Users\Settings\Desktop\Missing-Files.txt") do echo F|xcopy /S /Q /Y /F "Q:\DAZ\00 DAZ 3D\Studio\Master-DFS-Files%%A" "Q:\DAZ\00 DAZ 3D\Studio\Current-DFS-Files%%A"
pause
Well, that’s it for now, time for more beers. I’ll do more testing but so far so good. Let me know if this looks like I’m headed for disaster.
Comments
It was a nice experiment. More or less the way you use is similar to what Turbo Loader does, from the result perspective. Only difference is that the 'activated dsf files' (copied with your bat file) in data folder are purely binded with your scene file, i.e. dsf files will be copied only when they have values in that scene file, correct ?
Yes, only the dsf files needed by the scene are loaded. I'd tried Turbo Loader earlier but had issues with crashes and stil got slow loads, perhaps because I use multiple figure generations in some scenes with some generation conversions.
For content from Daz you can also use Daz Connect - if you have gone online, so DS knows what you own(ed at the time) it will note any missing products and offer to install them for you. That doesn't, of course, help with freebies or content from other stores.