Search Unity

[Scanner Mode] How would you create this?

Discussion in 'General Discussion' started by CortiWins, May 27, 2019.

  1. CortiWins

    CortiWins

    Joined:
    Sep 24, 2018
    Posts:
    150
    Hey, i would like to create the following feature and i could really use your experience to maybe give me a hint where to start and what i could do better.

    My game is in first person. I want to create a scan-mode, where the player equips scanning gear and then can see things that where hidden before. Let me try to illustrate that with a mock-up made from content that is not by me. ( See Skyscan.png )

    My idea would be:
    • Add a new camera with a color-invert or LUT replacement-shader and make it render on a texture.
    • Show the texture on a canvas with a mask to get only that ellipse-part in the middle.
    • put the symbols that shall only be seen in scan mode on a layer that is not rendered by cameras except for the scan camera.
    I wonder if render to texture is a good idea, it sounds like somethings that could cost a few fps. Is this a valid path to take or am i missing something or trying something in a really bad way?

    Thanks for spending your time on reading this!
     

    Attached Files:

  2. tawdry

    tawdry

    Joined:
    Sep 3, 2014
    Posts:
    1,357
    Putting them on a different layer so only scan cam can see them is the most performant and easiest way I would think. Def how I would do it.
     
  3. CortiWins

    CortiWins

    Joined:
    Sep 24, 2018
    Posts:
    150
    Hey, thanks for the answer! It got it working right now, though with a lot of compromises. The multi-camera setup doesn't work that with post process effects. Now i'm searching for a way to get around multiple cams ( Link ) to deal with the post process problems while trying to design scanner visuals that don't complicate it any further.

    There's so much to learn about unity and graphics engine stuff. Even though it often messes with my plans and ideas, it's still so much fun ^_^
     
  4. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,620
    A couple of approaches I would consider...

    1.
    - Have just one Camera.
    - Set the layermask to not show scannable items.
    - Have a script which changes the camera's layermask to include/exclude scannable items as desired.
    - Using the Unity Post Processing Stack v2, also turn an effect on/off as desired to indicate scanner mode.

    2.
    - Have two cameras.
    - Scannables are on their own layer again.
    - First camera just shows the normal world.
    - Second camera just shows scannables. Also renders to a RenderTexture. This camera only needs to be enabled when you're in scanner mode.
    - Have a script which blends that RenderTexture into the screen, with whatever other effects you want also applied. (This is functionally identical to a post effect, so you could write this as an effect that plugs into the Post FX stack and takes the RenderTexture as a property.)

    I'd pick whichever one best fits with how the rest of the game is designed and built.
     
  5. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,145
    I'd just slap on a replacement shader that pulls from the alpha channel to show how things should appear. You know, 0.0 - 0.2 (blue), 0.3 - 0.5 (green), 0.6 - 0.8 (yellow), 0.9 - 1.0 (white). I feel like a layer based solution might honestly be overkill. You could even just make the vignette a UI thing.
     
    angrypenguin likes this.
  6. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,620
    True enough. Depending on how you want to display stuff you could just give the symbols their own material and change properties based on whether or not scan mode is enabled.