Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 gerudoking · Apr 05, 2018 at 06:08 PM · camerascalesizeortographic

Formula for the scale value of an object based on ortographic camera size?

Hello,

I'm having some problems scaling objects to their expected size. I'm using an ortographic camera of size 540(half of 1080, wich is the base height I'm working with). I have an object with an sprite that has a size of 32x32 pixels. And there's the problem. It seems a lot smaller than what it should, and I do not know wich value I should scale so that it looks "correct".

Is there a formula that could be used to calculate the object scale value so that it looks like 32x32(the "correct", expected size)in the world?

Thanks in advance!

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

1 Reply

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

Answer by pako · Apr 05, 2018 at 08:25 PM

There is no "correct", expected size really. I mean, the "expected" is subjective, so, I assume that by "expected" you mean "desirable" size.

I have no formula, but I'll explain by example. Here's how I go about it:

If a sprite is 32 pixels high, in a screen 540 pixels high, it will occupy (32/540)x100 percent of the screen height. This equals to 5.9% (0.059 x100) of the screen height. In a mobile phone whose display has a height of, for example, 6 cm, the sprite will appear as 5.9% of 6 cm in height, which is 0.059x6 = 0.35 cm (3.5 mm), since the 6 cm correspond to 540 pixels in height.

In another mobile phone which also has a display of height 6 cm, but its resolution is 1080 pixels in height, the 32 pixels will represent 0.03 (32/1080 rounded) of the screen height, so the sprite will appear as 0.03x6 = 0.18 cm (1.8 mm - there's some rounding error here, but that's beyond the point).

So, what is the "desirable" size?

Well, you'd better start from the end of the above calculation, and work towards the beginning:

You have a mobile phone of 6 cm display and 540 pixels resolution in height. Your desirable height on screen for your sprite is 7 mm, i.e. 0.7 cm. So, you want your sprite to cover 0.7/6 = 0.117 of the height of your phone. Since your phone is 540 pixels in height, you need your sprite to be 0.117x540 = 63 pixels.

Therefore, you need your sprite to be 63 pixels in height, which is close enough to 64 pixels, and since your original sprite is 32 pixels, you could either apply a x2 scaling, which will make it look very pixelated, or create a 64 pixel in height sprite directly.

With your 32x32 square sprite you work with height, because it's convenient for you to do so, but you could also do a similar calculation with width, if it was convenient for you to set the desirable screen size for your sprite in in width. And if your sprite is rectangular, and you want to create a sprite from scratch, you could do the above calculation for both height and width.

Of course, this can be applied to any screen resolution and aspect ratio.

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 gerudoking · Apr 09, 2018 at 11:27 PM 1
Share

Now I get it. Unity is indeed a very well made engine. Thanks a lot!

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

125 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

With a perspective camera: Distance independent size gameobject 5 Answers

Newbiew question: how to size objects? 1 Answer

SmoothDamp bounce effect 0 Answers

Change camera ortographic size to fit the content 1 Answer

Unity camera size issue 1 Answer


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