Fix FPS Weapon Clipping and FOV Distortion WITHOUT CAMERA STACKING. using Unity URP.
Вставка
- Опубліковано 2 лют 2023
- Camera stacking costs needless performance, and some developers go so far as to write their own shaders to produce the same effect without using camera stacking. In this tutorial I show you how to use Unity custom forward renderer (comes with URP) to produce the same visual effect as camera stacking, without having to add an extra camera to your scene.
- Ігри
This is for real the best tutorial on clipping planes i've ever seen on this platform! Keep up the great work!
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
Got mine to work! thank you so much lmao I have spent way too long at looking how to resolve this efficiently
thank you for your tutorials!
Soo helpful
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?
No, it only renders the layers you selected. But there's slight overhead with two cameras. I don't think you should worry about it in URP.
Hey man! Can this work for HDRP?
My weapons on the ground can be seen through walls/objects. Anyway to fix this?
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");
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
Got it all to work, I had to set the graphics settings to the URP Renderer!
@@alexgurwell8288 👍Good
@@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?
@@alexgurwell8288 wait is the gun clipping or not?
@@wolfeygamedev1688 No it isn't clipping, but the shadows of the object you're passing the weapon through show onto the weapon
Say uhh I do not really know if this is the solution to my problem or not but.. See, camera stacking seems to work just fine for me except for the shadows... It is just its own layer now and it doesn't acknowledge the lighting and shadows of the environment around it...
Does this only work if the fps hands/gun is a child of the camera?
It works regardless of heirarchy, it is based on the Layer of the Gameobject.
My weapon is slightly transparent, is there a fix for this?
Change Screen Space Ambient Occlusion in your URP to after opaque
Would this work in HDRP?
I dont see why not.
For me, this method almost worked but my weapon is now slightly transparent and I can see maybe 20% of a background
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
Problem solved, I had to disable Environment Reflection in weapon's material, then ambient occlusion is working properly as well :D
@@Quadman4853 Is this possible with an unlit 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.