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?
BU$$anonymous$$P^ 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. $$anonymous$$y 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 (deter$$anonymous$$ed 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.)
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"
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.
It's not "the" solution but first I found that alters Partial surface, while keeping original material intact.
Thanks again.
Your answer
Follow this Question
Related Questions
Light Flickering on every object except the terrain. 1 Answer
How to modify Unlit shader to work in Single Pass Stereo mode for VR? 0 Answers
Shadows on alpha clipping/vertex offset shaders misaligned when using screen space texture 0 Answers
Water surface - User can see through surface (Near clipping) 0 Answers