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
0
Question by reppiz01 · Aug 30, 2013 at 07:20 AM · meshproceduralgenerationvisible

By Code generated Mesh (problems with visibility)

Hey guys,

i tried to generate mesh by code, and what should i say, once i got it it works quite good. there is just one thing i don´t understand. when i create something like a plane, or a flat circle, it is just visible from one side. how can i define on which side (which axis) the mesh is visible?

does it depend on the vertices, the triangles, the uvs ???

would be nice if someone can tell me.

Comment
Add comment · Show 1
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 Storm024 · Aug 30, 2013 at 08:21 AM 0
Share

$$anonymous$$ost likely it is the vertices, try switching the locations of two of them and tell me what happens.

4 Replies

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

Answer by Hoeloe · Aug 30, 2013 at 09:17 AM

While saschandroid is right, that solution will still keep it only visible from one side, but the opposite one. The reason this occurs is because of a technique known as "backface culling". Backface culling is a technique to speed up rendering in 3D scenarios, by ignoring the back side of any models. Usually, this is not an issue, because the "back face" is inside the mesh, so you'll never see it anyway. The only time it becomes a problem is when you have a flat object. Fortunately, you can fix it with shaders. You'll have to use a custom shader, but usually it's just a case of adding the line Cull Off into it. Unfortunately, this has the problem that both sides of the object will be lit the same, so if there is harsh directional light on one side of the plane, both sides will be lit just as brightly. The only real solution for this is to create what is essentially a very thin 3D mesh, with twice the number of triangles.

Here's some more information about backface culling and the issues involved:

http://forum.unity3d.com/threads/48919-Backface-culling-in-Unity

http://docs.unity3d.com/Documentation/Components/SL-CullAndDepth.html

EDIT: There is another solution, which uses custom shaders to render the back of objects, lit correctly. I have created a package on the asset store which can do just this. It allows for no extra triangles in the mesh (though it will still need to draw the mesh twice - once for the front and once for the back), and lights the surfaces correctly. It even supports normal maps!

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 reppiz01 · Aug 30, 2013 at 09:38 AM 0
Share

thank you all for your fast responses. in my case it is enough to set the Cull Off because i just generate the $$anonymous$$esh, to show a specific Area (just a visualisation thing).

but if i need it for more complicated things i know that i have to built the tris in an other way.

thx a lot!

avatar image
1

Answer by lxf0525 · Aug 30, 2013 at 09:05 AM

it seem like the problem of back face culling, if the normal vector(depend vertexes sequence you create ) of a triangle face, it can be seen, or it is invisible, you can set the cull off in material

Comment
Add comment · 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
1

Answer by saschandroid · Aug 30, 2013 at 09:00 AM

Which side is visible depends on how you build your triangles. Try to change the vertices order for e.g. from 0-1-2 to 2-1-0.

Comment
Add comment · 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
0

Answer by mrVentures · Jan 21 at 06:17 AM

Mesh.RecalculateBounds was the solution for me.

Comment
Add comment · 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

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

20 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

Related Questions

creating a mesh procedurally 4 Answers

Procedurally generated mesh JS - explain the error please 0 Answers

Drunkard Walk Algorithm C# Question 0 Answers

Unity3D question about the Procedural Generation engine for creatures in Spore? 1 Answer

Mesh.uv is out of range 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