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 yujik · Oct 22, 2012 at 10:44 PM · shaderrenderingalpha

How to: vertex colored mesh shader that doesn't break Sprite Manager.

So I'm using this shader to display a mesh that just renders based on its vertex colors, with transparency:

 Shader "Vertex color alpha" {
 
 Category {
     BindChannels {
         Bind "Color", color
         Bind "Vertex", vertex
     }
     
     SubShader {
         Blend SrcAlpha OneMinusSrcAlpha
         Pass {}
     }
 }
 }

I don't really understand shaders, but I managed to cook it up by looking at some vertex colored shaders people had written, and then adding some stuff.

Everything was working great, and stuff that was underneath the mesh (just stuff with colored material with a generic Diffuse) shader was rendering correctly. But now I'm starting to use Sprite Manager to render some of the stuff below the mesh, and it won't render correctly anymore.

Basically anything that should be rendered with sprites by Sprite Manager doesn't render at all, if it's on the other side of this mesh. How can I change my mesh shader so that it still works the same way, but sprites on the other side will still render?

For reference, here's the Sprite Cutout shader that Sprite Manager uses:

 Shader "Sprite Cutout" 
 {
 
     Properties 
     {
         _Color ("Main Color", Color) = (1,1,1,1)
         _MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
     }
 
     Category
     {
         SubShader 
         {
             Pass 
             {
                 ColorMaterial AmbientAndDiffuse
                 Lighting Off
                 ZWrite On
                 Alphatest Greater .3
                 Cull Off
                 SeparateSpecular Off
 
                 //Blend SrcAlpha OneMinusSrcAlpha
     
                 SetTexture [_MainTex] 
                 {
                     //constantColor [_Color]
                     Combine texture * primary, texture * primary
                     //Combine texture * constant DOUBLE, texture * constant
                 }
             }
         }
     }
 } 

Any help would be greatly appreciated. Thanks!

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

Answer by Xroft666 · Oct 23, 2012 at 12:33 AM

I am not sure if I've gotten the problem.. But! As I understood, you have a mesh with your shader which is not rendered when you look at it from its back. If it is so, then here you are: a modified piece of your shader. I could give some explanations about it if it is necessary.

 SubShader {
    Blend SrcAlpha OneMinusSrcAlpha
    Cull Off
    ZWrite Off
    Pass {}
 }
Comment
Add comment · Show 3 · 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 yujik · Oct 23, 2012 at 12:47 AM 0
Share

No, the problem is that when I have a Sprite $$anonymous$$anager sprite on the other side of the mesh, the sprite isn't rendered.

Thanks for the answer though

avatar image Xroft666 · Oct 23, 2012 at 01:08 AM 0
Share

okay, random thouth:

Add also "ZWrite Off"

All transparents must not write to z buffer

avatar image yujik · Oct 23, 2012 at 01:15 AM 0
Share

Awesome! `ZWrite Off` did the trick. Thanks so much.

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

10 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

Related Questions

Model Head not Rendering correctly. 0 Answers

custom shader error. copy of "Nature/Tree Soft Occlusion Leaves" 0 Answers

Shader alpha setting being ignored? 1 Answer

COLORMASK & writing to multiple render targets In Deferred doesn't work as expected in DX9 1 Answer

Shader not working properly on Android 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