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.
  • Ігри

КОМЕНТАРІ • 29

  • @apostolis_karantouvas1436
    @apostolis_karantouvas1436 Рік тому +2

    This is for real the best tutorial on clipping planes i've ever seen on this platform! Keep up the great work!

  • @zurkio6179
    @zurkio6179 Рік тому +2

    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

  • @kuritsu5206
    @kuritsu5206 Рік тому +2

    Got mine to work! thank you so much lmao I have spent way too long at looking how to resolve this efficiently

  • @TakaShitake-rt8bz
    @TakaShitake-rt8bz 9 місяців тому

    thank you for your tutorials!

  • @OrdinalR3D
    @OrdinalR3D Місяць тому

    Soo helpful

  • @hotdroppinglegends
    @hotdroppinglegends 5 місяців тому

    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?

    • @vatyunga
      @vatyunga 4 місяці тому

      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.

  • @H-jn5gt
    @H-jn5gt Місяць тому

    Hey man! Can this work for HDRP?

  • @AloricGG
    @AloricGG 8 днів тому

    My weapons on the ground can be seen through walls/objects. Anyway to fix this?

    • @WolffRahm_
      @WolffRahm_ 7 днів тому

      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");

  • @alexgurwell8288
    @alexgurwell8288 Рік тому +1

    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

    • @alexgurwell8288
      @alexgurwell8288 Рік тому +1

      Got it all to work, I had to set the graphics settings to the URP Renderer!

    • @wolfeygamedev1688
      @wolfeygamedev1688  Рік тому

      @@alexgurwell8288 👍Good

    • @alexgurwell8288
      @alexgurwell8288 Рік тому +1

      @@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?

    • @wolfeygamedev1688
      @wolfeygamedev1688  Рік тому

      @@alexgurwell8288 wait is the gun clipping or not?

    • @alexgurwell8288
      @alexgurwell8288 Рік тому +1

      @@wolfeygamedev1688 No it isn't clipping, but the shadows of the object you're passing the weapon through show onto the weapon

  • @CommissarChaotic
    @CommissarChaotic Рік тому

    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...

  • @marksteinburg4726
    @marksteinburg4726 Рік тому

    Does this only work if the fps hands/gun is a child of the camera?

    • @wolfeygamedev1688
      @wolfeygamedev1688  Рік тому +1

      It works regardless of heirarchy, it is based on the Layer of the Gameobject.

  • @nico-ov4bg
    @nico-ov4bg 4 місяці тому

    My weapon is slightly transparent, is there a fix for this?

    • @ZumoDePapaya
      @ZumoDePapaya 4 місяці тому

      Change Screen Space Ambient Occlusion in your URP to after opaque

  • @marksteinburg4726
    @marksteinburg4726 Рік тому +1

    Would this work in HDRP?

  • @Quadman4853
    @Quadman4853 Рік тому

    For me, this method almost worked but my weapon is now slightly transparent and I can see maybe 20% of a background

    • @Quadman4853
      @Quadman4853 Рік тому +1

      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
      @Quadman4853 Рік тому +3

      Problem solved, I had to disable Environment Reflection in weapon's material, then ambient occlusion is working properly as well :D

    • @nico-ov4bg
      @nico-ov4bg 4 місяці тому

      @@Quadman4853 Is this possible with an unlit shader?

  • @denny7477
    @denny7477 11 місяців тому +1

    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.

    • @WA2AB1
      @WA2AB1 4 місяці тому

      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.