Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 oliver-jones · Jun 12, 2017 at 01:05 PM · shadermaterialtransparent shaderzdepth

Standard Shader - Transparent/Fade Issue

Hello,

I have a model of a car that is currently using the Standard-Opaque shader, with a metallic look applied to it.

At some point in my game, I wish for this car to Fade out, by turning Transparent. However, when I change the material to Standard-Transparent, the mesh z-depth appears very incorrect.

alt text

As you can see, mesh from a non-visible angle are appearing. In fact using the Transparent / Fade shader on any complex mesh always gives incorrect results.

Am I missing something here?

alt text

screen-shot-2017-06-12-at-140309.png (237.4 kB)
screen-shot-2017-06-12-at-140549.png (50.6 kB)
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 Cherno · Jun 12, 2017 at 03:16 PM 0
Share

This is considered normal behaviour. Even modern graphic cards have trouble z-sorting of surfaces on the same object, which means that there is only one way around it, which may or may not be applicable to you: Each transparent surface that is behind another transparent surface needs to be part of a seperate gameobject.

6 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by Insurecti · Jun 28, 2019 at 05:15 AM

For those still struggling with this like me, Unity has a say in it: https://docs.unity3d.com/Manual/SL-CullAndDepth.html

Look under "Transparent shader with depth writes".

Like the people above said, the transparent Shaders ignore Z-Order. Just write a new Shader, using the code provided on the link. It will enable Z-Order and call the standard transparent Shader. Worked like a charm here.

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 AscendReality · Jan 12, 2021 at 12:17 AM 0
Share

Legend! This worked for me!

avatar image
0

Answer by cgarossi · Jun 12, 2017 at 03:31 PM

Have you tried changing the render queue? This happens when you have clashing materials with the same queue priority.

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 oliver-jones · Jun 12, 2017 at 05:50 PM 0
Share

Hello, regarding the body of the car - thats one entire mesh. So this wouldn't make a difference right? I can understand if it's a collection of different meshes though (like my tyre).

avatar image
0

Answer by JonPQ · Jun 13, 2017 at 01:13 AM

this is a classic computer rendering problem. transparent polygons are not sorted, they are rendered in arbitrary order. your model has a lot of internal geometry. When rendering solid... z-buffer sorting solves your issue. But not when transparent, as sorting is off.... several options.... none too simple. 1) Get a car model without so much internal geometry... it will still have the render problem, but not look as bad 2) Get a 2 pass shader... with Z-write enabled, that renders z-depth only first... then renders again the transparent polygons, will solve your issue as it will only render the closest geom, not internal geometry, but hard to find that shader perhaps. Try the unity shader wiki (I'd go with this option)

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 MatrixTai · Jun 13, 2017 at 10:21 AM

Maybe, just I guess, you should try to render the transparent part first. Open a new standard .shader, and then type

     SubShader{
         Tags {
             "Queue" = "Geometry+1001"
         }
                 Pass{...

The rendering procedural will be "Cutout -> Skybox -> Transparent -> Geometry" instead of "Geometry -> Cutout -> Skybox -> Transparent". Just my guess, I don't have material displayed like that for testing.

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 Helllllllo · Feb 03, 2018 at 08:04 AM

 SubShader{
             Pass 
         {
             ZWrite On
             ColorMask 0
         }
 ...

it work 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
  • 1
  • 2
  • ›

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

113 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 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 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 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 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

Transparency cutting opaque mesh 0 Answers

z-fighting problem with shaders 2 Answers

Material doesn't have a color property '_Color' 4 Answers

HDRP Lit Shader: How to disable Transparency "Blend preserve" through script? 0 Answers

How to change RGB base of material via scripting (Normal map + base RGB) ? 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