• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by ZoMask · Mar 28, 2011 at 05:57 AM · textureorthographicvague

Orthographic 2D camera texture is vogue and fuzzy

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[i] = 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;           

}

}

Vague Pic result:

alt text

Clear Pic result:

alt text

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by Brady · Mar 29, 2011 at 02:15 AM

The non-power-of-2 size issue is definitely one possible culprit. If that is set to size to another power-of-2, then Unity will resize it, applying filtering in the process, resulting in image quality degradation. SpriteManager 2 gets around this by copying your image data, exactly as it is, to an atlas texture that is already a power-of-2, resulting in a clean image.

But from your reply it sounds like you tried setting that to "None", if it not, make sure you've set it to "None". But I'm not sure what else would cause fuzziness since you seem to already have taken all the other steps to eliminate fuzziness, and since you are using point filtering, if the issue were related to sizing, you would be getting jagged looking artifacts, rather than smoothed-out fuzziness. Which points to a non-power-of-2 resizing issue.

Regarding sizing, I'd recommend setting your camera's orthographic size to 1/2 the target resolution height (i.e. in this case 160, or 320/2). That way, if you want an object that is 480x320, you just set its size/scale to 480,320. Though with an ortho size of 10, 30x20 should yield the same result. It's just easier to compute the other way.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image ZoMask · Mar 29, 2011 at 07:00 AM 0
Share

Brady ,Thanks for your help!! I've found out the reason, texture size 480x320, no power of 2,the d3d device maybe change it's size to power of 2, I donn't quite understand this... I just build project to exe , and see it runs in d3d PIX ...Then I use a texture 512x512 contains my original texture,like your build to atlas , the result is O$$anonymous$$. Thank you very much, and your S$$anonymous$$2. :-)

avatar image
0

Answer by AngryOldMan · Mar 28, 2011 at 11:48 AM

on your texture that is vogue (or vague which makes more sense!) and fuzzy go into its texture importer settings and in the drop down menu swap it to advanced. Then in the drop down box next to "Non Power Of 2" select none, this helped me for the splash image trying to scale itself and therefore messing up image quaility.

For this bit "Then I create a gameObject,position (0,0,0), scale (30,20,1) because I use a 1.0f size plane in my code." what game object did you create? and why have you scaled it like that? It's not poor english that's letting you down it's a poor explanation as to what your trying to achieve, what you already have and the errors you're encountering.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image ZoMask · Mar 28, 2011 at 12:56 PM 0
Share

$$anonymous$$aybe I did not explain clearly enough, sorry .I want to display 2D plane with screen size 480x320. And I have selected texture to Non Power Of 2 . I just created an empty gameobject , position(0,0,0),scale(30,20,1) because I create a plane with a size 1.0f in code, and I hope the plane has the full screen size 480x320. So I set the scale to (30,20),to match my Orthographic camera's size 10.0f.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

No one has followed this question yet.

Related Questions

2D plane not drawing texture correctly 2 Answers

Jagged / blurry textures on square gameobject when using ortho cam and no mipmaps 1 Answer

Assigning UV Map to model at runtime 0 Answers

How to add texture to Blender objects properly? 2 Answers

How to prevent mipmaps from blurring textures 3 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges