Jump to content

Edit History

Please note that revisions older than 365 days are pruned and will no longer show here
TormentedEmu

TormentedEmu

Step by step walk through Tutorial to create a new Texture2dArray within Unity:

 

Get Unity 2019.2.17 from here
https://unity3d.com/get-unity/download/archive

 

Create a new 3d project.
Install this package here https://github.com/pschraut/UnityTexture2DArrayImportPipeline
GitHub - pschraut/UnityTexture2DArrayImportPipeline
A Texture2DArray Import Pipeline for Unity 2019.3 and newer. - pschraut/UnityTexture2DArrayImportPipeline

 

Here is a direct link to the download https://github.com/pschraut/UnityTexture2DArrayImportPipeline/archive/1.2.0.zip
Unzip this file, then from within Unity, you need to manually install this package and point it toward the unzipped package and wait for it to completely install it.
After that, probably a good idea to make a new folder in the Assets directory, call it whatever or TextureArrays
Right click on the new folder and select the option to create a new Texture2dArray
The new texture mod requires 3 arrays in total
The first array will contain all your base color/diffuse textures
The second array will contain the normal maps
The third array will contain your metallic gloss, roughness, emission, ambient occlusion maps
The slice index is very important and each set must match for each texture set.
If a picture of wood is set to index 1, then the normal must go in index 1 of the second array, and the metallic map goes in index 1 in the third array, likewise
I recommend using a placeholder image for index 0 due to the way the paint brush identifies index 0 as a way to "erase" a paint
Basically, start placing all images at index 1.  All three arrays will require a blank/black/whatever image in index 0.
Once all three arrays are complete, make sure you hit the Apply button for the array to save, within Unity.
Then select all three arrays and export the bundle using Xyth's export script

https://github.com/7D2D/Templates-and-Utilities


Next, you need to modify my mod xml located in the Config folder.  You need basic xml and xpath knowledge to change my defaults to whatever you like.
Modify the UV mapping.xml to match the blocks.xml id's
UV mapping file, the ID will correlate to the ID in blocks.xml.  The index number will correlate to the slice index of the texture2darray within Unity
Make sure all the numbers match up.

Make sure the texture array names in Unity match those within the InitHarmony.cs file, particularly:

public static string MyTextureArrayDiffuse = "ta_NewBlockTest";
public static string MyTextureArrayNormal = "ta_NewBlockTest_n";
public static string MyTextureArraySpecular = "ta_NewBlockTest_s";

Either make your file names the same, or change those variables in the InitHarmony.cs fileTrial and error go a long way to understanding.

 

Good luck and if you need help, talk to me in Discord

 

 

TormentedEmu

TormentedEmu

Step by step walk through Tutorial to create a new Texture2dArray within Unity: Get Unity 2019.2.17 from here
Unity
Unity is the ultimate game development platform. Use Unity to build high-quality 3D and 2D games, deploy them across mobile, desktop, VR/AR, consoles or the Web, and connect with loyal and enthusiastic players and customers.
ogimg.jpg?width=400&height=210
[8:25 PM]
Create a new 3d project. Install this package here https://github.com/pschraut/UnityTexture2DArrayImportPipeline(edited)
GitHub
A Texture2DArray Import Pipeline for Unity 2019.3 and newer. - pschraut/UnityTexture2DArrayImportPipeline
6738908?width=80&height=80
[8:29 PM]
Unzip this file, then from within Unity, you need to manually install this package and point it toward the unzipped package and wait for it to completely install it.
[8:29 PM]
After that, probably a good idea to make a new folder in the Assets directory, call it whatever or TextureArrays
[8:30 PM]
Right click on the new folder and select the option to create a new Texture2dArray
[8:30 PM]
The new texture mod requires 3 arrays in total
[8:30 PM]
The first array will contain all your base color/diffuse textures
[8:31 PM]
The second array will contain the normal maps
[8:31 PM]
The third array will contain your metallic gloss, roughness, emission, ambient occlusion maps
[8:32 PM]
The slice index is very important and each set must match for each texture set.
[8:33 PM]
If a picture of wood is set to index 1, then the normal must go in index 1 of the second array, and the metallic map goes in index 1 in the third array, likewise
[8:34 PM]
I recommend using a placeholder image for index 0 due to the way the paint brush identifies index 0 as a way to "erase" a paint
[8:34 PM]
Basically, start placing all images at index 1. All three arrays will require a blank/black/whatever image in index 0.
[8:35 PM]
Once all three arrays are complete, make sure you hit the Apply button for the array to save, within Unity.
[8:35 PM]
Then select all three arrays and export the bundle using Xyth's export script
[8:36 PM]
Next, you need to modify my mod xml located in the Config folder. You need basic xml and xpath knowledge to change my defaults to whatever you like.
[8:37 PM]
Modify the uv mapping.xml to match the blocks.xml id's
[8:38 PM]
UV mapping file, the ID will correlate to the ID in blocks.xml. The index number will correlate to the slice index of the texture2darray within Unity
[8:38 PM]
Make sure all the numbers match up.
[8:39 PM]
Trial and error go a long way to understanding.
[8:39 PM]
Good luck
49aeb40ba3c0130dfbeb560f38fdd3f9.webp?si

V12/17/2020

I missed a step in there regarding some variable that probably needs to change within the InitHarmony.cs file, particularly, the name of the texture arrays need to match here:
public static string MyTextureArrayDiffuse = "ta_NewBlockTest";
public static string MyTextureArrayNormal = "ta_NewBlockTest_n";
public static string MyTextureArraySpecular = "ta_NewBlockTest_s";
[8:49 PM]
Either make your file names the same, or change those variables in the .cs file
×
×
  • Create New...