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
0
Question by SleepTheDayAway · Sep 06, 2013 at 10:22 AM · texturealpha

Alpha Textures

So I made a piece of Glass in Cinema 4D and applied in Alpha Texture on it, then imported it to Unity via .fbx The glass still has its texture to it, but instead of where it should be transparent it's black. (I didn't use an Alpha Texutre in C4D, I used the same texture but as an alpha)

Comment
Add comment · Show 3
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 Hoeloe · Sep 06, 2013 at 10:53 AM 0
Share

What shader is the glass material using?

avatar image SleepTheDayAway · Sep 06, 2013 at 11:09 AM 0
Share

I'm going to assume the default one as I never applied any, I'm not very experienced with Unity.

avatar image Hoeloe · Sep 06, 2013 at 11:10 AM 0
Share

In that case, I know what your problem is. I'll write it up as an answer.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Hoeloe · Sep 06, 2013 at 11:20 AM

If you haven't set a shader for your glass material, then it will be using the Diffuse shader. This is a simple shader for un-detailed, matte objects. The problem is that it uses a feature all modern graphics cards have called the "z-buffer". Basically, working out which objects are in front of other objects is actually quite difficult. The z-buffer solves this problem by having what is essentially a copy of what you are rendering, but instead of rendering colours, it writes in the depth of the current pixel. If it comes to a pixel, and finds there is a pixel already written there, then it will ignore it if the existing pixel is in front of the new one. This means that there is per-pixel sorting of objects, which is fast and looks correct. The issue comes when you introduce any object that is transparent. If you tried to use the z-buffer on a transparent object, chances are things would mess up. For example, if the renderer drew a plane of glass, then tried to draw whatever is behind it, it would find the glass already drawn into the z-buffer. However, it can't tell that the object drawn there is transparent, so it ignores the background. The result of this is that the objects behind the glass are never drawn, and you end up with a transparent object that acts to cut out all the objects behind it. Obviously, this is not what you want. Unity resolves this issue by not allowing standard, z-buffer shaders to be use transparency. You can write your own shaders to do this, but I doubt that's what you want.

So, what you need to do is use a different shader! There actually exist some transparent shaders built into Unity (if you open your material, there is a dropdown box that has "Diffuse" written in it, you can change the shader from there). For glass, you probably want Transparent/Specular. This will allow you to see through the object (and specular means it will also have a shine to it). There are downsides to this, though. These shaders are not written into the z-buffer. Instead, they are all sorted based on the centre point of the object. This is usually absolutely fine, as long as the objects aren't large. Large object can produce sorting errors, as the centre point becomes a less accurate approximation to the actual depth of the object. You only get per-object sorting with transparent objects, rather than per-pixel. There are ways around this, but ultimately no solution is perfect. Transparency is a difficult problem in rendering, and one you have to be very careful with.

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 SleepTheDayAway · Sep 06, 2013 at 11:23 AM 0
Share

Thanks so much! This worked perfectly!

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

16 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

Related Questions

A node in a childnode? 1 Answer

How to Make a Character Flicker? 1 Answer

Avatar T-Shirt Color With Print 3 Answers

Alpha Transparency Shader Issue 1 Answer

normal map, mask different areas? 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