Skip to main content
Search
Search This Blog
Leegoonz game Developer blog.
Visual strategy development lab Technical Art Director. Now working atAllegorithmic.
페이지
Home
About Leegoonz
LEEGOONZ.COM
ADVANCED SHADER DOT COM
ADVANCED SHADER FACEBOOK COMMUNITY
Substance user group in korea
More…
Share
Get link
Facebook
X
Pinterest
Email
Other Apps
Labels
Unity3D Study
March 11, 2013
텍스쳐 임포터 옵션 정리.
using UnityEditor; using UnityEngine; using System.Collections; /* * 2012/12/14 * Extended Author Leegoonz http://leegoonz.blogspot.com email : leegoon73@gmail.com Twitter is @leegoonz * It is for custom platform texture, that format importing setting up script original ref. script by http://limchaeng.tistory.com/22 He guys are Unity game dev. Nickname is "limchaeng" * It should selected your target textures and mouse right click and you can find in dropdown menu "TextureFormatChanger" */ public class TextureFormatChanger : ScriptableObject { // ---------------------------------------------------------------------------- #region [MenuItem("Assets/TextureFormatChanger/Android/Wayne/DXT with None LinearSpace")] static void ChangeTexture() { SeletedChangeTexture(); } static void SeletedChangeTexture() { Object[] textures = GetSelectedTextures(); Selection.objects = new Object[0]; int count = 0; foreach (Texture2D texture in textures) { count++; string path = AssetDatabase.GetAssetPath(texture); TextureImporter textureImporter = AssetImporter.GetAtPath(path) as TextureImporter; textureImporter.SetPlatformTextureSettings("Android", 4096, TextureImporterFormat.DXT5); textureImporter.anisoLevel = 1; textureImporter.isReadable = true; textureImporter.linearTexture = false; textureImporter.filterMode = FilterMode.Trilinear; //textureImporter.wrapMode = TextureWrapMode.Clamp; textureImporter.mipmapEnabled = true; textureImporter.npotScale = TextureImporterNPOTScale.None; AssetDatabase.ImportAsset(path); Debug.Log(string.Format("[{0}/{1}] ChangeTexture progress : {2}", count, textures.Length, path)); } } [MenuItem("Assets/TextureFormatChanger/Android/Wayne/DXT with LinearSpace")] static void ChangeTexture_SRGB() { SeletedChangeTexture_SRGB(); } static void SeletedChangeTexture_SRGB() { Object[] textures = GetSelectedTextures(); Selection.objects = new Object[0]; int count = 0; foreach (Texture2D texture in textures) { count++; string path = AssetDatabase.GetAssetPath(texture); TextureImporter textureImporter = AssetImporter.GetAtPath(path) as TextureImporter; textureImporter.mipmapEnabled = true; textureImporter.anisoLevel = 3; textureImporter.isReadable = true; textureImporter.filterMode = FilterMode.Trilinear; textureImporter.linearTexture = true; textureImporter.generateMipsInLinearSpace = true; //textureImporter.wrapMode = TextureWrapMode.Repeat; textureImporter.textureType = TextureImporterType.Advanced; textureImporter.mipmapEnabled = true; textureImporter.npotScale = TextureImporterNPOTScale.None; textureImporter.SetPlatformTextureSettings("Android", 4096, TextureImporterFormat.DXT5); textureImporter.compressionQuality = (int)TextureCompressionQuality.Best; AssetDatabase.ImportAsset(path); Debug.Log(string.Format("[{0}/{1}] ChangeTexture progress : {2}", count, textures.Length, path)); } } [MenuItem("Assets/TextureFormatChanger/Android/Wayne/LightMap")] static void ChangeTexture_LightMap() { SeletedChangeTexture_LightMap(); } static void SeletedChangeTexture_LightMap() { Object[] textures = GetSelectedTextures(); Selection.objects = new Object[0]; int count = 0; foreach (Texture2D texture in textures) { count++; string path = AssetDatabase.GetAssetPath(texture); TextureImporter textureImporter = AssetImporter.GetAtPath(path) as TextureImporter; textureImporter.textureType = TextureImporterType.Lightmap; textureImporter.anisoLevel = 1; textureImporter.filterMode = FilterMode.Trilinear; textureImporter.linearTexture = true; textureImporter.textureFormat = TextureImporterFormat.AutomaticTruecolor; textureImporter.SetPlatformTextureSettings("Android", 4096, TextureImporterFormat.AutomaticTruecolor); LightmapSettings.bakedColorSpace = ColorSpace.Linear; AssetDatabase.ImportAsset(path); Debug.Log(string.Format("[{0}/{1}] ChangeTexture progress : {2}", count, textures.Length, path)); } } #endregion #region ANDROID NORMAL [MenuItem("Assets/TextureFormatChanger/Android/No Tegra/ATC8")] static void ChangeTexture_Android() { SeletedChangeTexture_Android(); } static void SeletedChangeTexture_Android() { Object[] textures = GetSelectedTextures(); Selection.objects = new Object[0]; int count = 0; foreach (Texture2D texture in textures) { count++; string path = AssetDatabase.GetAssetPath(texture); TextureImporter textureImporter = AssetImporter.GetAtPath(path) as TextureImporter; textureImporter.SetPlatformTextureSettings("Android", 2048, TextureImporterFormat.ATC_RGBA8); textureImporter.anisoLevel = 0; textureImporter.linearTexture = false; textureImporter.filterMode = FilterMode.Bilinear; textureImporter.wrapMode = TextureWrapMode.Clamp; textureImporter.mipmapEnabled = false; textureImporter.npotScale = TextureImporterNPOTScale.None; AssetDatabase.ImportAsset(path); Debug.Log(string.Format("[{0}/{1}] ChangeTexture progress : {2}", count, textures.Length, path)); } } [MenuItem("Assets/TextureFormatChanger/Android/No Tegra/LightMap")] static void ChangeTexture_Android_LightMap() { SeletedChangeTexture_Android_LightMap(); } static void SeletedChangeTexture_Android_LightMap() { Object[] textures = GetSelectedTextures(); Selection.objects = new Object[0]; int count = 0; foreach (Texture2D texture in textures) { count++; string path = AssetDatabase.GetAssetPath(texture); TextureImporter textureImporter = AssetImporter.GetAtPath(path) as TextureImporter; textureImporter.textureType = TextureImporterType.Lightmap; textureImporter.anisoLevel = 1; textureImporter.filterMode = FilterMode.Trilinear; textureImporter.linearTexture = false; textureImporter.SetPlatformTextureSettings("Android", 2048, TextureImporterFormat.AutomaticTruecolor); LightmapSettings.bakedColorSpace = ColorSpace.Gamma; AssetDatabase.ImportAsset(path); Debug.Log(string.Format("[{0}/{1}] ChangeTexture progress : {2}", count, textures.Length, path)); } } #endregion static Object[] GetSelectedTextures() { return Selection.GetFiltered(typeof(Texture2D), SelectionMode.DeepAssets); } } #endif
Game Developer Leegoon copyright all right reserved since 2010.
Comments
Popular Posts
December 14, 2013
AO with Gamma Control for Matcap bump Unlit shader
May 05, 2012
유니티 기본 스플레시 이미지 없애고 커스텀 스플레시 이미지 사용 하여 앱 인트로 제작 하기.
Comments
Post a Comment
덧글쓰기 기능 있는거 아시죠? ㅋㅋ