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 Ragingpixels · Jul 01, 2016 at 06:30 PM · shaderlightingmaterialtransparentshaderlab

Semitransparent shader not visible in front of objects

Hey Guys,

im looking to get a Forcefield like effect with a Semitransparent Rim Shader. The shader in and of itself already looks aproximately how i want it to, i just have a problem where the Forcefield isnt visible when there is an Object behind it. It only correctly shows on the Object it encompasses and on the skybox.

Here are some screens:

http://prntscr.com/bng330

http://prntscr.com/bng2jm

http://prntscr.com/bng3cy

And here the Shader im using right now:

 Shader "Custom/Shield" {
     Properties {
         _MainTex ("Texture", 2D) = "white" {}
         _Cube ("Cubemap", CUBE) = "" {}
         _ReflColor ("Relection Color", Color) = (0.26,0.19,0.16,0.0)
         _RimColor ("Rim Color", Color) = (0.26,0.19,0.16,0.0)
         _RimPower ("Rim Power", Range(0.5,8.0)) = 3.0
         _AlphPower ("Alpha Rim Power", Range(0.0,8.0)) = 3.0
         _AlphaMin ("Alpha Minimum", Range(0.0,1.0)) = 0.5
 
     }
     SubShader {
         Tags { "RenderType" = "Transparent" }
 
         CGPROGRAM
         #pragma surface surf Lambert alpha
         struct Input {
             float2 uv_MainTex;
             float3 worldRefl;
             float3 viewDir;
             INTERNAL_DATA
         };
         
         sampler2D _MainTex;
         samplerCUBE _Cube;
         float4 _RimColor;
         float4 _ReflColor;
         float _RimPower;
         float _AlphPower;
         float _AlphaMin;
         
         void surf (Input IN, inout SurfaceOutput o) {
             o.Albedo = tex2D (_MainTex, IN.uv_MainTex).rgb;
             half rim = 1.0 - saturate(dot (normalize(IN.viewDir), o.Normal));
             o.Emission = _RimColor.rgb * pow (rim, _RimPower) + texCUBE(_Cube, WorldReflectionVector (IN, o.Normal)).rgb*_ReflColor*2 ;
             o.Alpha = (pow (rim, _AlphPower)*(1-_AlphaMin))+_AlphaMin ;
         }
         ENDCG
     }
     Fallback "Diffuse"
 }


any help would be greatly appreciated!

Edit:

after playing around with it some more im now even more confused. The following pictures are of 3 cubes with the same standard shader. Depending on the Distance some Cubes work and others dont. There isnt a specific Range where they work or dont work either. The shield just flickers in and out of existance every step i take.

http://prntscr.com/bomvze

http://prntscr.com/bomwmp

http://prntscr.com/bomw9i

http://prntscr.com/bomww1

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 Namey5 · Jul 06, 2016 at 03:39 AM 0
Share

I maybe say this too often, but a lot of the time this is the Unity 5 render queue bug. If you switch the material to another shader and then back it should fix that (if it is the problem), and you can check by selecting the material in debug mode.

https://docs.unity3d.com/$$anonymous$$anual/InspectorOptions.html

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by Ragingpixels · Jul 06, 2016 at 09:03 PM

Alright Guys i figured it out. There was nothing wrong with my Shader but it wasnt shown correctly due to the following Bug in Unity:

Unity BugTracker

All i needed to do was to change the shader in my material to a different one and back to update the renderqueue used.

Please consider voting for this Bug, as it can cost hours of time figuring it out if you dont know the bug exists

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

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

Rendering an entire object as transparent 1 Answer

Reflector shader? (not reflection) 1 Answer

How is IN.worldRefl calculated? 1 Answer

Transparency working in the editor but not when I build 0 Answers

how to make a single object lit differently by 2 lights source of same kind 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