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
4
Question by alexnode · Oct 02, 2010 at 04:10 PM · shadertransparentsurfacereflective

Unity 3, Why custom Surface Shader (Transparent Reflective) doesn't render against background?

Hi i am experimenting a bit with the Surface Shaders. I try to write a Transparent Reflective one, But i have a problem,

It works perfectly in things that they are close, but against the skybox and far objects it dissapears. Doesn't render.

am trying to tweek LOD with no success , ZWrite On and Off Cull Off ... it seems that I am missing something . It is my first time trying to write a shader so I think that I make a basic mistake. Any help ?

Shader "Myshaders/TransparentReflective" { Properties { _Color ("Main Color", Color) = (1,1,1,1) _Cube ("Cubemap", CUBE) = "" {} } SubShader { Tags {"RenderQueue"="transparent" "RenderType"="transparent" } LOD 4000 ZWrite On Cull Off

     CGPROGRAM
     #pragma surface surf Lambert alpha



     struct Input {
         float3 worldRefl;
         float4 _Color;
     };
     samplerCUBE _Cube;
     float4 _Color;
     void surf (Input IN, inout SurfaceOutput o) {
         o.Albedo = _Color.rgb;
         o.Emission = texCUBE (_Cube, IN.worldRefl).rgb*_Color.rgb;
         o.Alpha = _Color.a;
     }
     ENDCG
 } 
 FallBack "Transparent/Diffuse"

}

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 alexnode · Oct 02, 2010 at 06:03 PM 0
Share

It appears that it doesn't render more than 7 textures in the background ! IF a put a huge sphere for example in the background with the default shader the shader renders the cubemap properly. if i assign a texture to the sphere then the shader doesn't render in front of the object. It can render around ten objects with textrues but no more than that .. .!!!

4 Replies

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

Answer by alexnode · Oct 02, 2010 at 06:27 PM

Super Stupid ... I had "RenderQueue" = "transparent" instead of "Queue".!!! It works now ...

Shader "Myshaders/TransparentReflective" { Properties { _Color ("Main Color", Color) = (1,1,1,1) _Cube ("Cubemap", CUBE) = "" {} } SubShader { Tags {"Queue"="transparent" "RenderType"="transparent" }

     Cull Off

     CGPROGRAM
     #pragma surface surf Lambert alpha



     struct Input {
         float3 worldRefl;
         float4 _Color;
     };
     samplerCUBE _Cube;
     float4 _Color;
     void surf (Input IN, inout SurfaceOutput o) {
         o.Albedo = _Color.rgb;
         o.Emission = texCUBE (_Cube, IN.worldRefl).rgb*_Color.rgb;
         o.Alpha = _Color.a;
     }
     ENDCG
 } 
 FallBack "Transparent/Diffuse"

}

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 CofaResearch · Aug 19, 2014 at 06:01 AM 0
Share

Yep, helped me too mate, slightly different issue, but again custom transparency issues. The thread from 2010 that just keep on giving :)

avatar image
-1

Answer by rafa · Oct 13, 2010 at 10:37 PM

excellent.... thanks

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

Answer by tkcast · Feb 20, 2013 at 10:51 PM

awesome! i wish i could vote this up, thanks!

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 angelonit · Mar 07, 2014 at 12:23 PM

Worked for me aswell, I had RenderType instead of Queue

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Transparent Reflective 0 Answers

How to Tell which part of surface shader belongs to which pass in deferred shading? 1 Answer

Transparent Blend by Shader Variant in Surface Shader 0 Answers

Transparent & reflective shader 1 Answer

Shader that makes every other pixel not render? 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