Holy shit, this is the BEST clipping tutorial I have ever seen. All other ones use the camera stacking which just messes up the FOV so THANK YOU so much for doing this Tutorial - It needs more views omg
FOV shouldn't be a problem with camera stacking. You need a script to keep the FOV the same on all cameras you're stacking, no problems. The actual problem with camera stacking is that it has a significant performance cost for no good reason. This is a new problem with the SRPs. Built-in render pipeline does not have this extra cost for stacking cameras.
To anyone watching this, know that you WILL encounter unfixable visual artifacts / conflicts with RenderObjects. They are marked as Experimental for a reason. Unity features are often experimental even when not marked as such, so when even Unity admit that something Experimental you should really think twice about wasting your time on it. I did and here's what I found: - SSAO will always render through objects *at least while they are clipping*. - The only way to prevent this is to activate the checkbox "After Opaque" on the SSAO effect. - This makes SSAO render OVER FOG, which looks extremely stupid in any scene that has noticeably fog. So quick tldr: Only use RenderObjects if you can do without either FOG or SSAO. Otherwise don't use RenderObjects.
I'm having trouble getting this working. It does fix the clipping issue, but opaque objects become semi-transparent. The issue isn't related to SSAO (still occurs even with that turned off). Any idea what could be causing it? Edit: Also the objects are just using the standard URP lit shader.
FOV part of the video is fine and works as intented but the wall clipping part is not that great. First of all, you are rendering the weapon twice.. you even said that its like on top of each other and you are fine with it. I wouldn't .. its really weird and its not necessary for sure. I remember I used this same approach some time ago and I didnt need that many render objects. And second, much bigger problem imo (which I had as well and couldn't fix) is that Ambient Occlusion (the shadow on the edge between wall and floor) is visible through the weapon. In your case its slightly visible around 11:14 when the weapon model is covering the edge. It would be more clear if you would bump the AO up. And this makes this approach completely useless because you can see every edge of the level through your weapon like its transparent. After many fails of trying to fix the issue I ended up with just scaling my weapons down so they cant possibly clip because they are fit inside my collider. When you scale your weapon down and move it closer to the camera it will look exactly the same, its impossible to tell the difference because there is none. You'll just maybe need to lower the near clipping plane on camera.
Oof... same issue here, but I simply couldn't afford having a second camera going and I wanted separate fov for the gun, so I just disabled ambient occlusion.
Hey, awesome work, I couldn't get mine to work sadly.. Also how did you get the high fidelity version of URP? mine just says "Universal Render Pipeline Asset_Renderer" and not high fidelity
@@wolfeygamedev1688 Quick question though, so when my gun goes through the walls, I can see the shadows from the objects I am passing my gun through onto the gun, is there anyway to fix that?
0:30 when main camera renders only scene and weapon camera renders only weapon => does it mean that you render scene twice? what limitations this method has comparing to 2 camera setup? no problems with lighting and shadows?
Actually I found out it's because of Screen Space Ambient Occlusion. It works perfectly when I decrease intensity to 0, but the downside is it disables the occlusion
@@Quadman4853 Pretty sure this is a placebo fix and kind of pointless any way. What are you going to do with first person models that lack any kind of reflections? Most first person models are going be metallic - whether that's guns or a sword or metal robot hands - so reflections are extremely important. Real workaround: Activate "After Opaque" checkbox in SSAO effect and make sure the SSAO effect is above the RenderObjects, as it is in this video. If SSAO effect has no "After Opaque" checkbox you need to upgrade to a newer version of URP / Unity.
Change the mesh renderer's object layer after the weapon gets picked up. When dropped return it back to whatever layer it was before. rendererObject.layer = LayerMask.NameToLayer("Layer_Name");