• 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 /
  • Help Room /
avatar image
Question by alpharay · Jul 27, 2016 at 03:35 PM · shadervrclippingclipping plane

X ray shader

https://youtu.be/At_Zac4Xezw?t=22m2s

I am looking to replicate an x ray shader like this. When the player clips with an object the xray effect will only display near the clipping plane, but the rest of the object remains standard PBR. I am assuming this is some sort of advanced cut out shader. Since I am new to shader programing could someone help point me in the right direction, or to an example shader of something similar?

Comment
ViktorCor

People who like this

1 Show 1
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 Razor_J · Jul 27, 2017 at 02:07 PM 0
Share

BUMP^ to the above... been hoping someone will jump in to help assist but there has been no activity.

I'm also trying to work out the approach - for use in VR - while not being extremely shader savvy. My guess is perhaps use of stencil shaders with doubled geometry and a secondary camera each being at exact same location as originals (where each of the objects use a different material, the secondary one being revealed only when within a defined volumetric clipping distance (determined by physical object)? I am unclear on how to achieve the 3D "volume" effect of the clipping. I wonder about the faded edge effect and intersection outline highlighting as well (perhaps using an outline shader for the highlighted outlines?) Overall, the general PARTIAL material change on what appears as a single surface has been elusive (which is why I surmise it may be two sets of geometry)... perhaps a sphere around head as triggered sphere of influence... but? Perhaps none of the above is accurate and the approach is entirely different? Can someone offer any pointers/solutions? Of course, least processing intensive solution would be preferred. (An asset on the store to achieve would be welcome as well... I haven't found any.)

1 Reply

· Add your reply
  • Sort: 
avatar image

Answer by NorthStar79 · Jul 28, 2017 at 02:26 PM

you don't even need a custom shader for this, just change material properties. like give it some tint and increase its transparency from script whenever you need. note that you also need your shader marked as "fade" not "opaque"

Comment

People who like this

0 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 Razor_J · Jul 28, 2017 at 02:48 PM 0
Share

Thanks for the input :)

If you look closely at the video example though there is more going on than just changing material opacity... that would be easy enough. There appears to be:

(a) A Volumetric area to define the Partial material change on Part of a mesh (Not the entire mesh via its material settings, only the part of the mesh in the "volume" is affected. ) (b) A Gradual fade off at the edges defining a visible shape/volume to the intersection "sphere". (c) An Edge thickness defined at all points of intersection between object and "clipping volume" along surface of mesh relaying their relationship between each other.

So, to me it seems much more than just triggering an opacity change on a material.

Found something that in theory looks like it may hold seeds to an approach but seems to break down regarding its tie to camera view triggering effect even when no intersection occurs (basing things on overlap between camera, trigger and surface, not just intersections). It does work with a volume though, which I like.

https://gamedev.stackexchange.com/questions/144809/change-alpha-value-of-object-if-its-closer-to-the-camera-than-the-player

  • It's not "the" solution but first I found that alters Partial surface, while keeping original material intact.

Thanks again.

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

93 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

Related Questions

Light Flickering on every object except the terrain. 1 Answer

Vegetation is clipping too far 0 Answers

Water surface - User can see through surface (Near clipping) 0 Answers

Google VR (Cardboard) don't work with Render Pipeline Asset. 0 Answers

Volumetric Light with VR in URP have a weird clipping... Any ideas? 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