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 Aeleck · Aug 07, 2019 at 06:14 PM · shaderrenderinglayersreflection

Layer Dependent Reflections

Hello!

I can't seem to find any answers on this seemingly simple problem.

Briefly, I would like environment reflections (like what a reflection probe does) per layer.

But maybe if I explain what my scene is like a little, you can guide me to perhaps a better solution. I have a room that consists of two meshes: one for the outside and one for the inside. I would like the surrounding area to be reflected on the outside of the room but not the inside. I am using Deferred Shading and screen space reflections as well. Reflection probes are the easiest, but I can't get them to not apply to the inside mesh. It is also possible that I would like a different reflection to be applied to the inside mesh.

The closest I've gotten is to render a camera into a cubemap of the surrounding environment, and use a custom shader to apply the reflections using the normal map to the emission output of the shader; however, the problem I had with that is decreasing the smoothness on the shader didn't blur the reflection like Unity does with environment reflections (as this doesn't register as a reflection and a texture in the end). I can't seem to find a way to blur the texture to make it look like it's "semi-smooth" either.

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

Answer by Namey5 · Aug 08, 2019 at 09:18 AM

You should be able to use 2 different probes for this exact purpose - have one main probe on the outside of the building that covers a large area, and one on the inside of the building that just covers the interior. Unity should automatically blend between them (if the exterior one is overriding the interior, you can increase the importance of the interior probe).

As for blurred cubemap reflections, you can use the same technique that the probes do. Make sure that your cubemap generates mipmaps, then in your shader;

 //Instead of
 texCUBE (_Cube, refl);
 //Use
 texCUBElod (_Cube, float4 (refl, (1.0 - smoothness) * 8.0));
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 Aeleck · Aug 08, 2019 at 04:36 PM 0
Share

Thank you, this helped a bit, I didn't even think to use two probes. This works exactly as you said it would. I've attached a picture of what I'm working on since it makes this a little more challenging, I think. The exterior is cylinder-shaped so defining the interior is a bit odd using the reflection probes box properties and It won't include all of the interior mesh (which will be round as well). I would prefer the inside to be cylinder-shaped as well, but if it's not possible, it's not possible. I haven't tried the shader code yet, do you think that would be probably the next step to try, to avoid the box inclusion issue of the probes? alt text

Edit: I modified my ASE shader to use the texCUBElod ability, and it worked like a charm. I think I'll use that option as it is less I have to do in the scene (no reflection probes at all) and I can just choose what materials use the reflections of the cube map or not. The result from that looks like this: alt text You can see the reflections of the planet (script on camera rendering to cubemap, set global so any shader can use the reflection if necessary) and the screen space reflections. The cube inside is using the same shader with the reflections turned off and keeps the SSRR. Again, thank you for your help!

screenshot-2019-08-08-at-122741.png (486.2 kB)
screenshot-2019-08-08-at-133356.png (298.5 kB)

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

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

Subtractive Rendering? 4 Answers

Skybox reflections stopped working. 0 Answers

Unity iOS Rendering Standard shader issue 0 Answers

Layering Transparent Objects 0 Answers

Transparency and smoothness not working together? 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