Skip to content

This is an open source Texture-Channels-Packer for Unity Editor.

License

Notifications You must be signed in to change notification settings

Woolction/Unity-Texture-Packer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Texture-Packer

Texture Packer is a Unity editor plugin designed to pack multiple texture maps into different channels of a single texture.

For example, using RGB channels:

  • R = Ambient Occlusion
  • G = Metallic
  • B = Mask

This approach helps save VRAM by using one texture instead of several separate ones. Repository Contents

The repository contains two main files:

  • TexturePacker.cs: an editor script used to pack textures

  • ShaderTest: a shader that supports packed textures generated by the plugin

Plugin Location

The plugin is located in the Tools folder:

Texture Packer Location


Texture Slots

The plugin has four slots (unused slots can be disabled). Each slot is assigned to a specific output channel, which can be selected manually.

Slots


Warning: If two slots are assigned to the same channel, the data from the last slot will overwrite the previous one, since the packing process is linear. Changing slot names has no functional effect — they are purely cosmetic.

Slot Name


Source & Type Settings

Each slot has two settings: Source and Type.

Source:

Defines what data is written from the input texture into the selected output channel. Available options (7 total):

Source


  • RGB: combines all RGB channels into one value

  • R, G, B, A: reads data from the selected channel

  • Mask: (experimental / alpha feature) The idea was to store colors as bits, allowing up to three colors to be stored in a single channel and later decoded in a shader

  • Color: fills the channel with a constant value (0–255)

Type:

Defines how the data is processed before writing. Available options (2 total):

Type


  • Default.
  • Inverse RNS: inverts the value (originally designed for Roughness = Smoothness conversion)

Output Settings

The first three options are self-explanatory:

Settings


Additional settings:

  • Texture Write Format: Defines the format used when writing data into the output texture

  • Overwrite Existing File: Overwrites the output file if it already exists

  • Auto Texture Formatting: Automatically selects texture compression based on the number of channels (for example, 4 channels = BC7)

  • Enable sRGB: Enables sRGB color space (can also be set manually)

Included Shader Information

The repository includes shaders designed to work with packed textures. There are two supported workflows:

1️⃣ Packed Map Workflow:

The shader expects:

Albedo: standard albedo texture


Normal Map: must be set as Default, not Normal Map

  • R = Normal X
  • G = Normal Y
  • B = Smoothness

Packed Map

  • R = Ambient Occlusion
  • G = Metallic
  • B = Emission

2️⃣ Fully Packed Workflow (No Separate Packed Map):

All data is packed directly into Albedo and Normal textures:

Albedo Texture:

  • RGB = Albedo RGB
  • A = Ambient Occlusion

Normal Texture:

  • R = Normal X
  • G = Normal Y
  • B = Smoothness
  • A = Metallic or Emission

Installation

The don't recommended way to install the package is through the package manager in Unity (UPM). if you want a install this package with package manager this instruction with you: Before installing, make sure that URP is installed and correctly set up in your project. Then you can proceed to install this package:

  • Inside Unity, go to "Window"=> "Package Manager".

  • Once the window is opened, go to the "+" symbol at the top left corner, and select "Install package from git URL". See the image below. Install

Package Manger


(Intsall the package with install zip! this is recomended way to install the package)

Shader Location

If you install the plugin using Package Manager, then you can find Shader in the Shaders tab => CustomPBR

Shader Location

About

This is an open source Texture-Channels-Packer for Unity Editor.

Topics

Resources

License

Stars

Watchers

Forks

Languages