Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

[Released] NeverClip! Removes common clipping bugs!

Discussion in 'Assets and Asset Store' started by Glacier-Games, Oct 28, 2014.

  1. Glacier-Games

    Glacier-Games

    Joined:
    Jan 26, 2013
    Posts:
    8


    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)
     
    Last edited: Oct 29, 2014
    EliasMasche likes this.
  2. bjornrun

    bjornrun

    Joined:
    Oct 29, 2013
    Posts:
    88
    Is there any screencast how to use this? Home page is not exactly working...
     
  3. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,728
    This looks nice. Will it work in Unity 5 or will you update it to work? I hate clipping. :)
     
  4. Glacier-Games

    Glacier-Games

    Joined:
    Jan 26, 2013
    Posts:
    8
    I hate it too ;) It should definitely work in Unity 5! I don't see any reason why not!
     
  5. Atmey

    Atmey

    Joined:
    Nov 3, 2012
    Posts:
    88
    Looks interesting, how compatible is it with other shaders?
     
  6. Glacier-Games

    Glacier-Games

    Joined:
    Jan 26, 2013
    Posts:
    8
    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 :)
     
  7. Atmey

    Atmey

    Joined:
    Nov 3, 2012
    Posts:
    88
    Sorry, I wasn't clear, I am using other custom shaders from the store, (for now, the dota2 shaders), how can I combine them?

    Thanks.
     
  8. Glacier-Games

    Glacier-Games

    Joined:
    Jan 26, 2013
    Posts:
    8
    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 :)
     
  9. imtrobin

    imtrobin

    Joined:
    Nov 30, 2009
    Posts:
    1,545
    are u rendering object twice for this to work?
     
  10. Glacier-Games

    Glacier-Games

    Joined:
    Jan 26, 2013
    Posts:
    8
    Nope, there's only one instance of each mesh. It's all within a single pass of a single shader:)
     
  11. DMeville

    DMeville

    Joined:
    May 5, 2013
    Posts:
    400
    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.
     
  12. Glacier-Games

    Glacier-Games

    Joined:
    Jan 26, 2013
    Posts:
    8
    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
     
  13. DMeville

    DMeville

    Joined:
    May 5, 2013
    Posts:
    400
    Wow, that sounds great. Looks like I'll have to pick this up over the next few days :) Thanks!
     
  14. ElectroMantis

    ElectroMantis

    Joined:
    Sep 15, 2013
    Posts:
    78
    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?

     
  15. mixmax100

    mixmax100

    Joined:
    Aug 13, 2016
    Posts:
    1
    I know, I ask a bit late, but...can this be used for dynamic cloth and the huge problems with it ?
    Thanx!
     
  16. Barry100

    Barry100

    Joined:
    Nov 12, 2014
    Posts:
    178
    Can the shader stack on clothing so I can have clothing behind one then the other and then the other like a shirt, the a jumper then a coat ?