Sub topic 2
What an HDRI Is and Where to Get One
This chapter assumes you know the Blender viewport, the Properties editor, and the Shader Editor, and that you have rendered a scene with Cycles or EEVEE at least once.
An HDRI (high dynamic range image) is a panoramic photo that stores real light levels. Ordinary images clip bright areas to white. An HDRI keeps the true brightness of the sun, a lamp, or a window, so Blender can use the image as a light source. Blender places the image around the scene as the World, and every pixel in it sends light onto your objects.
You can find free HDRIs on sites such as Poly Haven, which offers CC0 (public domain) images. Choose a file in .exr or .hdr format, and pick one whose light direction suits your subject.
Setting up an HDRI with Environment Texture and Background nodes
In the Shader Editor, switch the top menu to World. Blender then shows the World node tree. Add an Environment Texture node and load your file into it. Connect its Color output to the Color input of the Background node, and connect the Background output to the World Output node.
The same setup in Python:
import bpy
world = bpy.context.scene.world or bpy.data.worlds.new("World")
bpy.context.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')
env = nodes.new('ShaderNodeTexEnvironment')
env.image = bpy.data.images.load("//hdri/studio.exr")
links.new(env.outputs['Color'], bg.inputs['Color'])Rotating the HDRI and setting its strength
Rotation moves the light sources around the subject. Add a Mapping node and a Texture Coordinate node between the coordinate input and the Environment Texture. Set the Z rotation in the Mapping node to turn the sun, window, or highlights. Strength is set on the Background node. A value of 1.0 is the image's original brightness. Lower values darken the environment.
flowchart LR
A[Texture Coordinate] --> B[Mapping: rotate Z]
B --> C[Environment Texture]
C --> D[Background: strength]
D --> E[World Output]caption: The data path from the Texture Coordinate node to the World Output. alt: A left-to-right flow of five boxes. Texture Coordinate feeds Mapping, which rotates the image. Mapping feeds the Environment Texture, which feeds the Background node that sets strength. Background feeds the World Output.
Combining an HDRI with lamps
An HDRI and a lamp both cast light, so they must agree. If the HDRI's sun points left but your lamp shines from the right, the subject gets two conflicting shadows. Rotate the HDRI first, then place a lamp in the same direction as its brightest area. Keep lamp power low so the lamp fills in detail instead of overpowering the HDRI.
> Tip: Use a lamp at roughly half the strength of the HDRI's brightest area when you first combine them, then adjust by eye.
Exercise:
Exercise
An HDRI's brightest light comes from the left, but your Area lamp sits on the right. What should you change, and why?
Show answer
Rotate the HDRI with the Mapping node's Z rotation so its bright area faces the lamp's side, or move the lamp to the left. Either change makes the shadows agree.