Giter VIP home page Giter VIP logo

batch_textures_convert's Introduction

Batch Textures Conversion

Batch convert textures to various render-friendly mip-mapped formats


Intro

This tool helps with pre-processing of textures for offline renderers. It can be used from Houdini, Maya, Nuke or as a standalone application.

Renderers usually convert common texture formats (jpg, png, tga..) into more render friendly mip-mapped formats (rat, rs, tx..) which can be a time consuming process. Mainly if the renderer discards the converted texture afterwards and this process gets repeated many times.

It is therefore more efficient to pre-convert them once and let renderers use them.

It can be also used as a batch images converter, e.g. for converting raw photos with dcraw.


Houdini screenshot Ubuntu standalone screenshot Windows standalone screenshot Maya screenshot Nuke screenshot

Screenshots from Houdini, Ubuntu standalone, Windows standalone, Maya and Nuke

You can see video of this tool here.


Installation

  1. Download or clone this repository.

  2. Houdini

    • Add this repository folder into your HOUDINI_PATH environment variable.
    • For example add this line into your houdini.env file:
    HOUDINI_PATH = &;/path/to/this/repo/
    
    • Display Batch Convert shelf in Houdini

    Maya

    • Add ./scripts/python folder from this repository into your PYTHONPATH environment variable
    • For example add this line into your Maya.env file:
    PYTHONPATH=/path/to/this/repo/scripts/python
    

    Nuke

    • Add ./scripts/python folder from this repository into your PYTHONPATH environment variable
    • Add ./nuke folder from this repository into your NUKE_PATH environment variable
    • For example your batch environment file can look like this:
    set "PYTHONPATH=%PYTHONPATH%;/path/to/this/repo/scripts/python"
    set "NUKE_PATH=%NUKE_PATH%;/path/to/this/repo/nuke"
    

    Standalone

    • This tool requires PySide2
    • If missing, then install it for example with pip
      $ python -m pip install pyside2
      

Usage

  • Start the tool
    • Houdini
      • There are two ways of running the tool:
        1. Click on Batch Convert shelf tool
        2. Right-click on string parameter containing texture path
    • Maya
      • Run the following script from script editor or as a shelf tool
      import batch_convert
      gui = batch_convert.runGui()
      
    • Nuke
      • Display Batch Textures Convert pane tab by right-clicking on pane header: Windows/Custom/Batch Textures Convert
      • Houdini screenshot
    • Standalone
      • $ python batch_textures_converter.py
        • you can specify optional --path argument, which will set folder path (see $ python batch_textures_converter.py --help for help)
  • Select a root folder containing textures you want to convert, it will be scanned recursively
    • You can also select/copypaste multiple folders, they will be separated with " /// "
  • Select which input texture formats should be converted
    • For example you could convert only jpegs or pngs
  • Select output texture format
  • Set number of parallel processes to be run
    • Note that it does not scale linearly and at some point you will hit disk/network IO limit
  • Confirm

A few notes

  • This tool works on Linux and Windows. Feel free to test it under and contribute for OS X version. Right now the following output formats are supported:

    • .rat - Mantra (iconvert)
    • .tx - Arnold (maketx)
    • .tx - PRMan (maketx)
    • .rs - Redshift (redshiftTextureProcessor)
    • .tiff - Dcraw (dcraw)
    • .exr - OpenImageIO (oiiotool)

    However it is easy to extend / modify this tool so that it suits your needs. Note that those are only presets. Those tools can handle more formats and can be customized for different cases. Check man pages of the tools for more information.

  • To add new output format, simply implement a new class in scripts/python/batch_convert/converters.py, which inherits from GenericCommand() class. Class is very simple, so it should be straightforward to add your custom output formats.

  • This tool relies on external executables to perform conversion (e.g. iconvert for RAT, maketx for TX...). Make sure that you have them available in your system's PATH variable. If an executable is not found, then it will print a warning and will hide it from the output formats list in gui.

  • batch_convert.runGui() accepts optional argument: path, use it setting default folder path

  • If there are multiple textures with the same name, but different extensions, the tool will pick the one with the highest priority, as specified in ext_priority list in __init__.py

  • Check beggining of __init__.py for configuration


Contributing

Feel free to contribute to this project by creating pull requests or by buying me a beer :)

batch_textures_convert's People

Contributors

jtomori avatar ricardomusch avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.