Code Monkey home page Code Monkey logo

3dstex's Introduction

3dstex

Texture conversion utility for Nintendo 3DS homebrew.

Travis-CI AppVeyor Codecov

Usage:
  ./3dstex [options] input output
  ./3dstex -b [options] files ...

Options:
  -r           Raw output without header. Header is added by default.
  -p           Print info of input files instead of encoding them.
  -h           Print this help information.
  -b           Batch mode. Converts all input files, gives them *.bin outputs.
  -d <dir>     Directory to output files. Only for batch mode.
               Defaults to the directory of inputs.
  -c <level>   Quality level for ETC1 compression:
                 1  - Low quality    (fast)
                 2  - Medium quality (default)
                 3  - High quality   (slow)
  -i <format>  Input format type. Only needed when input files have no header.
               Possible types: rgba8, rgb8, rgba5551, rgb565, rgba4, la8, hilo8,
               l8, a8, la4, l4, a4, etc1, etc1a4.
  -o <format>  Output format type. Can be any of the above input types with some
               additional special types:
                 png        - PNG output, disabling alpha channel if not used.
                 auto-etc1  - ETC1 when input has no alpha, otherwise ETC1A4.
                 auto-l8    - L8 when input has no alpha, otherwise LA8.
                 auto-l4    - L4 when input has no alpha, otherwise LA4.

Examples

Convert all PNGs in current directory to ETC1(A4) using batch mode:

$ 3dstex -bo auto-etc1 *.png

Convert image to ETC1 in output directory using batch mode and max quality compression (3):

$ 3dstex -o etc1 -bd output -c 3 image.png

Convert image to raw (no header) LA8:

$ 3dstex -ro la8 image.jpg texture.bin

Convert ETC1A4 texture to RGBA4:

$ 3dstex -i etc1a4 -o rgba4 input.bin output.bin

Header

By default, output has a 10 byte header for convenience when reading it. This can be disabled with the -r flag.

The header contains original input dimensions in the case that you want to convert and use images of arbitrary (NPOT) dimensions.

Header is defined as the following:

typedef struct
{
	u16 format;         //< Format matching ctrulib enum GPU_TEXCOLOR
	u16 width;          //< Width (original width to next power of 2)
	u16 height;         //< Height (original height to next power of 2)
	u16 widthOriginal;  //< Width of original input
	u16 heightOriginal; //< Height of original input
} Header;

Input

Currently supports PNG and JPEG input (using stb_image) with some minor restrictions.

You can use previously converted textures as input too, but if they're raw (with no header), you need to specify the format using the -i flag.

3dstex's People

Contributors

cruel avatar

Watchers

 avatar  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.