• 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 minimum 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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



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

Im reading a .obj file and converting it to a mesh (doesnt work) 0 Answers

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

Bounds of dynamic mesh not updating 1 Answer

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges