I'm making a 2D iphone game using unity3D,now I met a question is my texture is vogue and fuzzy. I want to create a full screen size background 480x320.
I use :
Orthographic camera ,size 10.
Screen size is 480x320.
a texture size 480x320, Filter Mode Point ,No Power of 2 ,No Mipmaps, Texture Format RGBA32bit.
Then I create an gameObject,position (0,0,0), scale (30,20,1) because I use a 1.0f size plane in my code.This is to match my orthographic camera size 10.0f. Then I get a full screen size background, but it's fuzzy,not very clearly. 2D game needs a clearly picture,but I donn't know what's wrong. Then I tried a unity3D 2d-plug-in called SpriteManager2 , it's result is right. You can see my result pic, there is some difference between them ,
Can any one help me? Thank you very much,sorry for my english.
Here is my code:
using UnityEngine; using System.Collections;
public class TestSprite : MonoBehaviour {
protected MeshFilter meshFilter;
protected MeshRenderer meshRenderer;
protected Mesh m_mesh; // Reference to our mesh
protected Vector3[] m_vertices = new Vector3[4];
protected Color[] m_colors = new Color[4];
protected Vector2[] m_uvs = new Vector2[4];
protected int[] m_faces = new int[6];
// Use this for initialization
void Start ()
{
meshFilter = (MeshFilter)gameObject.GetComponent(typeof(MeshFilter));
meshRenderer = (MeshRenderer)gameObject.GetComponent(typeof(MeshRenderer));
m_mesh = meshFilter.sharedMesh;
Init();
}
void Init()
{
if(null==m_mesh)
{
meshFilter.sharedMesh = new Mesh();
m_mesh = meshFilter.sharedMesh;
}
//vertices
m_vertices[0] = new Vector3(-0.5f , 0.5f , 0);//new Vector3(0,1,0);
m_vertices[1] = new Vector3(-0.5f , -0.5f , 0);//new Vector3(0,0,0);
m_vertices[2] = new Vector3(0.5f , 0.5f , 0);//new Vector3(1,1,0);
m_vertices[3] = new Vector3(0.5f , -0.5f , 0);//new Vector3(1,0,0);
//uvs
m_uvs[0] = new Vector2(0.0f , 1.0f );
m_uvs[1] = new Vector2(0.0f , 0.0f);
m_uvs[2] = new Vector2(1.0f , 1.0f );
m_uvs[3] = new Vector2(1.0f , 0.0f);
//colors
for(int i=0;i<4;i++)
{
m_colors *= Color.white;*
*}*
*//index*
*m_faces[0] = 0;*
*m_faces[1] = 2;*
*m_faces[2] = 1;*
*m_faces[3] = 2;*
*m_faces[4] = 3;*
*m_faces[5] = 1;*
*m_mesh.vertices = m_vertices;*
*m_mesh.colors = m_colors;*
*m_mesh.uv = m_uvs;*
*m_mesh.triangles = m_faces;*
*meshFilter.mesh = m_mesh;*
*}*
*```*
*<p>}</p>*
*<p>Vague Pic result:</p>*
*<p><img src="http://i55.tinypic.com/2eurhcm.jpg" alt="alt text"></p>*
*<p>Clear Pic result:</p>*
*<p><img src="http://i52.tinypic.com/1on7yf.jpg" alt="alt text"></p>*