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 Hybridizer · Jan 05, 2019 at 05:09 AM · shadermaterialreflectionsurfacesurface shader

How to Modify Standard Surface Shader's SpecCube?

Unity's Standard Surface Shader reflection style doesn't give the visual result I want, and I'd like to be able to modify it before it's displayed. But, the convenience of surface shaders, notably the blurring of said reflections by the Smoothness float, is incredible. So, is there a method to access Unity_SpecCube0 as, say, a fixed4, and edit its colors and values before reassigning it? Alternatively, how can I dynamically blur a cubemap in the same manner as the Smoothness float? (Or preferably, do modify it with Smoothness) I'm not opposed to having to write a vertex/fragment shader to manage it all, but I'd just like to know if there's an immensely easier means of achieving either of those within an existing surface shader before I start down that road. Either method would work, although the first would of course be the best. Any help or advice is appreciated, hopefully I don't sound too novice.

And if I posted this incorrectly, or in the wrong place, please forgive me.

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 · Jan 09, 2019 at 05:49 AM

The way the reflection probe blurring works is by accessing different mip levels of the reflection probe's cubemap based on the surface's roughness. If you wanted to blur a cubemap in the same way (although it won't be quite as high quality due to the custom mip filtering that Unity pre-generates for their probes).

The way you would implement this in a surface shader would be accessing the reflection cubemap like normal, but with a slightly different sampling function;

 //Where _Cube is the reflection cubemap and _MaxBlurLevel is a value from 0-10 (0 being no blur, 10 being essentially a flat colour).
 half4 refl = texCUBElod (_Cube, float4 (IN.worldRefl, lerp (_MaxBlurLevel, 0.0, _Smoothness)));

Keep in mind that you may need to enable mip-map generation for the cubemap beforehand.

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 Hybridizer · Jan 10, 2019 at 09:49 PM 0
Share

Thank you! It works fantastically, and the blur quality you mentioned is easily achieved by setting the cubemap's Convolution Type to "Specular". It works beautifully, exactly what I wanted. I may still face a headache in implementing reflection probe data into the cubemap slot of the shader (or maybe not, fingers crossed), but this is already perfect for static objects. That's a big mystery out of the way, thank you very much.

Small note: I found even a _$$anonymous$$axBlurLevel value of 4 is flat enough, and makes the transition between glossy and blurred much more even.

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

168 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

Related Questions

Z value shader 1 Answer

Surface shader ParallaxOffset issue 1 Answer

uv array and surface shader? 0 Answers

reflective glass shader 3 Answers

How to I get a reflection on the floor and on other objects ? 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