Sub topic 7
Setting up an HDRI with Environment Texture and Background nodes
Assume you can navigate the Shader Editor, change the active editor from Object to World, and render a scene in Cycles or EEVEE. You should also know that a node connects an input to an output to pass data through a shader.
An HDRI, or high dynamic range image, stores brightness values across a wide range. An HDRI used in the World shader can provide both visible surroundings and illumination. Bright areas in the image create stronger light, while darker areas contribute less.
The World node structure
Open the Shader Editor and change the shader context from Object to World. Enable Use Nodes in the World properties. The basic node chain is:
Texture Coordinate → Mapping → Environment Texture → Background → World OutputThe Environment Texture node reads the HDRI. The Background node turns the image into world lighting and controls its strength. The World Output node sends the result to the scene.
Create the nodes manually, then connect the Generated output from Texture Coordinate to Mapping, Vector from Mapping to Environment Texture, Color from Environment Texture to Background Color, and Background Background to World Output Surface.
Set the Background Strength to control the overall contribution of the HDRI. A value of 1.0 is a useful starting point. Lower values make the world and its lighting darker. Higher values brighten both the environment and the subject.
Loading and connecting an HDRI with Python
The following script replaces the World node tree with a simple HDRI setup. Replace the path with the location of your own .hdr or .exr file. A path beginning with // is relative to the current Blender file.
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
nodes.clear()
texcoord = nodes.new("ShaderNodeTexCoord")
texcoord.name = "World Coordinates"
mapping = nodes.new("ShaderNodeMapping")
mapping.name = "HDRI Rotation"
environment = nodes.new("ShaderNodeTexEnvironment")
environment.name = "Studio HDRI"
environment.image = bpy.data.images.load("//hdri/studio.exr")
background = nodes.new("ShaderNodeBackground")
background.inputs["Strength"].default_value = 1.0
output = nodes.new("ShaderNodeOutputWorld")
links.new(texcoord.outputs["Generated"], mapping.inputs["Vector"])
links.new(mapping.outputs["Vector"], environment.inputs["Vector"])
links.new(environment.outputs["Color"], background.inputs["Color"])
links.new(background.outputs["Background"], output.inputs["Surface"])The script does not create a lamp object. The World shader supplies illumination from every direction. You can inspect the result in rendered view or by rendering an image.
> callout note > Use an equirectangular HDRI. This format wraps a 360-degree environment around the scene. A normal photograph will usually produce distorted or incomplete world lighting.
Check the setup
If the HDRI appears stretched or has an obvious seam, check that the image is equirectangular and that it is connected to the Environment Texture node. If the scene is too dark or too bright, adjust Background Strength before changing exposure. Rotate the image later through the Mapping node by changing its Z rotation.
Exercise
Which node controls the HDRI's overall lighting strength, and which node should you change to rotate the environment?
Show answer
The Background node controls strength. The Mapping node controls rotation, usually through its Z rotation value.