Search Unity

Feedback Take infrared and gray scale screen shots

Discussion in 'General Discussion' started by damMoray, Jan 7, 2021.

  1. damMoray

    damMoray

    Joined:
    Dec 4, 2020
    Posts:
    1
    I am having a project in which I am taking screen shots of the game using Render Texture. I wanted to take those screen shots n gray scale as well as Infrared. Any help will be good ..Thanks in advance.
     
  2. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,569
    "Infrared" is not a thing in Unity. Computer renders in RGB. So to have some sort of "infrared" render, you have to implement it as a material or a filter. Same goes for Grayscale render. You'd need to implement it as a shader, or use Post-processing Image Effect stack.

    https://unity3d.com/how-to/image-effects-with-post-processing-stack
     
  3. EternalAmbiguity

    EternalAmbiguity

    Joined:
    Dec 27, 2014
    Posts:
    3,144
  4. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    The first thing I'd try is Color Grading in the PP stack. Go heavy on the red for the infrared effect. Probably just kill all color saturation for the grey scale, but haven't actually tried that one. See if the effect is acceptable, since this is extremely easy to implement. Making your own shaders for everything to do it would be far more time consuming.

    https://docs.unity3d.com/Packages/com.unity.postprocessing@3.0/manual/Color-Grading.html

    For infrared you could also try just setting all lights in the scene, and any ambient light, to only emit red color instead of near white.
     
  5. kdgalla

    kdgalla

    Joined:
    Mar 15, 2013
    Posts:
    4,637
    Or a LUT. Grayscale would be really easy with a LUT. Fake infra red would require some experimenting but might not be difficult depending on your image editing software. Somehow you need to convert the brightness into a hue.
     
  6. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,775
  7. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,569
    That's not exactly how infrared works.
    You'd really need a material system. If the idea is to make it look right, of course.
     
    Joe-Censored likes this.
  8. kdgalla

    kdgalla

    Joined:
    Mar 15, 2013
    Posts:
    4,637
    I've never seen that sort of infrared photography. I thought the OP was talking about this old-timey type of thermal imaging:
    upload_2021-1-7_23-9-42.jpeg
     
  9. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,620
    That is also what I assumed, but @neginfinity's point remains. Either way, IR rendering requires information which is not available in the RGB channels of our textures.

    In the same way that you can't tell what the red component of a colour is if you only have the blue value, you can't tell the IR value from the RGB channels. You need a new channel in your data, which means new materials and potentially shaders.

    For instance, in the above example image the person probably doesn't have blue hair and an orange forehead. There is no way to derive those colours from the textures provided under normal circumstances unless you outright make stuff up in your shader. Which might be fine, depending on the needs.
     
  10. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,775
    To be precise, OP really is asking for thermal vision effect.
    Meaning world would need have some sort of informations, what is hot and what is cold. Shaders could be one thing. Or just having secondary textures, with heat signature.
     
    Last edited: Jan 8, 2021
  11. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,569
    That's thermal imagining. Not quite the same thing as infrared photography.
    https://physics.stackexchange.com/q...fference-between-thermal-and-infrared-imaging
    https://en.wikipedia.org/wiki/Infrared_photography

    Consumer grade night vision IP or security cameras also frequently employ infrared vision. Such camera often comes with an infrared led projector which turns on during night time when the camera switches to night vision mode. Those cameras only record grayscale infrared, though.

    Also, even in case of thermal imagining, you're going to need a heatmap or a way to track object's temperature. Which means you're going to need custom materials.



     
    Last edited: Jan 8, 2021
  12. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    Usually game (and movie) implementations don't actually want a realistic implementation for this kind of tech though.
     
  13. MDADigital

    MDADigital

    Joined:
    Apr 18, 2020
    Posts:
    2,198
    If we would implement it we would want it realistic :)

    Edit: though this is not easy since we are missing info. For thermal imagine we need heat and conductivity. For IR we need lightsources to take infrared into account and it spills over to entire GI
     
    Joe-Censored likes this.