Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 11 Next capture
2021 2022 2023
1 capture
11 Jun 22 - 11 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 Radetic · Jul 15, 2015 at 05:09 PM · meshmeshrenderermeshfilter

Why zero height mesh gets black independent of shader

When altering the scale of a gameobject with a mesh built procedurally, I've realized it gets all blacked out in Unity5, instead of dark gray in previous versions.

Testing with the default 3D cube from "GameObject -> 3D object -> Cube" the same thing happenned, so I'm confident there's nothing particularly wrong with the mesh generation.

After a couple of trial and error experiments, 1e-12 is the smallest height for which material and color properties seem to take effect in Unity5. In Unity 4.6.1f1 it rendered the expected color with height as low as 1e-19.

Anyone knows why you can't have a zero height render itself correctly and how to do it if there's a way? The project where it's being used doesn't need them to be actually zero height, but the work around for this small problem is quite a lot of work.

Thanks in advance

Comment
Add comment · Show 2
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 zach-r-d · Jul 16, 2015 at 11:31 AM 1
Share

By zero height do you mean the y scale is zero?

avatar image Radetic · Jul 17, 2015 at 11:02 AM 0
Share

Yes, zach. Recently the code that generates procedural meshes has been altered to use transform.scale.y to set zero height due to problems arising from settting all vertices to the same height in the mesh itself.

1 Reply

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

Answer by Piflik · Jul 16, 2015 at 11:43 AM

Unity automatically flips face normals according to the sign of the numbers in the scale-vector, to prevent negatively scaled objects from turning inside out. At 0 scale, this breaks.

The cutoff at 1e-12 doesn't really make any difference compared to 1e-19, neither visaully nor mathematically. There is not much that you cannot do with 12 orders of magnitude that would be possible with 19. Especially if you factor in float-inaccuracies.

If you need flat geometry, use flat geometry, like Planes (NOT aircrafts) or Quads.

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 Radetic · Jul 17, 2015 at 11:40 AM 0
Share

The cutoff was really just a curiosity. For another part of this program we really use quads just to avoid all this pain of loosing material properties. However, a few features demand extrudable regular polygons and the work around was set the scale to keep a $$anonymous$$imum height of 1e-12.

Thanks for the attention and the insight on normals.

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

23 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

Related Questions

Submeshs doesn't combine with materials 1 Answer

Generated Mesh Triangles not Being Made/Visible? 1 Answer

Why is my script constructed mesh rotating the wrong way 0 Answers

Color not being applied properly to mesh 0 Answers

Bounds of dynamic mesh not updating 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