A common bug in many video games is 3D model clipping. Clipping between models is when objects intersect in weird, unwanted ways. Many large companies still struggle with this in their games, and you can frequently notice “armor clipping with skin” or “hair clipping with helmets” or even “weapons clipping with characters”. Here’s an example of what I’m talking about:
However, NeverClip fixes this bug! How? Well, NeverClip is a package of shaders that pulls geometry out of these unwanted intersections. It is especially useful for preventing interactive cloth clipping with characters or scenery. On top of that, it’s technically also a cheap way to write to the depth buffer within a shader. Here are a couple examples of the asset in action:
NeverClip! Shaders
Diffuse
Bumped Diffuse
Specular
Bumped Specular
Unlit
Back Side (for double-sided)
Back Side Always Dark (for double-sided)
The technology is actually compatible with most shaders. I’m currently working on adding as many shaders as possible. So you can expect more and more shaders with each update
Well, that’s the topic of combining shaders. The neverclip shader script is fairly simple. So if you have a little experience with cg and the shaderlab, you can easily combine this technology with the dota 2 shaders. It’s pretty much as simple as copying and pasting a portion of the code into whatever shader you want. Let me know if you’re still having issues when you try
This looks really cool, I’m thinking of picking this up but a have a few questions first:
Are there any demos out, I’d love to see this in action (rotate around an object, etc)
Does it come with any documentation/setup guide?
Will this cause any major performance hits?
I’m not quite sure the magic that’s happening to make this happen. Using your ball/cloth example, my first thought makes me think that simply, the ball is rendered, then the cloth after completely overtop. Whether or not this is right but leads me to my last question, how does this work for “partially occluded objects”?
What if I viewed the ball from the bottom, would everything look normal?
What about something like, a hood on a character - not wanting his head to clip through in the back, but still be visible like normal through the front of the hood?
I’m using custom shaders made with shaderfroge, and am interested in adding this script into some of them, if it’s just a simple case of copy and paste like you mentioned though, there should be no issues.
There are no demos out yet.
Yes, it comes with a setup guide
No major performance hits, it’s a very simple yet cleverly designed shader.
It does not simply render one object on top of another. This easily achievable with other shaders, but does not give the desired effect. NeverClip is made for partially occluded objects, so it looks perfectly normal from all angles. If your player’s head is poking through a hood, just give the hood the NeverClip shader, and viola! The head is visible like normal at the front of the hood, but not at the parts that are sticking through it.
And for your final point, it really is as simple as copy and pasting a bit of code. However, you should have a little experience with cg and shaderlab to know what to copy, and where to paste it. Like I said, the code is simple, so it should be very easy to do. Hope this helps!
Note: when copying and pasting, remember to state that your new shader is a vertex shader. So find the line like this “#pragma surface surf SomeTypeOfLighting”, and append “vertex: vert”. #pragma surface surf SomeTypeOfLighting vertex: vert
This shader looks like it could solve a few of my problems! I have some questions - >
Question #1 :
I’m using Toony Colors Pro 2 for my characters and such. The shader has an outline feature that duplicates the geometry, colors it and then flips the normals to give the effect. Would would it be possible to combine that shader with this one? I don’t expect it to, but it would be nice (I could probably remove the outline).
Question #2 :
Say I have a flat terrain, that I want to place a “Hole” prefab on top of.
Lke so -
Now what will happen say, if the hole is on the top of a hill? will the inside of the hole be visible from the side?