Search Unity

  1. Unity 2020.1 has been released.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

LWRP/HDRP FPS Weapon Camera Fix: How to Post-Process?

Discussion in 'General Graphics' started by Xander-Davis, Jan 8, 2020.

  1. Xander-Davis

    Xander-Davis

    Joined:
    Apr 23, 2011
    Posts:
    414
    Hi, I've switched my game to the LWRP for a FPS using this tutorial:
    https://forum.unity.com/threads/ufps-lwrp-weapon-camera-issue.782675/



    The only problem with the above video is it doesn't solve for preventing the FPS weapon from going through objects and walls.

    Then I was shown this video which demonstrates a fix from Unity and a third-party free Asset Store asset ( https://assetstore.unity.com/packages/tools/particles-effects/post-processing-texture-overlay-147951 ) for a Texture post-process layer, specifically to work with the alternate render pipelines:



    And I got that implemented easily enough:



    However, I'm currently stuck trying to figure out how to implement post-processing on the Weapon Camera.

    If I turn on Post-Processing on the Weapon Camera, there's obviously a problem with this because firstly we would be rendering the WeaponCam Texture over the WeaponCam itself recursively. While this is true, there's secondly a bizarre effect where it 'ghosts' the actual game object and only shows highlights or the post-process of the object (I think?)



    So how could we apply post-processing on the Weapon Cam?

    This is especially confusing under the new Post-Processing Volumetric system. We apparently no longer can just tag on a Post-Process profile to the WeaponCam like we used to be able to, because now we have to marry that with a volume with a profile on that in the level itself. We have an infinitely-sized post-process volume for the entire level. So how would you have a second Post-Process volume for just the WeaponCam only and have the MainCam ignore this? Further, I'm not even exactly sure this is the right way to go-- I don't yet really even know if applying post-process to the WeaponCam and then rendering that to texture to render into a Post-Processing stack on another Camera is even possible at all.

    Is there another way to go about this?

    I'm sure this will be an issue for many developers doing FPS games so any replies here to find a fix would undoubtedly be appreciated by myself and others.

    Thanks!
     
    Last edited: Jan 11, 2020
  2. Xander-Davis

    Xander-Davis

    Joined:
    Apr 23, 2011
    Posts:
    414
    I created a macOS build and was treated to the texture not masking itself as it does in-editor.

    Behold, a black screen:



    Any ideas on how to ensure the texture isn't rendering the camera background in builds (even if it passes through in-editor) as well?

    This might have something to do with how the weapon looked 'ghosted' with Post-Processing turned on, as all darker shadowed areas of the gun became transparent in editor. My WeaponCam's background is set to black, which made it transparent when applied to the texture for the Post Processing stack... but, again, only in editor (not in a build).

    I also emailed the developer of the Texture Overlay asset, Daniel Erdmann, to see if he has any insight ( xxxditzelxxx@gmail.com )
     
    Last edited: Jan 11, 2020
unityunity