Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 ssb · May 23, 2014 at 10:36 AM · meshprocedural-generation

What is the standard way to generate a double-sided quad in code?

I've been following this tutorial on procedural mesh generation:

http://jayelinda.com/modelling-by-numbers-part-1b/

In the part where they generate the house, there's an issue where the eaves on the opposite side of the roof are invisible because of backface culling. They remedy this by generating an identical quad in the same spot and changing the triangle indices so it will be visible. But this causes issues with depth since they're in the same spot, so their solution is to move one mesh slightly apart from the other.

Whenever I see a solution like this I can't help but feel it's a little bit of a hack, and I feel a little OCD about avoiding it. But in this case I'm not experienced enough to say if this is the best way or if there is a better alternative.

So what is the best way to generate geometry that is double sided?

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
4
Best Answer

Answer by CHPedersen · May 23, 2014 at 11:51 AM

Typically, doubling the geometry is the best way to do it. Some people suggest using a shader that disables backface culling. This method works too, but isn't typically recommended because it introduces more complexity than really is necessary for handling the lighting correctly on the backside, where the normals face away from the surface. So the most robust way is to just double it CPU-side like in your example.

I'm a little confused about the relevance of the depth issue though. I searched through the article you linked to for references to depth, and the area where they treat this talks about the issue being between the house's roof and its walls (the very top of the walls would Z-fight the rooftop where they connect). This is to do with two different bits of the geometry for the house, and not related to doubling geometry to achieve two-sidedness.

Unless I found the wrong section, you shouldn't need to worry about that.

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 ssb · May 24, 2014 at 07:06 AM 0
Share

Thank you, I realize now that I was just not reading carefully enough and I focused on the mesh doubling.. even though intuitively I wondered why it would matter.

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

21 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

Related Questions

Program that generate a mesh from 3 images. What was its name? 0 Answers

How to generate a grid for procedurally generated platforms 1 Answer

C# Proceducal Mesh terrain 2 Answers

What is wrong with this mesh editing code? 0 Answers

Vertex Colors not smooth enough? 0 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