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 z77 · May 05, 2018 at 09:05 AM · shadergraphicsshader programmingmirrorportal

How to make a 'mirror' and/or 'portal'-like Shader Graph?

Hand crafted a portal-system in Unity (standard render pipeline). Some screenshots: http://electricbrain.eu/dev/portal_ex_0.png and http://electricbrain.eu/dev/portal_ex_1.png . WebGL will be the main platform probably.

this portal-system relies on Camera events like OnPreRender, which does not seem to fire anymore in Lightweight Render Pipeline.

So my question has some partial questions: 1. Is it wise to migrate to the new Lightweight Render Pipeline (LWRP) or not? (my projects will probably not finish soon) 2. Camera events, like OnPreCull and OnPreRender will not work in LWRP? 3. Will it be possible to make a 'portal'-system in LWRP? Do I have to write a custom Render Pipeline to facilitate this? (I hope not, seems awfully complex) 4. I figured, if i can make a 'mirror'-shader, it should be possible to make a 'portal' shader in LWRP. So... I googled, but could not find a 'mirror' Shader Graph for LWRP. Suggestions please?

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 Bunny83 · May 05, 2018 at 09:55 AM

Brackeys portal tutorial should give you some hints how you can implement portals with render textures. Yes this approach is a bit ineffective as it simply renders the whole portal camera view to a rendertexture and just displays a portion of it depending on how much can be seen of the actual portal surface. Though this is the easiest way to implement portals.


There are a few things that can be changed though. He simply offsets the camera just in relation of the other portal. For a general portal system this of course doesn't work. You should use TransformPoint / InverseTransformPoint to map the camera position / orientation to the other portal. Next thing is that the near clipping plane should be adjusted to be right behind the exit portal. He designed his two rooms in a way there's nothing in the way for the portal camera. However you want to clip objects between the portal camera and the exit portal. For this you probably want to use an oblique clipping plane.


Further more it would be possible to set a viewport for the portal camera to only render the AABB area of the portal into the render texture. Of course you would need an off-center projection for this. However this is just an optimisation to cut down how much need to be rendered by the portal camera.

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 z77 · May 05, 2018 at 12:48 PM 0
Share

Thanks!

This helped me to refactor my portal-system: not using the OnPreRender event in my $$anonymous$$ainCamera made my portals compatible with the new 2018 Lightweight render Pipeline, at least, in the Editor...

(The WebGL version just shows a blue screen, but that's another subject. Sigh...)

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

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

Complete Flat Mirror Reflection shader 0 Answers

New to Unity and need some help achieving a sonar effect for 2D game 3 Answers

The Best Way To Make Stylised Grass in Unity? 0 Answers

Rewrite shader so that the Sprite-Diffuse shader doesn't take incidence angle into consideration when applying lighting? 1 Answer

[Need Help of a expert shader user] How to make following shaders to Fallback to "Diffuse"? 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