Sub topic 7
Setting up an HDRI with Environment Texture and Background nodes
This chapter covers the node graph that turns an HDRI image into the light and backdrop of a scene. It assumes you can move around the 3D viewport, find the Properties editor and the Shader Editor, and have rendered a simple scene in Cycles or EEVEE. You should also know that an HDRI is a high dynamic range panorama that stores real light intensities, not just colors.
How the World shader works
The World is the environment around your scene. It has its own shader node tree, separate from object materials. Every ray that leaves the scene without hitting an object ends up in the World. The World shader decides what color and brightness that ray sees.
By default, a new scene has a World with two nodes:
- Background is the node that emits light in every direction. It has a Color input and a Strength input.
- World Output is the node that hands the result to the renderer.
The Background node converts a color into emitted light. A gray color at strength 1.0 lights the scene evenly from all sides. To get realistic, directional light, you replace that flat color with an image. That is the job of the Environment Texture node.
The three-node chain
The basic HDRI setup uses three nodes in a row:
- Environment Texture loads the HDRI image and maps it onto a sphere around the scene.
- Background turns the image's colors into light and applies the Strength value.
- World Output sends the light to the renderer.
The connection that matters is Color from the Environment Texture to Color on the Background node.
Building it in the Shader Editor
Follow these steps in the interface.
- Open a Shader Editor. Set its Shader Type drop-down (top left of the editor) from Object to World.
- If the World has no node tree, click Use Nodes in the Properties editor under the World tab.
- Press
Shift+A, choose Texture, then Environment Texture. Place it to the left of the Background node. - Click Open on the new node and choose your HDRI file (
.hdror.exr). - Drag from the Color output of the Environment Texture to the Color input of the Background node.
You can also do steps 3 to 5 from the Properties editor. In the World tab, under Surface, set the Color field of the Background to Environment Texture and pick the image there.
In EEVEE, look at the viewport in Material Preview or Rendered mode. In Cycles, switch the viewport to Rendered. Solid mode does not show the World lighting.
Environment Texture settings
The Environment Texture node has a few settings that affect the result.
| Setting | What it does | Typical value |
|---|---|---|
| Projection | How the flat image wraps around the scene. | **Equirectangular** for almost all HDRIs |
| Interpolation | How pixels are sampled. | **Linear** |
| Color Space | How the file's numbers are read. | **Linear** for `.hdr` and `.exr` files |
Equirectangular is the standard layout for panoramas: a 2:1 image where the horizontal axis is the compass direction and the vertical axis is the angle from straight down to straight up. Choose Mirror Ball only if your image is a photograph of a reflective sphere.
Blender usually picks the right color space for .hdr and .exr files. If the lighting looks washed out or too dark, check this field first.
Strength
The Strength input on the Background node multiplies the brightness of the whole image. A value of 1.0 uses the image as stored. A value of 2.0 doubles every pixel's intensity, which is the same as raising exposure by one stop. This control is covered in more detail in the next chapter on rotation and strength. For now, leave it at 1.0 and judge the result.
Light and backdrop are the same image
With this setup, the HDRI does two jobs at once:
- It lights the scene. Bright regions of the image, such as the sun or a window, cast shadows and highlights. Dim regions fill in soft ambient light.
- It appears as the background where the camera sees empty space.
The camera usually should not show the HDRI. Product shots and composited renders often need a plain or transparent background. Two common ways to do this:
- In Render Properties > Film, enable Transparent. The HDRI still lights the scene, but the camera sees an empty alpha channel.
- In Cycles, open World Properties > Settings > Ray Visibility and turn off Camera. This also hides the image from the camera but keeps its light and its reflections.
Common errors
The World looks black. Check that the Background Color input is actually connected to the Environment Texture and that the viewport is in Rendered or Material Preview mode. Also confirm the Strength is not 0.
The node tree edits nothing. The Shader Editor must be set to World, not Object. Editing the wrong tree is a frequent mistake, because both look like node graphs.
The image is pixelated or blurry. Low-resolution HDRIs show up in the background and in sharp reflections. For lighting alone, 1k or 2k is often enough. For visible backdrops, use 4k or higher.
The lighting looks too dim even at Strength 1.0. The file may not actually contain high dynamic range data. An 8-bit JPG or PNG has a maximum value of 1.0, so no pixel is brighter than white paper. It cannot cast strong sun shadows. Use .hdr or .exr files.
Relative paths break. If you move the .blend file, an image saved with an absolute path may go missing. Use File > External Data > Make Paths Relative, or Pack Resources to store the image inside the file.
Setting it up with Python
The same setup can be built with bpy. This version reuses the existing Background node, creates the Environment Texture, and connects them. It leaves out the Mapping node, which belongs to the rotation chapter.
import bpy
scene = bpy.context.scene
world = scene.world or bpy.data.worlds.new("World")
scene.world = world
world.use_nodes = True
nodes = world.node_tree.nodes
links = world.node_tree.links
bg = nodes.get("Background") or nodes.new('ShaderNodeBackground')
bg.inputs['Strength'].default_value = 1.0
env = nodes.new('ShaderNodeTexEnvironment')
env.image = bpy.data.images.load("//hdri/studio.exr") # relative to the .blend file
env.projection = 'EQUIRECTANGULAR'
links.new(env.outputs['Color'], bg.inputs['Color'])The // prefix means "the folder of the current .blend file". The path must point to a real file, or images.load raises an error. Save your .blend file before running the script so that // resolves.
Checking your result
A quick test confirms the HDRI is lighting the scene and not just filling the backdrop. Place a plain white sphere on a plane and render it. You should see:
- a soft shadow on the plane that points away from the brightest part of the image,
- a shaded sphere, brighter on the side facing that bright region,
- no shadows at all if the HDRI is a uniformly overcast sky, only soft darkening where objects meet the ground.
If the shadow points toward the part of the sky you expected to be bright, the image orientation is off. The next chapter shows how to rotate it.
Exercise
You set up an HDRI in the World, but the render shows a flat gray background and the scene is lit evenly with no shadows. The Environment Texture node has the correct file loaded. Name two things you would check in the node tree.
Show answer
First, check that the Environment Texture's Color output is linked to the Background node's Color input. A loaded image that is not connected has no effect. Second, check that the Background node's Strength is above 0, and that you are editing the World tree (Shader Type set to World) rather than an object's material. Also confirm the file is a true HDR format such as .hdr or .exr, since an 8-bit image gives weak, flat lighting.
Exercise
You want the HDRI to light a product but the final image should have a transparent background. Which setting do you use, and does the product still receive light from the HDRI?
Show answer
Enable Film > Transparent in the Render properties. The product still receives light and reflections from the HDRI, because only the camera's view of the background is replaced by transparency.