Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • 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
0
Question by $$anonymous$$ · Jun 01, 2012 at 10:47 AM · 2dtextureplaneimages

Creating a 2D game using planes with textures

Hey,

We are in the process of looking at the possibility of switching over to the Unity game engine for our next game. The game is going to be an isometric 2D game.

I've been doing a bit of research but it doesn't seem like there is much to go from. The biggest question in mind right now is what the best way is of working with 2D images and then texturing them onto planes to give the effect of a 2D sprite? Will you need to work at specific dimensions for the images when texturing them onto a plane surface?

I've been playing around with it a bit but it's giving some weird problems. First of all, say I have an image from the game like this:

balloon

Importing it into Unity gives some odd artifacts in the image, like so:

alt text

So the question is, how do you use 2D images on planes to create the effect of a 2D sprite? And why do we get these weird flaws and artifacts on imported images?

Comment
Add comment · Show 6
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 whydoidoit · Jun 01, 2012 at 10:50 AM 0
Share

Some of your question is covered here: http://answers.unity3d.com/questions/260935/2d-app-development.html

What format was that image in?

avatar image $$anonymous$$ · Jun 01, 2012 at 11:11 AM 0
Share

The image is in a format of 133 x 207 :)

avatar image whydoidoit · Jun 01, 2012 at 11:13 AM 0
Share

Sorry I meant file format :)

avatar image $$anonymous$$ · Jun 01, 2012 at 11:15 AM 0
Share

ah, it's in png ^^

avatar image whydoidoit · Jun 01, 2012 at 11:18 AM 0
Share

Ok so that should be cool ! not sure what's going on with that background. You know in any case if you are doing 2D you need your sprites packed into a texture or you will get far too many draw calls. $$anonymous$$y advice - buy 2D Toolkit, it's great at collision detection areas and sprites. If you don't want to buy something - check out that link I posted above - it has a link to a bunch of free things.

Show more comments

1 Reply

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

Answer by Wolfram · Jun 27, 2012 at 10:27 PM

What you see in your texture is to be expected.

First, the distortion comes from the fact that Unity scales your texture's resolution to the nearest power of two, for performance, and for quality (mipmapping will only work for power-of-two textures). If you do want to prevent this (which might be desired if you are really just doing 2D and want to display your textures at a pixel-perfect 1:1 resolution), set the texture to "GUI" instead of "Texture" in the import settings (i.e., in the inspector, after you selected your texture).

Secondly, what you see around the balloon are just the RGB values of your fully transparent pixels. Contrary to popular belief (and apparently, the who Photoshop world), fully transparent pixels do have an RGB value, and this value is important and cannot be ignored. For example, if all these pixels are fully white (or any other color), you will get pixel errors from interpolation, e.g., when using mipmapping.

As these pixels are 100% transparent (In the preview window there is a small RGB-icon. Click on it to toggle between displaying the RGB and the Alpha channel), it is generally irrelevant what RGB color they have - except for the problems I mentioned above.

To answer the rest of your question, it is quite simple to create a pixel-correct 2D-scroller in Unity. Use an orthographic camera, and set the orthographic size of your camera to half the desired vertical size of your viewport in worldcoordinates. Then place your 2D objects parallel to the camera at arbitrary distances. See any 2D game tutorials for further details.

EDIT: One more thing: The size and size distortion is not really relevant. You can map any texture of any size to a plane of your desired proportions (in your example, the plane could be 133x207, or 1.33x2.07, or something similar). The only disadvantage is that you might get interpolation problems (=slightly blurry images) if your texture resolution is too small, or one axis has much higher resolution than the other. For example, if you scale your image outside Unity to say 1024x32, it will still display correctly and undistorted when you apply it to a 133x207 sized plane. But the X resolution is wasted, since your original X resolution was much smaller, and the image will look quite blurry in Y direction, because your Y-resolution is now only 32.

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 $$anonymous$$ · Jun 28, 2012 at 06:43 AM 0
Share

Great and informative post :) Thank you very much!

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.

Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

2D texture lines 0 Answers

A node in a childnode? 1 Answer

3D Plane with Texture problems in Unity... 1 Answer

Unity2D - Box Collider 2D problem 0 Answers

How to make a plane? 2 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