Announcement

Collapse
No announcement yet.

Weapon clipping through objects (walls and enemies), out of ideas...

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Weapon clipping through objects (walls and enemies), out of ideas...

    Hey folks,

    so I was researching for two days now to try and find a simple solution on how to stop weapon and character mesh from clipping through objects - walls or enemy pawns (what I mean: https://imgur.com/oXg59F4). And I don't think increasing the radius of character collision sphere is a valid solution, as some suggested. I mean it can be, but there has to be something better. So far I tried with custom depth, vertex shaders, pixel depth offsetting and translucency with disabled debt test and nothing works as it should. Let me show you:


    1.) For custom depth I only saw tutorials and solutions that make outlines on mesh or they change the color of the mesh, making the mesh visible through objects. So I didn't even bother to actually make it visible through objects, because you only see a certain colour or outlines and not the actual mesh.
    https://imgur.com/TB3jGeY
    BP: https://imgur.com/WHVcuzd


    2.) For vertex shaders and pixel depth offset it just didn't work. There was always some clipping and I could never set the offset parameter right. This may also be because I use longer mesh for weapons, but that mustn't be a problem. I followed this yt video basically: https://www.youtube.com/watch?v=3XO7sb-Attw
    https://imgur.com/ztiRNDT
    BP: https://imgur.com/XGZ0YhH


    3.) And for translucency with disabled depth test it did actually work in a way that when I went close to a wall or enemies the mesh didn't clip and was still visible because it was above every other mesh. But the problem was, I couldn't disable opacity on mesh itself and you could also see through the weapon and character mesh, plus it had artifacts... And also translucency doesn't cast shadows as I read somewhere, so I don't know if I like this solution.
    https://imgur.com/Z2qLbTW
    BP: https://imgur.com/AmadTpf + the "disabled depth test" option checked, but it's not visible here


    4.) Oh and I also tried this: https://forums.unrealengine.com/deve...-through-walls. The long answer from "ricardoreis" in the middle of the page. This also kinda worked, but only on player not on weapons, plus it was kinda glitchy looking. Maybe this solution could lead somewhere with more explanation.


    5.) I also tried solutions mentioned in this post: https://www.reddit.com/r/unrealengin...apon_clipping/. The solutions here I basically what I already mentioned I tried in previous points.


    I don't have much knowledge about materials and how to modify them, so I would please ask for some advice on this. I just want to achieve this, but close to objects: https://imgur.com/GpNCPYZ. There HAS to be a simple solution in unreal engine to this very common problem for FPS games.
    Last edited by Anziii; 05-25-2020, 05:48 AM.

    #2
    It’s not such a simple thing unfortunately. I spent quite a lot of time with this, then noticed that Resident Evil 7 uses a method of custom depth to turn whatever you’re holding black when it is occluded, so it kind of looks like it’s in shadow. If it looks good enough for them, I figure it’s good enough for my game.

    Comment

    Working...
    X