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 benfattino · Jul 12, 2011 at 08:20 PM · reflectionmirrorintensity

Mirror reflection intensity

I'm using mirror material (shader+script). There is a way to control reflection intensity with a map or a number value (best way)? I try to modify shader without result... Thanks. Somebody suggest me to add _Color parameter in the first pass. I try without results...

 Shader "FX/Control Mirror Reflection" { 
 Properties {
     _MainTex ("Base (RGB)", 2D) = "white" {}
     _ReflectionTex ("Reflection", 2D) = "white" { TexGen ObjectLinear }
     _Color ("Color Tint", Color) = (1,1,1,1)
 }
 // two texture cards: full thing
 Subshader { 
     Color  [_Color]
     Pass {
         SetTexture[_MainTex] 
         { 
             constantColor [_Color]
             Combine texture * primary, texture * constant 
         }
         SetTexture[_ReflectionTex] { matrix [_ProjMatrix] combine texture * previous }
     }
 }
 // fallback: just main texture
 Subshader {
     Pass {
         SetTexture [_MainTex] { combine texture }
         }
     }
 }
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

3 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by Waz · Jul 13, 2011 at 10:20 AM

I'm not familiar with that shader, but the normal way to control reflection intensity is with that tint color - black for no reflection, white for full reflection. In addition, the base texture (sometimes in combination with a main color) controls the diffuse color of the mirror - a perfect mirror is black and a reflective cue-ball is white.

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 Waz · Jul 13, 2011 at 10:52 AM 0
Share

You may find that these two things are reversed - try with different colored textures also.

avatar image Waz · Jul 13, 2011 at 10:55 AM 0
Share

The FX/Water shader controls the reflectivity via the Fresnel parameter, since the reflectivity changes depending on the viewing angle.

avatar image
0

Answer by benfattino · Jul 13, 2011 at 10:39 AM

Thanks for answer. I try different combination with color parameter, but no result for reflection. It is always 100%... I will try again... I see that FX/water built-in shader don't have parameter that reduce reflection...

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 Waz · Jul 13, 2011 at 10:51 AM 0
Share

I think you meant this as a Comment. You've posted it as an Answer, which makes your question look well-answered.

avatar image
0

Answer by ShaneTheVeryTall · May 01, 2013 at 07:28 PM

I was having a similar need, and after reading the shader docs and not understanding much, I started just trying some different methods of combining textures. Somehow (with a ton of luck) I was able to arrive at a desirable result:

 Shader "FX/Mirror Reflection" { 
 Properties {
     _MainTex ("Base (RGB)", 2D) = "white" {}
     _ReflectionTex ("Reflection", 2D) = "white" { TexGen ObjectLinear }
     //_Color ("Color Tint", Color) = (1,1,1,1)
 }
 
 // two texture cards: full thing
 Subshader { 
     Pass {
         SetTexture[_MainTex] { combine texture }
         SetTexture[_ReflectionTex] { 
             matrix [_ProjMatrix] 
             constantColor (.25,.25,.25,.25)
             combine texture lerp(constant) previous 
         }
     }
 }
 
 // fallback: just main texture
 Subshader {
     Pass {
         SetTexture [_MainTex] { combine texture }
     }
 }
 
 }


Changing the "constantColor" values to a higher amount will produce a stronger reflection. I was going for polished marble in this case, and it's pretty close at .25. It would be nice to have a slider in the editor to control this, but I'm a NOOOOOB and this is my first edited shader. :)

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

How to make a mirror in 3.x? 0 Answers

How to decrease mirror reflection intensity? 1 Answer

How to mirror an object (reverse its sides)? 2 Answers

Mirrorreflection V3 needed for Unity 3? 0 Answers

Problem with the mirror view made by reflection probe in android build 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