Reduce texture sizes easily with this script.

12467

Comments

  • hphoenixhphoenix Posts: 1,335
    havsm said:

    Oh ya. Now we're cooking with propane. Loaded up a 4532 mb scene. Created mediums and switched to medium. GPUZ now shows 3593 mb. Chopped off a GB!

    Just to be clear, I ran the version from the post you made on Jan 21st...since I use DIM and avoid connect when possible.

    The only confusing part is how TextureMapResizer didn't update my textures automatically, like ReduceTextures did. But didn't take long for me to figure out I needed to run TextureMapSizeSwitcher...and now that I understand it, I kinda like them being separate.

    Thanks!

    Yes, I did that intentionally.  Since it isn't simply a single size (ReduceTextures only does a single 1/2 resolution reduction) and there is no 'temporary' option, it made more sense to have some easy way to switch between the sizes.  It is an extra step, but allows a great deal more flexibility.

    But I'm really wanting someone with Connect installed content to try the updated ones.....like you, I don't use Connect, so I don't have anything to test with.  It should work, but I may have missed something.

     

  • HellboyHellboy Posts: 1,437

    Works like a charm!! Thank you!

  • barbultbarbult Posts: 23,050

    I'll try your script update today with content installed with Daz Connect and report back.

  • barbultbarbult Posts: 23,050

    The new hphoenix script does not work with content that is installed with Daz Connect. The resizer script says it creates the files, but I cannot find them anyplace. The switcher script cannot find the files. This is the same behavior as the previous version, with no improvement that I can see.

    I used the default values in the resizer script, which now lists my non-connect library as the ContentPath for Connect Items. However, I cannot see that any files were created there. What should the path be for the directory they are created in?

    I'm not too concerned about these issues. I am more than thrilled with Esemwy's script, so I will continue to use it. It works perfectly for me with Daz Connect content.

  • hphoenixhphoenix Posts: 1,335
    barbult said:

    The new hphoenix script does not work with content that is installed with Daz Connect. The resizer script says it creates the files, but I cannot find them anyplace. The switcher script cannot find the files. This is the same behavior as the previous version, with no improvement that I can see.

    I used the default values in the resizer script, which now lists my non-connect library as the ContentPath for Connect Items. However, I cannot see that any files were created there. What should the path be for the directory they are created in?

    I'm not too concerned about these issues. I am more than thrilled with Esemwy's script, so I will continue to use it. It works perfectly for me with Daz Connect content.

    That is very odd.  They should be created in whatever directory was selected in the Resizer's "Content Dir for Connect" that was selected.  The path inside that directory should be the same as the original relative path for the Connect content item.  I.e., if the original was in C:\Users\UserName\Documents\Daz 3D\Studio\My Daz Connect Library\data\cloud\1_00000\etc.etc. (and the "Content Dir for Connect" was set at D:\DazContent\My Library", then the files should be created at "D:\DazContent\My Library\data\cloud\1_00000\etc.etc."

    The new files you downloaded ARE different from the original download, right?  I want to make sure I didn't upload the wrong versions.....

    And I'm happy you are enjoying Esemwy's script, I would like to figure out what is not working right in mine.

     

    *sighs*  I may HAVE to install something with connect JUST to troubleshoot this one issue......

     

  • ConnaticConnatic Posts: 279

    I have one question needing answered before I try using these scripts.  I have all of my DAZ Content installed with DIM in one directory, and all of my 3rd-party files in a seperate one.  My understanding has been that I should never mix manually installed content into a DIM-formatted directory.  If I run one of these scripts and it adds files into my DIM directory, will this cause problems?  Or can I specify an alternate destination for the reduced texture files to be saved in?

  • hphoenixhphoenix Posts: 1,335
    Connatic said:

    I have one question needing answered before I try using these scripts.  I have all of my DAZ Content installed with DIM in one directory, and all of my 3rd-party files in a seperate one.  My understanding has been that I should never mix manually installed content into a DIM-formatted directory.  If I run one of these scripts and it adds files into my DIM directory, will this cause problems?  Or can I specify an alternate destination for the reduced texture files to be saved in?

    I'm not sure who told you not to mix manually installed content with DIM installed content.  They should not have any problem coexisting.  The only issue is that while DIM can uninstall content, manually installed stuff may not have any way to uninstall it except by KNOWING what directories to remove.  But it's fine to have multiple directories too.

    Both scripts can save the newly resized files into the directory where the original image file is.  This will cause no issue with either DIM or manual installs.

    Esemwy's TextureResize script can also save the resized files out to the DAZ Temp directory (which gets cleared when DAZ Studio starts (or exits, I'm not sure which)) but that means it's only good for renders within a single session, and if you save the scene file after resizing that way, the next time you pull it up it will complain about not finding the files.  So don't save the scene after resizing with that script if you are saving to the Temp directory!  And Esemwy's script handles Connect-installed content correctly.

    My script also saves the new resized image files to the same directories as the original images, but can create multiple reduction levels (1/2, 1/4, and 1/8th sizes).  The Switcher script simply switches back and forth between the sizes for the selected nodes....but don't select a size you didn't create, or you'll get a lot of 'file not found' errors.  Mine doesn't support Connect-installed content...yet.  Still working on it.

     

  • BruganBrugan Posts: 365

    Question:

    I've had great success with this scrips so far, but I just tried doing a ctrl click activation to have some hair textures saved in the corresponding folder, but they don't show up there even though the script appeared to run. The hair was OOT Christina hair. I'm using the Iray Mats, am I looking in the wrong folder ir should some new files be showing up in that iray folder?

     

     

  • barbultbarbult Posts: 23,050

    I think there is a small bug in the @Esemwy script. My understanding is that when the original textures are in the Connect library, the reduced textures will be saved in the first non-Connect library. I just discovered that the script is creating a new folder at the top level where my non-Connect library resides. My library is named "My Dim Library". A new folder named "My DIM Libraryruntime"  was created and the reduced textures are in there.

  • BruganBrugan Posts: 365

    Found it!

    Was looking in the wrong folders o_O

    So if I was reducing texture on Lilith7, it would be in:

    My DAZ 3D Library\Runtime\Textures\DAZ\Characters\Genesis3\Lilith7

    Christina hair is:

    My DAZ 3D Library\Runtime\Textures\outoftouch\!hair\OOTHairs\Christina

     

    Working as intended, I just needed to do more digging (the file structure makes me dizzy trying to figure it out sometimes o_O )

  • Panic CodePanic Code Posts: 40
    edited February 2017

    Im confused. How to I go about installing this script? Whenever I try to save the file im left with a PNG file.

    Edit* Never mind. Im an idiot!wink

    Post edited by Panic Code on
  • Is there any actual documentation for any of these scripts? I've read along with the forums, but I wish I had a readme.txt I could print out and put in my "binder of freebie instructions." 

    The scripts all seem to work excellent - I've had a couple of scenes set up where no matter what I did to reduce textures, displacement, sub-d... it is very tough to get it down to a size where it will render in native Iray on my 750ti 2MB. 

    The English Double Decker Bus is a hog... I had to go in and remove all the displacement maps and actually remove the tires, the driver area - almost anything I could get rid of.... and retexture with Will's shaders... 

    These scripts made quick work of them... 

    But I'm confused about saving the resized textures with the scene, or accidently saving the scene with the resized textures and losing them and having to reapply all textures the next time I load the scene. 

     

  • hphoenixhphoenix Posts: 1,335
    edited March 2017

    There's plenty of help here in this thread.  My resizeing script also has a 'help' button on it which does pop up a very simple description of my version and its options (very much like a 'readme.txt' file.)

     

    Post edited by hphoenix on
  • donovancolbertdonovancolbert Posts: 1,421
    hphoenix said:

    There's plenty of help here in this thread.  My resizeing script also has a 'help' button on it which does pop up a very simple description of my version and its options (very much like a 'readme.txt' file.)

     

    The problem with the thread format is the descriptions are mixed in with a lot of conversation and discussion, so it takes some digging compared to a readme document. Maybe I'll spend the time to extract the relevant information of the thread and compile it into a readme format. If I do that, would you mind me posting it here in the thread? 

    My concern is that even if I read up on it now, a few months later when I go back to use the script again, I might not remember the details. On the other hand, with a 2GB GPU, I have a feeling these will be frequently enough used that I'll learn them by heart. :) 

    I missed the built in help. I'll look at that too. 

    Not trying to be demanding or unappreciative - I *really* think the script is very generous and has great utility for a freebie. 

  • hphoenixhphoenix Posts: 1,335
    hphoenix said:

    There's plenty of help here in this thread.  My resizeing script also has a 'help' button on it which does pop up a very simple description of my version and its options (very much like a 'readme.txt' file.)

     

    The problem with the thread format is the descriptions are mixed in with a lot of conversation and discussion, so it takes some digging compared to a readme document. Maybe I'll spend the time to extract the relevant information of the thread and compile it into a readme format. If I do that, would you mind me posting it here in the thread? 
     

    By all means!

  • IvyIvy Posts: 7,133

    wow thanks this awesome.  thank you very much :)

  • Sfariah DSfariah D Posts: 25,610

    Sorry but will this work with the iRay to 3Delight script to help renders on an old computer.

  • hphoenixhphoenix Posts: 1,335
    edited March 2017

    Sorry but will this work with the iRay to 3Delight script to help renders on an old computer.

    Sorry to say, but probably no.  The reason is that 3DL converts textures to mipmaps prior to rendering (using TDLMAKE), and then uses the correct mipmap level based on camera distance in the scene.  In other words, 3DL already 'resizes' images based on camera distance and render size via mipmaps.  So if you are rendering in 3Delight (the only reason you'd be using the Iray23Delight script), you probably won't see much if any benefit.

    You might see some slight memory savings by using these before hand (since the mipmaps created will be smaller to start with) but it's likely to be very small.

    These are primarily for Iray, since it is bound by VRAM, which is usually much more limited than system RAM.

     

    Post edited by hphoenix on
  • hphoenixhphoenix Posts: 1,335
    edited October 2018

    Okay, I finally pulled down a product using connect to test and fix my scripts.  And they seem to work correctly now!

    In order to work around issues with how DS determines 'cloud' directories, any connect-installed content's resized textures will now be saved within the selected content directory path, under a 'datacloud' directory.  So if the original file was "C:\Users\MyUserName\Documents\DAZ 3D\Studio\My DAZ Connect Library\data\cloud\1_23456\runtime\textures\PA_Name\Product_Name\texture_file.png", and the selected content directory path was "D:\3DContent\My Library" then the resized file would be in "D:\3DContent\My Library\datacloud\1_23456\runtime\textures\PA_Name\Product_Name\texture_file_ext.png" (where ext is either "_med" for medium (half-res), "_sml" for small (quarter-res), or "_xsm" for xtra-small (eighth-res)).

    Here are both the scripts!  Just drop them into one of your content-paths "Scripts" directories, and enjoy!  And please let me know if you run across any issues with them!

    (and to avoid issues, I updated all my other posts in this thread with these updated files.)

     

    zip
    zip
    TextureMapResizerScripts.zip
    10K
    Post edited by hphoenix on
  • Leonides02Leonides02 Posts: 1,370

    This is a wonderful script. Thank you! 

    Quick question: The new (smaller) texture files aren't being deleted. Is that a bug or a feature?

    Also, is there any advantage to using ImageMagick? I can't get it to work and I'd like to know if it's worth the effort to troubleshoot. 

    Thanks again!

  • hphoenixhphoenix Posts: 1,335
    edited March 2017

    That's a feature of my script.  Esemwy's script (in the first post in the thread) has the option to create the smaller texture in the DS Temp directory, which gets cleared when DS closes.  My script keeps the newly sized textures with the originals (except for connect-downloaded ones, which as described above, have to go in a different location) so they can be re-used as needed.  This way, if you save your scene after switching resolutions, it will still load without having to re-run the resizing script.  Also, you can switch between resolutions easily with the second script (just select the objects/nodes you want to change, run the script and select the resolution....but if you didn't create that resolution for that node/object, it won't find it!)

    (edit)  Thought I should clarify the reason to keep the various sizes.  If you have multiple cameras in your scene, the view from each one may have different distances to elements, and thus having different items in the scene that need to be textured at full resolution.  By keeping the various sized textures, one can simply find the items that are close to the selected camera you are going to render from at the moment, select those items, and swap the textures back to full size.  Then select the other items (invert selection), and run the switching script and select the medium/small size size.  As long as you created resized images for ALL the items.  Also, the extra space taken up by the resized texture maps is pretty small.  Even with non-compressed image formats, it amounts to about 32% of the original (25% for the medium size, 6% for the small size, and 1.5% for the Xtra small size) so if the original used 1 GB of non-compressed images textures, adding ALL the sizes results in there being an extra 320MB of textures.

    If you want to remove them, just browse to the directory they are in (connect-installed will be in the selected content path for connect content, under the /datacloud/ directory, the DIM/manually installed content will simply be in the same directory as the original texture.)  For connect-installed, you can simply delete the whole folder for that product number under datacloud.  For DIM/Manually installed content, delete the files whose names end with "_med", "_sml", and "_xsm".  (/edit)

     

    ImageMagick was my original direction, but the internal resizing works just as well.  There really isn't any advantage to using it, and it actually tends to run slower.  But if for some reason an image has issues with the internal scaling, I left the option in there.  Getting it working with ImageMagick requires the STATICALY LINKED version.  But there really is no real advantage to it.  I left it in simply for testing purposes (both have the same issue wtih PNGs with alpha channels.....still hoping to find a way to correct that, though they are a very small percentage of image textures.)

     

    Post edited by hphoenix on
  • Leonides02Leonides02 Posts: 1,370
    edited March 2017

    @hyphoenix

    Thanks for the swift reply. This script saved me hours on my latest render and everything looks just as crisp. Awesome work!

     

    EDIT: One thing is I seem to need to save and then reopen the scene for Iray to see the changes. Not sure why that is...

    Post edited by Leonides02 on
  • TooncesToonces Posts: 919

    HPhoenix, I wish there was a way to get your script to skip files in the temp directory. Some products that use LIE create textures on the fly in the temp directory (I know this happens when i use brow remove to remove and replace eyebrows for example). It would be cool if your script was smart enough to skip temp dir. That way when I save the scene and re-open, I don't get all the errors.

    Just a thought. Otherwise, enjoying your script!

  • hphoenixhphoenix Posts: 1,335
    havsm said:

    HPhoenix, I wish there was a way to get your script to skip files in the temp directory. Some products that use LIE create textures on the fly in the temp directory (I know this happens when i use brow remove to remove and replace eyebrows for example). It would be cool if your script was smart enough to skip temp dir. That way when I save the scene and re-open, I don't get all the errors.

    Just a thought. Otherwise, enjoying your script!

    That would be a pretty simple change, I think.  I'll see about adding it in this weekend.

     

     

    @hyphoenix

    Thanks for the swift reply. This script saved me hours on my latest render and everything looks just as crisp. Awesome work!

     

    EDIT: One thing is I seem to need to save and then reopen the scene for Iray to see the changes. Not sure why that is...

    Hmm.  That shouldn't be necessary.  It ought to pick them up right away, unless you've got a render window still open (which would hold them in the Iray memory as cached).

  • TooncesToonces Posts: 919

    Awesome!

  • donovancolbertdonovancolbert Posts: 1,421

    I haven't forgotten about putting together some documentation clipped from the conversation in this thread. I just haven't had an chance yet. But I agree, this script is all kinds of awesome for those of us without a lot of memory on our GPUs. 

     

  • FrankTheTankFrankTheTank Posts: 1,131
    edited January 2018

      

    Post edited by FrankTheTank on
  • hphoenixhphoenix Posts: 1,335

    So I've read through this whole thread, but I'm a little confused on which is the latest/best version to if I only use non-connect content, and I don't want to chance my texures being deleted? Would that be scripts in this post on Jan 21st?

    http://www.daz3d.com/forums/discussion/comment/2030991/#Comment_2030991

    or the scripts in the post above?

    http://www.daz3d.com/forums/discussion/comment/2229731/#Comment_2229731

    You can download from either spot, I updated ALL my attachments throughout the thread to be the most current scripts for my stuff.

    And I take it that I don't want to use this script on anything that has transparencies (until when/if the png bug gets fixed). So something like the "Secluded Island" which recenlty crashed my GPU with lots of trees and transparencies, its not really gonna help then unless I don't mind the leaves looking like construction paper, is that correct?

    It isn't a problem with transparency (i.e., having a map in the opacity channel) but with PNG images with an embedded alpha channel.  It should resize opacity/transparency maps just fine.  It's the regular maps with built-in transparency that have the resizing issue.  I don't have that particular product, so I don't know if it uses any of those.  Most products don't.

     

  • FrankTheTankFrankTheTank Posts: 1,131
    edited January 2018

      

    Post edited by FrankTheTank on
  • So I've read through this whole thread, but I'm a little confused on which is the latest/best version to if I only use non-connect content, and I don't want to chance my texures being deleted? Would that be scripts in this post on Jan 21st?

    http://www.daz3d.com/forums/discussion/comment/2030991/#Comment_2030991

    or the scripts in the post above?

    http://www.daz3d.com/forums/discussion/comment/2229731/#Comment_2229731

    And I take it that I don't want to use this script on anything that has transparencies (until when/if the png bug gets fixed). So something like the "Secluded Island" which recenlty crashed my GPU with lots of trees and transparencies, its not really gonna help then unless I don't mind the leaves looking like construction paper, is that correct?

    What video card and video memory do you have?
    You can try to put in the settings DAZ Studio -> Render Settings -> Optimization -> Instancing Optimization -> Memory

     

Sign In or Register to comment.