- Home /
iOs weird textures (good on android) the reason? How to fix ?
So, I'm having trouble with textures on iOs platform builds. There is no problem on Android platform or PC platform. Here's the problematic scene and normal one on android platform settings. I'm using Unlit/Transparent shader for textures and I'll show you the textures I'm using for body parts. Basically I have body parts as planes with different z-offsets.
According to my search problem might be appearing because of Texture Compression on build settings. Android texture compression settings is -> Generic and I know iOs one is native PVRT but not sure how to fix it or if it's the problem is
This is the Problematic One:
This is normal one ( one that appears on android and PC)
And these are the example textures of one type
Thank you..
One quick update . If I change texture type to Advanced it looks like normal.. Is it good approach to solve that problem ?
Answer by DoktorAce · Nov 30, 2011 at 03:22 PM
By switching to advanced you'll have the possibility to turn of mip maps, which could be a good idea for a 2D game. But I would say that the iOS Compression (PVRTC) generally does a poor job on the alpha channel.
On most of the iOS projects I've worked on we've solved this by putting images alpha in another texture. This will allow hard and good compression on the color channel while leaving the alpha channel uncompressed (8bit). Its very simple to do in unity. Just duplicate a texture and call give it a suffix like alpha, and then just compress it as 8bit.
Here is a shader example that takes color and alpha as separate textures.
Shader "Custom/MobileAlphaBlendedSeperateAlpha" {
Properties {
_MainTex ("Color Texture", 2D) = "white" {}
_AlphaTex ("Alpha Texture", 2D) = "white" {}
}
Category {
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
Blend SrcAlpha OneMinusSrcAlpha
Cull Off Lighting Off ZWrite Off ZTest Always
BindChannels {
Bind "Color", color
Bind "Vertex", vertex
Bind "TexCoord", texcoord
}
SubShader {
Pass {
SetTexture [_MainTex] {
combine texture * primary
}
SetTexture [_AlphaTex] {
combine previous, texture
}
}
}
}
}
In some cases we've even reduce the color textures size from say 512 to 256, but keeping the alpha at 512, to save even more space. It usually looks good enough.
Here is another useful example where you can set a blending value which allows you to fade your graphics in and out.
Shader "Custom/MobileAlphaBlendedSeperateAlpha BLEND" {
Properties {
_MainTex ("Color Texture", 2D) = "white" {}
_AlphaTex ("Alpha Texture", 2D) = "white" {}
_Blend ("Blend Ammount", Range (.01, 0.99)) = .99
}
Category {
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
Blend SrcAlpha OneMinusSrcAlpha
Cull Off Lighting Off ZWrite Off ZTest Always
BindChannels {
Bind "Color", color
Bind "Vertex", vertex
Bind "TexCoord", texcoord
}
SubShader {
Pass {
SetTexture [_AlphaTex] {
ConstantColor(1,1,1,[_Blend])
combine texture * constant
}
SetTexture [_MainTex] {
combine texture, previous
}
}
}
}
}
Ps. Those are some cute looking characters! :D
Oh, and those lines on the top end right of the characters could be caused by the texture Wrap $$anonymous$$ode being set to "Repeat", try setting it to "Clamp". It should fix that problem. But I think its a result of lower mip map levels being used, so disabling mip maps would probably fix it to.