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 luki251 · Nov 24, 2018 at 08:05 PM · mirrormirrorreflection

Magic Mirror - how to modify reflection?

Hey! I'm using Magic Mirror Lite from assets store. I really need a mirror that reflects inverted upside down room or rotated by 90 degrees. Example on image below - perspective is wrong but you get the idea.


alt text

At first I was trying to make my own mirror from scrath by using camera that rotates according to player's location and render image from this camera on render texture. It kinda works but it isn't realistic and looks more like a security cam. I tought I can also change FoV of camera according to distance between player and mirror and this is a little bit better but still isn't realistic enough. It doesn't behave like a real mirror and it distort the reflection. In this case it's simple to rotate reflection because I can rotate camera attached to mirror and reflection is rotated but I don't think I can make realistic reflection this way.

Or can I? Any ideas?


So I decided to use Magic Mirror, but really it's impossible to modify the reflection.

Rotating camera doesn't do anything.

I tought it is necesery to modify Matrix4x4 but I guess that's also not it.

I was also trying to flip mirrorMaterial Texture in MirrorCameraScript by mirrorMaterial.SetTextureScale("_MainTex", new Vector2(1,-1)); but again no luck...

I have no idea if shoud I somehow modify _MainTex inside shader or it is necesary to completely modify the way reflection is rendered?

I'm running out of ideas I spent weeks trying to figure it out.

Does anybody have idea?

mirror.jpg (116.1 kB)
Comment
Add comment · Show 3
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 ecv80 · Nov 25, 2018 at 11:02 AM 0
Share

I don't know about this $$anonymous$$agic $$anonymous$$irror. Did you try an orthographic camera too? $$anonymous$$ight be just what you need to avoid distortion? But I just don't know.

avatar image luki251 ecv80 · Nov 25, 2018 at 01:59 PM 1
Share

No it really doesn't make any sense at all, because ortogtaphic camera doesn't use perspective. And in mirror reflection I need perspective... In a really really big simplification objects closer to camera are bigger and objects further away are smaller. But ortographic camera basically shows two objects exactly the same size even if one is 1cm from camera and another is 100km from camera and that isn't reflection you supposed to see in a mirror.

avatar image ecv80 luki251 · Nov 25, 2018 at 03:27 PM 0
Share

I guess you're right.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Bodhid · Nov 27, 2018 at 12:15 PM

A simple planar mirror uses screenCoordinates in it's shader, so rotating the object has no use.

You can go to the mirror's update script, there will be a camera position and rotation set there. You can add an extra rotation there at the end. for example mirrorcam.Rotate(0,0,90); After all other positions and rotations are set.

What you can also do is change the uv coordinates in the material's shader. You can change tex2D(x,i.screenPos.xy) into something like tex2D(x,1-screenPos) or tex2D(x, float2(1-i.screenPos.x,i.screenPos.y) for example to flip the coordinates

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

94 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Sun rays don't show up in mirror reflection in deferred rendering ? 0 Answers

Complete Flat Mirror Reflection shader 0 Answers

Cubemap/Reflection size/scaling issue? 0 Answers

Best option to create real mirrors in terms of performance 2 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