Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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
1
Question by mjl1029 · Sep 11, 2021 at 08:25 PM · imageanglesfill

Image Radial Fill Incorrect

Hi all,

I'm trying to display a hexagonal power meter that fills radially. To do this, I have an image of a pointy top hexagon with Radial 360 fill with an origin at the bottom filling clockwise. However some of the angles of this fill are incorrect.

For example, if I want to fill up to 120 degrees from the bottom (the north west corner of the hexagon), the fill does not align with the corner. I've set the fill amount to 120 / 360 = 0.333 heximageat120

To show what the correct angle should be I've added a line image with its rotation set to -120 degrees. This lines up perfectly where I want the fill to line up. The line is correctly at the north west corner of the hexagon, but the fill is off. incorrectangleat120

The fill is incorrect at most angles, but it is correct at 90 degree increments (0, 90, 180, 270). It is just between those angles where the fill does not line up correctly.

I'm trying to write some code to add an offset to correctly line up the fill, but I would rather fix the root cause. Have I made an incorrect assumption? The fact that 90 degree angles work makes me think radians are involved, but I'm not sure how. Any help is much appreciated.

Thanks!

heximageat120.png (34.8 kB)
incorrectangleat120.png (49.4 kB)
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 Bunny83 · Sep 11, 2021 at 10:27 PM

Well, the issue is most likely that your image is not square, so there will be all sorts of scaling issues. I just did some measurements in gimp and the visible area is about "3° larger" but only because of the aspect ratio issue. When you take the tan of 30° and multiply it by half the width of your image you get the pixel offset on your desired line. However if you "correct" the value by the aspect ratio of your image (which is 812 / 707 == 1.1485) You get exactly the area visible. So when you want to do any radial things, you should make sure your image is actually square and is not stretched nonuniformly.

Comment
Add comment · Show 3 · 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 mjl1029 · Sep 11, 2021 at 11:11 PM 1
Share

Thanks for your response! I'm not sure I understand. If the image was distorted or stretched, wouldn't the line be off as well? Both the image and the line are at the same origin, with the line being angled at 120 degrees from the bottom. I would expect the line to be off if the image was distorted or stretched. Just to test, I made the image square and made sure it has a 1:1 aspect ratio and it still has the same issue. I've attached it to this comment. (To be clear, hexagon in the image is not square. It's a hexagon :P) alt text

energyhexspellpower.png (3.4 kB)
avatar image Bunny83 mjl1029 · Sep 12, 2021 at 01:01 AM 1
Share

Well, I quickly tested your image and the issue seems to be related to the mesh generated from your transparent mesh. When you switch to full rect, the issue is gone. Also when you increase the "Extrude Edges" when using the normal mode "tight", the issue also decreases. So it seem sto be an issue with the proper UV mapping in the shader or something like that. I haven't dug any deeper.


It's really a bit strange. You may want to file a bug report in Unity. When you do, make sure you give clear instructions (setting fill amount to 0.3333333 and toggling between tight and full rect to see the difference). Maybe they can investigate.

avatar image mjl1029 Bunny83 · Sep 12, 2021 at 01:26 AM 1
Share

Yep, switching the mesh type to full rect fixed the issue. Thanks for your help! I'll look into filing that bug.

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

127 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 avatar image avatar image

Related Questions

How to change the end of image with type "Filled" 1 Answer

Image Fill Bug 0 Answers

image.fillamount doesnt decrease 1 Answer

Image custom fillOrigin 1 Answer

Fill an image with multiple colors? 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