Chapter 7: Lighting and Render Settings
Chapter 7: Lighting and Render Settings
Learning Objectives
- Understand the basic principles and types of 3D lighting
- Master the use of various light sources in Blender
- Learn to set up indoor and outdoor lighting scenes
- Become proficient in using the Cycles and Eevee render engines
- Master render setting optimization techniques
- Learn to create realistic lighting and shadow effects
Chapter Focus
Lighting is the soul of 3D rendering, determining the atmosphere, realism, and visual impact of a scene. This chapter will delve into lighting theory and rendering techniques.
7.1 Basic Lighting Theory
7.1.1 Physical Properties of Light
Basic Properties of Light
- Color: The wavelength of light determines its color
- Intensity: The brightness of the light
- Direction: The direction in which light rays travel
- Falloff: The decay of light intensity with distance
- Scattering: The interaction of light rays with a medium
# Lighting Physics Model
class LightPhysics:
def __init__(self):
self.wavelength = 550 # nanometers (green light)
self.intensity = 100 # lumens
self.temperature = 5500 # Kelvin
self.falloff_type = 'inverse_square'
def calculate_illumination(self, distance):
"""Calculate the illumination intensity at a given distance"""
return self.intensity / (distance ** 2)
7.1.2 Lighting Model Classification
Lighting Type | Characteristics | Application | Computational Complexity |
---|---|---|---|
Direct Lighting | Light source shines directly | Main light source | Low |
Indirect Lighting | Reflected and scattered light | Ambient lighting | High |
Global Illumination | Direct + Indirect lighting | Realistic rendering | Very High |
Volumetric Lighting | Volumetric scattering effects | Atmospheric effects | High |
7.1.3 Color Temperature and Light Color
# Common Light Source Color Temperature Reference
color_temperatures = {
'candle': 1900, # Candle
'tungsten': 3200, # Tungsten lamp
'fluorescent': 4000, # Fluorescent lamp
'daylight': 5500, # Daylight
'overcast': 6500, # Overcast sky
'blue_sky': 10000 # Blue sky
}
7.2 Blender Light Types Explained
7.2.1 Point Light
Characteristics: A point light that emits light uniformly in all directions
# Point Light Settings
point_light_settings = {
'energy': 100.0, # Light intensity
'color': (1.0, 1.0, 1.0), # Light color
'shadow_soft_size': 0.1, # Shadow softness
'use_custom_distance': False, # Custom distance
'cutoff_distance': 40.0 # Cutoff distance
}
Point Light Applications
- Small light sources like light bulbs, candles
- Fill lighting for indoor scenes
- Special effect light sources (magic orbs, etc.)
7.2.2 Spot Light
Characteristics: A conical beam of light, with control over the angle and edge softness
# Spot Light Parameter Configuration
spot_light_settings = {
'energy': 100.0,
'spot_size': math.radians(45), # Cone angle (in radians)
'spot_blend': 0.15, # Cone edge blend
'show_cone': True, # Show cone
'use_square': False, # Use square cone
'shadow_soft_size': 0.1
}
Application Techniques:
- Dramatic Lighting: Create strong light and shadow contrast
- Focus Lighting: Highlight specific objects or areas
- Architectural Lighting: Simulate spotlights, car headlights
7.2.3 Area Light
Characteristics: A planar light source that produces soft shadows
# Area Light Setting Types
area_light_types = {
'RECTANGLE': {
'size_x': 2.0, # X-direction size
'size_y': 1.0, # Y-direction size
'shape': 'RECTANGLE' # Rectangle
},
'SQUARE': {
'size': 1.0, # Square side length
'shape': 'SQUARE'
},
'DISK': {
'size': 1.0, # Disk radius
'shape': 'DISK'
},
'ELLIPSE': {
'size_x': 2.0,
'size_y': 1.0,
'shape': 'ELLIPSE' # Ellipse
}
}
Area Light Advantages
- Produces natural soft shadows
- Simulates planar light sources like windows, monitors
- Creates studio-level lighting effects
7.2.4 Sun Light
Characteristics: Parallel light, simulating a distant light source (like the sun)
# Sun Light Configuration
sun_light_settings = {
'energy': 5.0, # Sun intensity
'angle': math.radians(0.533), # Sun angular diameter
'color': (1.0, 0.95, 0.8), # Warm color tone
'shadow_soft_size': 0.1
}
7.3 Environment Lighting Settings
7.3.1 World Material Configuration
Importance of World Material
The world material not only affects the background but also provides global ambient lighting, making it an important part of the scene's atmosphere.
# World Material Node Settings
world_material_nodes = {
'background_shader': {
'type': 'ShaderNodeBackground',
'color': (0.05, 0.05, 0.1, 1.0), # Deep blue night sky
'strength': 1.0
},
'environment_texture': {
'type': 'ShaderNodeTexEnvironment',
'image': 'hdri_sky.exr',
'interpolation': 'Linear'
}
}
7.3.2 HDRI Environment Map
HDRI Selection Guide
HDRI Type | Characteristics | Application | File Size |
---|---|---|---|
Outdoor Sky | Natural lighting | Product showcase | Large |
Indoor Environment | Soft lighting | Character rendering | Medium |
Studio | Uniform lighting | Professional photography | Small |
Special Environment | Creative effects | Artworks | Varies |
# HDRI Setting Optimization
hdri_settings = {
'rotation_z': 0.0, # Z-axis rotation to adjust lighting direction
'strength': 1.0, # Environment light intensity
'saturation': 1.0, # Color saturation
'hue': 0.5, # Hue adjustment
'gamma': 1.0, # Gamma correction
'exposure': 0.0 # Exposure adjustment
}
7.3.3 Sky Texture Node
# Procedural Sky Settings
sky_texture_settings = {
'sky_type': 'NISHITA', # Atmospheric scattering model
'sun_elevation': 0.26, # Sun elevation angle
'sun_rotation': 0.0, # Sun rotation angle
'altitude': 0.0, # Observer altitude
'air_density': 1.0, # Air density
'dust_density': 1.0, # Dust density
'ozone_density': 1.0 # Ozone density
}
7.4 Classic Three-Point Lighting Setup
7.4.1 Key Light
Role: Provides the main illumination, establishing the scene's tone
# Key Light Settings
key_light = {
'type': 'AREA', # Area light
'energy': 100.0, # High intensity
'size': 2.0, # Large area for softness
'location': (2, -2, 3), # 45-degree angle position
'rotation': (math.radians(45), 0, math.radians(45))
}
7.4.2 Fill Light
Role: Fills in shadow areas, reducing contrast
# Fill Light Settings
fill_light = {
'type': 'AREA',
'energy': 30.0, # Lower intensity
'size': 3.0, # Larger area
'location': (-2, -2, 2), # Opposite side of key light
'color': (0.8, 0.9, 1.0) # Cool color to balance
}
7.4.3 Rim Light
Role: Outlines the object's silhouette, enhancing three-dimensionality
# Rim Light Settings
rim_light = {
'type': 'SPOT',
'energy': 50.0,
'spot_size': math.radians(60),
'location': (0, 3, 2), # Back position
'color': (1.0, 0.9, 0.7) # Warm rim color
}
Advanced Three-Point Lighting
Depending on the scene's needs, you can add extra lights like background light, hair light, kicker light, etc., to enrich the lighting effects.
7.5 Render Engine Comparison
7.5.1 Cycles Render Engine
Technical Features
- Path Tracing: Physically accurate light calculation
- Global Illumination: Realistic light bounces
- Unbiased Rendering: Theoretically approaches reality infinitely
# Cycles Render Settings
cycles_settings = {
'samples': 128, # Number of samples
'max_bounces': 12, # Maximum bounce count
'diffuse_bounces': 4, # Diffuse bounces
'glossy_bounces': 4, # Glossy bounces
'transmission_bounces': 12, # Transmission bounces
'volume_bounces': 0, # Volume bounces
'transparent_max_bounces': 8, # Transparent bounces
'use_denoising': True, # Use denoising
'denoiser': 'OPTIX' # Denoiser type
}
Optimization Techniques
# Adaptive Sampling
adaptive_sampling = {
'use_adaptive_sampling': True,
'adaptive_threshold': 0.01, # Threshold
'adaptive_min_samples': 0, # Minimum samples
'adaptive_samples': 128 # Adaptive samples
}
# Light Path Settings
light_paths = {
'caustics_reflective': False, # Disable reflective caustics
'caustics_refractive': False, # Disable refractive caustics
'filter_glossy': 1.0 # Glossy filter
}
7.5.2 Eevee Render Engine
Technical Features
- Real-time Rendering: Fast rendering based on OpenGL
- Screen Space Effects: Efficient approximation algorithms
- Game Engine Level: Suitable for interaction and previews
# Eevee Render Settings
eevee_settings = {
'taa_render_samples': 64, # TAA render samples
'taa_samples': 16, # TAA viewport samples
'use_bloom': True, # Bloom effect
'bloom_threshold': 0.8, # Bloom threshold
'bloom_intensity': 0.05, # Bloom intensity
'use_ssr': True, # Screen Space Reflections
'ssr_quality': 0.25, # SSR quality
'use_gtao': True, # Ambient Occlusion
'gtao_distance': 0.2 # AO distance
}
7.5.3 Engine Selection Guide
Scene Type | Recommended Engine | Reason | Notes |
---|---|---|---|
Product Rendering | Cycles | Physically accurate | Long render times |
Architectural Visualization | Cycles | Realistic lighting | Requires denoising |
Character Animation | Eevee | Real-time preview | Lighting limitations |
Concept Design | Eevee | Fast iteration | Approximate effects |
Game Assets | Eevee | Real-time rendering | Optimize settings |
7.6 Advanced Lighting Techniques
7.6.1 Volumetric Lighting Effects
Volumetric Lighting Applications
Volumetric lighting simulates the scattering of light in the atmosphere, often used to create dramatic light beam effects.
# Volumetric Lighting Settings
volume_lighting = {
'principled_volume': {
'density': 0.1, # Density
'anisotropy': 0.0, # Anisotropy
'absorption_color': (1.0, 1.0, 1.0), # Absorption color
'scattering_color': (1.0, 1.0, 1.0), # Scattering color
'emission_strength': 0.0 # Emission strength
}
}
7.6.2 Ray Tracing Effects
Reflection and Refraction
# Ray Tracing Material Settings
ray_tracing_material = {
'use_screen_refraction': True, # Screen space refraction
'refraction_depth': 0.1, # Refraction depth
'use_backface_culling': False, # Backface culling
'blend_method': 'ALPHA_HASHED', # Blend method
'shadow_method': 'HASHED' # Shadow method
}
7.6.3 Light Groups
# Light Group Settings
light_groups = {
'key_lights': ['Key_Light', 'Fill_Light'],
'rim_lights': ['Rim_Light', 'Hair_Light'],
'environment': ['HDRI_World', 'Sky_Light'],
'effects': ['Magic_Orb', 'Fire_Glow']
}
7.7 Indoor and Outdoor Lighting Scenes
7.7.1 Outdoor Daylight Lighting
# Daylight Lighting Configuration
daylight_setup = {
'sun_light': {
'energy': 5.0,
'angle': math.radians(0.533),
'color': (1.0, 0.95, 0.8)
},
'sky_texture': {
'sun_elevation': math.radians(60), # Noon sun elevation
'atmosphere_turbidity': 2.0, # Atmospheric turbidity
'ground_albedo': 0.3 # Ground albedo
}
}
7.7.2 Outdoor Night Lighting
# Night Lighting Configuration
night_setup = {
'moon_light': {
'energy': 0.5,
'color': (0.8, 0.9, 1.0) # Cool moonlight
},
'street_lights': {
'energy': 50.0,
'color': (1.0, 0.8, 0.6), # Warm streetlights
'falloff_type': 'INVERSE_SQUARE'
},
'world_background': {
'color': (0.02, 0.02, 0.05, 1.0) # Deep blue night sky
}
}
7.7.3 Indoor Natural Lighting
Indoor Lighting Principles
- Main light source: Natural light from windows
- Auxiliary light source: Indoor lamps
- Reflected light: Reflection from walls and floors
# Indoor Lighting Settings
interior_lighting = {
'window_light': {
'type': 'AREA',
'size_x': 2.0,
'size_y': 3.0,
'energy': 20.0,
'color': (0.9, 0.95, 1.0) # Cool daylight
},
'ceiling_light': {
'type': 'AREA',
'size': 1.0,
'energy': 15.0,
'color': (1.0, 0.9, 0.8) # Warm indoor light
}
}
7.8 Shadow Control Techniques
7.8.1 Shadow Type Comparison
Shadow Type | Calculation Method | Quality | Performance | Application |
---|---|---|---|---|
Ray Traced | Ray tracing | Highest | Lowest | Final render |
Shadow Map | Shadow mapping | Medium | High | Real-time preview |
Contact | Contact shadows | Low | Highest | Detail supplement |
7.8.2 Shadow Optimization Settings
# Shadow Optimization Configuration
shadow_optimization = {
'cascade_size': 1024, # Cascade shadow size
'high_bitdepth': True, # High bit depth
'soft_shadows': True, # Soft shadows
'contact_shadows': {
'use': True,
'distance': 0.2, # Contact distance
'bias': 0.001, # Bias value
'thickness': 0.2 # Thickness
}
}
7.9 Render Optimization Strategies
7.9.1 Layered Rendering
Layered Rendering Advantages
- Flexibility in post-production adjustments
- Reduces re-rendering
- Facilitates problem-solving
# Render Layer Settings
render_layers = {
'beauty': ['Combined'], # Main beauty pass
'lighting': ['DiffDir', 'DiffInd', 'GlossDir'], # Lighting decomposition
'utility': ['Normal', 'UV', 'ObjectID'], # Utility passes
'effects': ['Emission', 'Environment'] # Effects passes
}
7.9.2 Region Rendering
# Region Render Settings
region_render = {
'use_border': True, # Use border
'border_min_x': 0.25, # Minimum X
'border_max_x': 0.75, # Maximum X
'border_min_y': 0.25, # Minimum Y
'border_max_y': 0.75, # Maximum Y
'use_crop_to_border': True # Crop to border
}
7.9.3 Network Rendering
# Network Render Configuration
network_render = {
'server_address': '192.168.1.100',
'server_port': 8000,
'chunk_size': 64, # Chunk size
'priority': 50, # Priority
'use_compositing': False # Distributed compositing
}
7.10 Color Management
7.10.1 Color Space Settings
Importance of Color Management
Correct color management ensures color consistency from modeling to final output.
# Color Space Configuration
color_management = {
'view_transform': 'Filmic', # View transform
'look': 'None', # Look
'exposure': 0.0, # Exposure
'gamma': 1.0, # Gamma
'sequencer_colorspace': 'sRGB' # Sequencer color space
}
7.10.2 Tone Mapping
# Tone Mapping Parameters
tone_mapping = {
'filmic_contrast': 1.0, # Contrast
'filmic_saturation': 1.0, # Saturation
'filmic_whitepoint': 1.0, # Whitepoint
'filmic_shadows': 1.0, # Shadows
'filmic_midtones': 1.0, # Midtones
'filmic_highlights': 1.0 # Highlights
}
7.11 Practical Project Cases
7.11.1 Product Showcase Lighting
Goal: Create professional product showcase lighting effects
Key Settings:
- Key Light: Large area soft light
- Fill Light: Reduce shadow contrast
- Background Light: Clean background separation
- Rim Light: Highlight product edges
# Product Showcase Lighting Settings
product_lighting = {
'key_light': {
'type': 'AREA',
'size': 3.0,
'energy': 100.0,
'location': (2, -3, 4)
},
'fill_light': {
'type': 'AREA',
'size': 4.0,
'energy': 30.0,
'location': (-2, -2, 2)
},
'rim_light': {
'type': 'AREA',
'size': 1.0,
'energy': 80.0,
'location': (0, 4, 3)
}
}
7.11.2 Architectural Visualization Lighting
Goal: Create realistic indoor and outdoor architectural lighting
Key Techniques:
- HDRI environment lighting
- Sun light simulation
- Indoor artificial light sources
- Material and lighting coordination
7.11.3 Character Lighting Setup
Goal: Create cinematic lighting for 3D characters
Key Techniques:
- Three-point lighting basics
- Skin tone-adapted light color
- Independent hair lighting
- Eye highlight emphasis
7.12 Shortcuts and Workflow
7.12.1 Lighting Related Shortcuts
Shortcut | Function | Use Case |
---|---|---|
Shift + A | Add Light | Create lighting |
Ctrl + L | Select All Lights | Batch adjustment |
Shift + L | Select Similar Lights | Adjust similar types |
H | Hide Selected | Simplify view |
Alt + H | Unhide | Restore visibility |
7.12.2 Rendering Related Shortcuts
Shortcut | Function | Description |
---|---|---|
F12 | Start Render | Full image render |
Ctrl + F12 | Render Animation | Sequence render |
F11 | Show Render Result | View result |
Shift + Z | Toggle Render View | Real-time preview |
Z | View Toggle | Display mode |
7.13 Troubleshooting
7.13.1 Render Noise Issues
Common Sources of Noise
- Insufficient sample count
- Improper lighting setup
- Overly complex material reflections
- Insufficient indirect lighting calculation
# Denoising Setting Optimization
denoising_setup = {
'use_denoising': True,
'denoiser': 'OPTIX', # Or 'OPENIMAGEDENOISE'
'denoise_pass': 'COMBINED', # Denoise pass
'denoising_prefilter': 'ACCURATE', # Prefilter
'use_denoising_start_sample': True, # Start sample
'denoising_start_sample': 1 # Start sample count
}
7.13.2 Overexposure Issues
# Exposure Control Methods
exposure_control = {
'method_1': 'Lower light intensity',
'method_2': 'Adjust world exposure value',
'method_3': 'Use tone mapping',
'method_4': 'Add fill light to balance'
}
7.13.3 Shadow Artifact Handling
# Shadow Issue Solutions
shadow_fixes = {
'acne': 'Increase shadow bias',
'peter_panning': 'Decrease bias',
'soft_shadows': 'Increase light source area',
'cascade_shadow': 'Adjust cascade settings'
}
Chapter Summary
This chapter systematically covered the core techniques of 3D lighting and rendering:
- Lighting Theory: Understood the physical properties of light and lighting models
- Light Source Usage: Mastered the characteristics and applications of various light sources
- Environment Lighting: Learned to use HDRI and procedural skies
- Render Engines: Compared the pros and cons of Cycles and Eevee
- Advanced Techniques: Mastered effects like volumetric lighting and ray tracing
- Practical Applications: Improved practical skills through project exercises
Lighting is a core skill in 3D art, requiring a lot of practice and observation to develop a sense of light and shadow. In the next chapter, we will begin to learn the basics of animation production.
Continuous Improvement
Observe the changes in light and shadow in the real world, analyze the lighting characteristics at different times and weather conditions. This will greatly enhance your lighting design skills.