All Projects → pschraut → UnityTexture3DAtlasImportPipeline

pschraut / UnityTexture3DAtlasImportPipeline

Licence: MIT license
A Texture3D Atlas Import Pipeline for Unity 2019.3 and newer.

Programming Languages

C#
18002 projects
ShaderLab
938 projects

Projects that are alternatives of or similar to UnityTexture3DAtlasImportPipeline

Naughtyattributes
Attribute Extensions for Unity
Stars: ✭ 2,641 (+10904.17%)
Mutual labels:  unity3d-plugin, unity3d-editor
UITKEditorAid
Elements and scripts that help in making Unity editors with UIToolkit.
Stars: ✭ 31 (+29.17%)
Mutual labels:  unity3d-plugin, unity3d-editor
MultiGame
MultiGame is a tool for rapid development in Unity
Stars: ✭ 16 (-33.33%)
Mutual labels:  unity3d-plugin, unity3d-editor
CategoryTool
Unity Editor tool to create Categories in the Hierarchy. The Categories work as dividers between GameObjects.
Stars: ✭ 47 (+95.83%)
Mutual labels:  unity3d-plugin, unity3d-editor
uTextureSendReceive
Unity network texture sender and receiver for video and frame streaming
Stars: ✭ 111 (+362.5%)
Mutual labels:  texture, unity3d-plugin
ScriptableObjectDropdown
Dropdown for ScriptableObjects
Stars: ✭ 40 (+66.67%)
Mutual labels:  unity3d-plugin, unity3d-editor
rectangle-pack
A general purpose, deterministic bin packer designed to conform to any two or three dimensional use case.
Stars: ✭ 60 (+150%)
Mutual labels:  texture, atlas
OpenProtocolInterpreter
Converts the ugly package that came from Open Protocol to an object
Stars: ✭ 94 (+291.67%)
Mutual labels:  atlas
EnvMapTooL
No description or website provided.
Stars: ✭ 25 (+4.17%)
Mutual labels:  texture
UnityProminentColor
Tool to gather main colors of an image using Unity.
Stars: ✭ 40 (+66.67%)
Mutual labels:  unity3d-plugin
IGListKit-AsyncDisplayKit-Example
IGListKit be used with AsyncDisplayKit in Swift
Stars: ✭ 34 (+41.67%)
Mutual labels:  texture
SafeValues
A simple Unity library for cheating prevention
Stars: ✭ 75 (+212.5%)
Mutual labels:  unity3d-plugin
awesome-unity
A curated list of awesome Unity games! 🎮
Stars: ✭ 346 (+1341.67%)
Mutual labels:  unity3d-plugin
android-3d-model-viewer
Android app to load 3D models in obj, stl, dae & gltf format using pure OpenGL ES 2.0. Published on Play Store https://play.google.com/store/apps/details?id=org.andresoviedo.dddmodel2
Stars: ✭ 150 (+525%)
Mutual labels:  texture
YLYRichText
a feature-rich, easy to use unity rich text plugin
Stars: ✭ 32 (+33.33%)
Mutual labels:  unity3d-plugin
subpixel-embedding-segmentation
PyTorch Implementation of Small Lesion Segmentation in Brain MRIs with Subpixel Embedding (ORAL, MICCAIW 2021)
Stars: ✭ 22 (-8.33%)
Mutual labels:  atlas
UnityGlobalTextSystem
Allow the user to 'change' the default font in Unity from "Arial" to a font of their liking.
Stars: ✭ 21 (-12.5%)
Mutual labels:  unity3d-plugin
hello-triangle
Simple sample showing a complete rendering of a triangle, in Java and Kotlin
Stars: ✭ 39 (+62.5%)
Mutual labels:  texture
daru-io
daru-io is a plugin gem to the existing daru gem, which aims to add support to Importing DataFrames from / Exporting DataFrames to multiple formats.
Stars: ✭ 21 (-12.5%)
Mutual labels:  importer
SimpleKeplerOrbits
Unity3d static 2-body orbits simulation
Stars: ✭ 76 (+216.67%)
Mutual labels:  unity3d-plugin

Texture3D Atlas Import Pipeline for Unity

Unity has no built-in import pipeline for Texture3D's in Unity 2020.1 and earlier versions yet. This Texture3D Atlas Import Pipeline package provides the ability to create a Texture3D asset from a collection of regular 2D textures. It's similar to a Texture2DArray, but a Texture3D Atlas supports to blend between its 'slices'.

This Texture3D Atlas Import Pipeline is an editor extension, it does not contain code that is required at runtime.

alt text

Installation

In order to use this Texture3D Atlas Import Pipeline, you have to add the package to your project. As of Unity 2019.3, Unity supports to add packages from git through the Package Manager window.

In Unity's Package Manager, choose "Add package from git URL" and insert one of the Package URL's you can find below.

Package URL's

Version Link
1.4.0 https://github.com/pschraut/UnityTexture3DAtlasImportPipeline.git#1.4.0
1.3.0 https://github.com/pschraut/UnityTexture3DAtlasImportPipeline.git#1.3.0
1.2.0 https://github.com/pschraut/UnityTexture3DAtlasImportPipeline.git#1.2.0
1.1.0 https://github.com/pschraut/UnityTexture3DAtlasImportPipeline.git#1.1.0
1.0.0 https://github.com/pschraut/UnityTexture3DAtlasImportPipeline.git#1.0.0

Credits

If you find this package useful, please mention my name in your credits screen. Something like "Texture3D Atlas Import Pipeline by Peter Schraut" or "Thanks to Peter Schraut" would be very much appreciated.

Unity Bugs

Bug Fixed in Description
1208832 2020.2.0b8, 2020.1 Texture3D does not support compressed formats. Texture3DAtlas only supports RGBA32/ARGB32 uncompressed texture formats in 2019.3/.4. Using uncompressed textures requires more bandwidth and might lead to worse performance than necessary.
1249421 2020.2.0a16 An error is thrown in the Console Window when copying a Compressed Texture2D with Graphics.CopyTexture to Texture3D. If you want to this this bug fixed in Unity 2019.4, please submit a bug-report to Unity Technologies.
1262413 2021.1.? Using Graphics.CopyTexture to copy the content of a Texture2D object in a Texture3D slice, does not work, if the Texture2D uses a compressed texture format. If you want to this this bug fixed in Unity 2019.4, please submit a bug-report to Unity Technologies.
1317998 2021.2.0a14 Creating a Texture3D Atlas with any compressed texture format causes the editor to output " is not supported on this platform. Decompressing texture.", yet Unity is able to create the object with this particular texture format. At least the Inspector displays it's using that format.

How it works

Overview

It uses Unity's ScriptedImporter. ScriptedImporter allows to implement custom asset importers in C# for file formats not natively supported by Unity.

A Texture3D object is natively supported by Unity, but has no import pipeline yet. What I created is a ScriptedImporter that handles files ending with .texture3datlas as a Texture3D object.

Combined with a custom ScriptedImporterEditor, the integration feels quite smooth.

Texture format and size

The texture size and format of a Texture3D is taken from the first input texture, the texture used for slice 0. Thus the Texture3D asset will have the same size and format as the texture specified in slice 0. All input textures have to use the same size and format.

Input textures are copied into the Texture3D with no modifications, thus they all need to match. If they don't match, you'll see an error why the Texture3D could not be created and the Texture3D is changed to solid magenta to indicate there is an issue that must be fixed.

If you want to use different texture formats/sizes for different target platforms, this is fully supported. You just need to specify the format and size in the input textures, not in the Texture3D asset

Limitation due to Unity bugs

Because of the issues listed under "Unity bugs" in this document, the following limitation applies:

  • The Texture3DAtlas texture format is currently limited to RGBA32/ARGB32 uncompressed in Unity 2019.3/.4.

Dependency handling

A Texture3D asset is built from several input textures. The content of those input textures is copied into the Texture3D asset.

The import pipeline registers these input textures as dependencies. This means if a texture that is used by a Texture3D asset changes, the Texture3D asset gets reimported automatically as well.

It's a really neat feature, as you don't need to hit a rebuild button to update the Texture3D every time you change one of its input textures.

Platform handling

If you change the target platform in Unity, for example from PC Standalone to Android, Unity starts to reimport assets for that particular target platform you chose. This will also cause the Texture3D asset to get reimported and it will use size of its input textures as described earlier.

Create Texture3D Atlas asset

  • Open the project window context menu via right-mouse click.
  • Choose "Create > Texture3D Atlas" from the menu. This will create a new Texture3D Atlas asset in the current directory.
  • Once you created the asset, it's selected in the Inspector.
  • A new Texture3D Atlas has no input textures yet. It only contains a "dummy slice" that is solid magenta to indicate you need to add textures. The Texture3D Atlas at this point is already fully functional though.
  • In order to add textures you can click the plus (+) button or just drag&drop your textures onto the list header.
  • Add a texture to each slice.
  • Press the "Apply" button.

Import error

If the Texture3D Atlas is still solid magenta after you pressed "Apply", it's very likely there was an issue with the setup. Please take a look at the Unity Console window for any import error. Open the Console from the main menu "Window > General > Console".

AssetPostprocessor Example

If you want to automate a certain Texture3D Atlas setup every time you create a new Texture3D Atlas asset, you can do this using Unity's AssetPostprocessor API and hook into the OnPreprocessAsset callback to configure the texture array to your like.

using UnityEditor;
using UnityEngine;

class Example : AssetPostprocessor
{
    void OnPreprocessAsset()
    {
        // If the asset has not imported yet...
        if (assetImporter.importSettingsMissing)
        {
            // Gets its importer and apply default settings
            var importer = assetImporter as Oddworm.EditorFramework.Texture3DAtlasImporter;
            if (importer != null)
            {
                importer.filterMode = FilterMode.Point;
                importer.wrapMode = TextureWrapMode.Clamp;
                importer.anisoLevel = 0;
            }
        }
    }
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].