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
0
Question by solmyr · Jun 30, 2011 at 09:46 AM · shadertransparent

Transparent shader with Z-buffer and interlacing objects

Hi. I've a shader problem.

I'm doing an application than renders human organs where the user can rotate the camera around the body and can change the alpha level of each organ independently.

I do not use Unity transparent shader because it doesn't write to the zbuffer (some organ like the alimentary canal have parts that overlay each other (and I want to show the organ as a whole with transparancy)) -> so i used 2 passes in the shader (like this : http://www.unifycommunity.com/wiki/index.php?title=AlphaVertexLitZ). It works fine when I display only one object.

The problem is that when I want to display several transparent objects, when I change the camera orientation, some parts are not displaying. Changing manually the render queue is not a solution because it's the camera (controlled by the user) that determines which object are displayed first. It's particulary annoying with veins and arteries because some parts are inside an organ and other parts are external.

I found several topics in the forum talking about this (here and also here) but haven't found a solution adapted to my problem.

So I don't know how to help the algorithm to display things back to front to solve this depth sorting problem without manually using render queue and ? Any hints ? Thanks by advance.

Tom

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

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Waz · Jun 30, 2011 at 01:14 PM

You could break your meshes up into smaller pieces such that they could be sorted. Seems cumbersome though.

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 solmyr · Jun 30, 2011 at 01:22 PM 0
Share

Thanks, we thought about this as a last resort solution. We'll give it a try. I assume this is a computer graphics limitation (transparency with zbuffer with interlacing objects). It's not me but the graphic artist that will not be enjoyed by this solution ;) (nevertheless I'll still have to adapt some code to make other features work again).

avatar image
0

Answer by Waz · Jun 30, 2011 at 01:20 PM

Have you tried other shading styles, such as varying the alpha with the angle to the camera (like rim lighting). That can often show internal structure better than normal flat transparent shading, while still not writing to Z buffer. After all, you're not trying to render reality.

Like this shader does.

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 solmyr · Jun 30, 2011 at 01:40 PM 0
Share

Thanks again :), i'll try it tomorrow (I'm implementing another feature now and I my brain doesn't like more than one "program$$anonymous$$g thread").

avatar image Evil-Dog · Apr 17, 2012 at 03:14 AM 0
Share

Any solution found to this dude? I'm also having the same problem. If I have an object with transparency using this shader and an another object using that same shader but sligthly behind the first object, it won't show even if the first object has transparency.

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Is there a way to get scene color after transparent pass in URP using the new 2D Renderer ? 0 Answers

Problem with transparent shader on iOS 0 Answers

Object not effected by transparent object in front 1 Answer

Transparent Solid Color Shader 2 Answers

Making a color transparent in shaders 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