Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 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 Teadaddy · Apr 22, 2015 at 03:03 PM · renderingshaders

how to render double sided faces

I would like to render both sides of faces, it seems the value in savings on rendering overhead are obvious, so I expected to find a simple way to render two sided.

Alas, it has eluded me, any help?

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 termway · Apr 22, 2015 at 03:09 PM 0
Share

Duplicate : http://answers.unity3d.com/questions/36609/how-do-i-make-my-game-render-both-sides-of-a-mesh.html

TL;DR : In your shader put "Cull Off"

avatar image Teadaddy · Apr 22, 2015 at 10:59 PM 0
Share

thanks, watermy

1 Reply

· Add your reply
  • Sort: 
avatar image
2

Answer by Bunny83 · Apr 22, 2015 at 04:58 PM

There is almost no saving of "rendering overhead" when you disable backface culling instead of modelling both sides manually.

Only if you don't need any lighting. That means no shading, no specular highlight, ... just a solid color. In this case you can turn off backface culling in the shader so both sides are rendered the same way.

If you need shading / lighting you either have to:

  • model the other side as seperate face. (This is the normal, most simplest, most versatile and most used approach).

  • use a two-pass-shader where pass one renders the front side (so it does backface culling) and pass two renders just the back side (with frontface culling). The second pass would use the inverted normal vector.

Both of those two approaches have some advantages and disadvantages:

 Seperate backface                                Two pass shader
 -------------------------------------------------------------------
 + You can adjust all aspects of the face     |   - Both sides have to use the same
   manually. You can use different uv-coords, |     Vertex properties. That means
   normal and vertex colors for each face     |     textures would be mirrored on
                                              |     the backside.
 - If you have a lot double-sides faces you   |   + If you only have double sided
   need a vertex / index buffer with about    |     faces you can store more faces 
   double the size.                           |     in a single mesh
 
 * In both cases the computational overhead is almost the same, since the seperate
   backface requires an additional face to be rendered and the two pass shader will
   render the same face twice which results in the same overhead.

That's why in general it's more convenient to have the backface as seperate face since it allows you to use custom UV coordinates, normals, vertex colors, ... for each face.

The GPU has a rendering pipeline. It's optimised for doing the same operations on huge amount of data. So the saved amount of data when using a two-pass shader is only a marginal gain over the disadvantages that comes with that approach.

In case you don't need any lighting (and in case you use textures it's fine that the backside is mirrored) you can simply turn off backface culling in your shader like mentioned by @watermy above.

Comment
Add comment · Show 2 · 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 Teadaddy · Apr 22, 2015 at 10:58 PM 0
Share

Thanks for your very thorough answer, I assumed that one object was preferable to two, but I guess you are right, it would need to render basically the same number of faces either way-

avatar image Bunny83 · Apr 23, 2015 at 12:39 AM 0
Share

@Teadaddy: Be careful! I never said two objects (which would mean two seperate draw calls). This would be a bad idea, although Unity might batch those two objects into one draw call.

What i meant was to have a mesh that has geometry for both sides.

For example a normal single quad mesh has 4 vertices and 6 indices (2 x 3). A double sided quad that actually has two seperate faces is simply a mesh with 8 vertices and 12 indices (4 vertices for each side and 2 triangles per side == 2 sides 2 triangles 3 indices == 12).

As mentioned above the GPU is a beast. It makes almost no difference if you render a mesh with one triangle or a mesh with 100 triangles.

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

Render the scene only using a given a renderType tag 2 Answers

UI Blur shader not working 0 Answers

How do I use both a color's alpha and the texture's alpha in a shader pass? 0 Answers

What exactly is a pixel light in Unity ? 0 Answers

How do I fix these clouds? 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