How would you go about constructing a realistic infrared vision effect with shaders? By realistic I mean one that looks realistic, like this example.

I have an idea about making a texture to determine how much heat a material emits and then determine by using the dot product of normal and view vector how much of that heat reaches the viewer but I'm not even sure that this is how thermal vision even works so I wanted to check if there's a better approach before starting to implement something that might be entirely wrong.

  • 3
    \$\begingroup\$ nah with infrared you can assume that everything is a diffuse emitter with different intensities, so just divide with the square of the distance to closer objects appear brighter \$\endgroup\$ Nov 25, 2013 at 11:33
  • \$\begingroup\$ just pack the thermal values in the texture. or have some separate texture if you want it more advanced. \$\endgroup\$
    – Tordin
    Nov 25, 2013 at 13:33
  • 1
    \$\begingroup\$ @ratchetfreak: You only need to divide by the square of the distance for point sources (or things you're approximating as point sources). For extended objects, you should keep the luminance (read: brightness per pixel) constant, while the solid angle (read: number of pixels on screen) covered by the object falls off as the inverse square of distance due to perspective. \$\endgroup\$ Nov 25, 2013 at 14:41

2 Answers 2


There's IR, and then there's IR. The range of light wavelengths commonly called "infrared" extends from the edge of the human visual range (about 700 nm) up to 1 mm = 1,000,000 nm.

Philipp's answer is correct for "near-infrared" light (about 700 to 1,400 nm), which is basically just like normal visible light, except that it's invisible to the unaided human eye. To model near-IR vision, you'd just replace your object textures and light source colors with alternative ones that model their reflectances and light intensities at different wavelengths than usual

However, based on the wording of your question and the video you linked to, you seem to be more interested in the "thermal infrared" range (8,000 to 15,000 nm), which corresponds to the peak of the thermal radiation spectrum of most everyday objects, including the human body. This radiation still behaves in most ways like "light" and can be modeled using standard computer graphics techniques (as opposed to radio waves, where the wavelengths get long enough that standard assumptions of ray optics start to break down), but the world as seen in thermal infrared does have its peculiarities:

  • As noted above, most objects will glow in thermal IR. For visible light, you can generally assume that there are only a few actual light sources, with everything else just reflecting light emitted by other sources. For thermal IR, depending on the exact wavelength(s) chosen, the opposite is often the case.

  • Conversely, most surfaces will also absorb thermal IR pretty efficiently. This will, in turn, warm them up, causing them to re-emit more IR themselves. In effect, it's as if almost every surface was phosphorescent.

  • The thermal IR spectrum (i.e. "color") emitted by most surfaces will mainly depend on their temperature. The intrinsic emissivity of the surface material does have an effect too, but a relatively limited one.

Thus, compared to normal light vision, modeling realistic thermal infrared vision would require more emphasis on global illumination and on dynamically changing emissivity values. Depending on your setting, you might be able to cheat a bit here: for example, for static scenes, the global radiative thermal transfer functions can be precomputed once and baked into a static lightmap, just like you'd do to fake global illumination in the visible spectrum.

If you want to simulate the view through a thermographic camera in your game, I'd recommend at least the following:

  • Draw and/or compute special IR emissivity and/or reflectivity textures for your objects. Pay special attention to the emissivity of warm objects (like humans or machines), which should correspond to their surface temperature. The reflectivity is relatively less important.

  • You'll probably want to use just a single spectral channel (i.e. draw everything in monochrome) corresponding to the total thermal IR flux. You can postprocess the image by mapping the resulting grayscale values into a false color gradient to simulate the traditional density slicing used for thermal images.

  • Consider explicitly tracking the temperature of your surfaces, such that, say, a spot on the ground that a person was lying on will remain warm (and thus glowing in IR) for a while even after the person has moved away. There are several ways you could handle that (e.g. per-vertex temperature tracking, adding decals for transient local temperature changes, etc.) with different trade-offs between realism and computational cost. You probably don't need to make it very realistic, but even having this effect present at all would be a nice touch.

  • \$\begingroup\$ +1 really good answer! I especially like your last point I had not considered this at all and I think you are correct, it would make for a very nice touch that might even help divert the user's attention away from the fact that the rest might not be entirely realistic. \$\endgroup\$ Nov 25, 2013 at 18:38
  • \$\begingroup\$ Both were good and helpful answers but yours helped me a bit more specifically by pointing me towards lookcing at different wavelengths of the IR-spectrum and to dynamically adjust emissivity values. But how the heck did you know all this about something so far from game dev?? I've worked with IRVs in real life and didn't know half of this :) \$\endgroup\$ Nov 28, 2013 at 19:23
  • \$\begingroup\$ Wikipedia. :) No, seriously, I knew that near IR isn't the same as thermal IR, and I've been interested in ray tracing and other fancy rendering techniques, so I knew they had applications to modeling radiative heat transfer. Most of the rest I just looked up. The thermal imprint thing was something I once saw a YouTube video about, I think. \$\endgroup\$ Nov 28, 2013 at 19:47

What you normally see from the world is the visual part of light which is reflected by objects. A green object reflects only green light, a red object only red light and a blue object only blue light. Infra-red can be considered a fourth color which your eyes can not perceive. An infra-red camera makes infra-red light visible to you by perceiving it with a sensor and converting the infra-red image into wavelengths you can see.

Just like some materials are more or less bright in red, green or blue, they are also differently bright in IR. The IR brightness can but doesn't necessarily has to correspond to how bright it is in visible light.

Here is a scene in visible and in IR. Note how the leafs of the trees are much brighter in IR than the trunks, but the IR brightness of the different parts of the facade of the building is similar in visible and IR light.

What you could do is create two versions of all of your textures: an RGB texture for visible light and an alternative monochrome texture for infra-red. In normal mode you use the RGB texture and in IR mode you use the IR texture.

You might also consider to use different light-sources in IR mode. The sun produces as much IR light as visible light. But artificial light-sources (like halogene lamps or light-emitting diodes) produce few or almost no IR light, so they don't illuminate anything in infra-red. On the other hand there are light-sources which are much stronger in IR (like open fire) or only visible in IR (hot objects which aren't hot enough to glow red. Or artificial IR light sources. Did you know that when you wear IR goggles, you can use a TV remote as a flashlight?). Different light-conditions in normal and IR light could be an interesting gameplay element.

  • \$\begingroup\$ Never really considered IR-light sources. I guess you could make some neat effects with the IRVs resetting when looking straight at an IR-source... \$\endgroup\$ Nov 25, 2013 at 15:11
  • \$\begingroup\$ The photo above is UV but still would provide some cool effects to either have UV or Infrared night vision. This has got me thinking because I recently tested out a thermal imager shader which looks pretty cool. \$\endgroup\$ Nov 25, 2013 at 15:59
  • 2
    \$\begingroup\$ @SICGames2013 Why do you think it's ultraviolet? I got it from the German wikipedia article about infrared light. The image description says that it displays the wavelength from 700-1000 nm. \$\endgroup\$
    – Philipp
    Nov 25, 2013 at 16:05
  • \$\begingroup\$ The 700-1000 range is Infrared but the image above looks Ultraviolet only because of the purple. Infrared cameras such as Sony or military types are either white - grayish contrast or just deeper in the infrared spectrum with detects body heat; mapping out temperature range of a person through a color palette. With Sony night vision, it's gray but now a day they put a green tint to them. Military Night Vision Googles have tinted green for the user able to see images better after the electrons hit the phosphorus screen in the back end of the Tube. \$\endgroup\$ Nov 25, 2013 at 18:45
  • 1
    \$\begingroup\$ @SICGames2013 When you seriously think it shows the ultraviolet spectrum because the image has a violet tint, you didn't understood the meaning of the "infra" or the "ultra" in those terms. \$\endgroup\$
    – Philipp
    Nov 25, 2013 at 19:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .