Cycles: Override World per View Layer #117920

Merged
Brecht Van Lommel merged 8 commits from JonasDichelle/blender:override-background into main 2024-02-09 12:16:25 +01:00
Contributor

Override World per View Layer

Description

This pull request adds the functionality to override the current world for each view layer, this adds to the current functionality of being able to override the material for all objects per view layer.

Why?

This feature is useful for many production scenarios as it allows for the creation of separate render passes with specific worlds. This would help workflows that require different skies or other backgrounds for compositing.

Implementation

I mostly coppied the implementation of the material_override code and added code to set the world to world_override at render time.

Design issue: #117919

# Override World per View Layer ## Description This pull request adds the functionality to override the current world for each view layer, this adds to the current functionality of being able to override the material for all objects per view layer. ### Why? This feature is useful for many production scenarios as it allows for the creation of separate render passes with specific worlds. This would help workflows that require different skies or other backgrounds for compositing. ### Implementation I mostly coppied the implementation of the `material_override` code and added code to set the `world` to `world_override` at render time. <video src="/attachments/dbca0086-5129-468f-968e-1a9a42da571e" title="blender_wtJyvyipuU.mp4" controls></video> Design issue: #117919
Jonas Dichelle added 1 commit 2024-02-06 21:55:41 +01:00
Jonas Dichelle added 1 commit 2024-02-07 16:43:50 +01:00
-found and added missing use of world_override
-removed hacky use of ED_render_engine_changed
Jonas Dichelle added 1 commit 2024-02-07 16:44:56 +01:00
Jonas Dichelle added 1 commit 2024-02-07 16:46:03 +01:00
Merge branch 'main' of projects.blender.org:blender/blender into override-background
Some checks failed
buildbot/vexp-code-patch-lint Build done.
buildbot/vexp-code-patch-windows-amd64 Build done.
buildbot/vexp-code-patch-linux-x86_64 Build done.
buildbot/vexp-code-patch-darwin-x86_64 Build done.
buildbot/vexp-code-patch-darwin-arm64 Build done.
buildbot/vexp-code-patch-coordinator Build done.
28ade7fb2e
Jonas Dichelle changed title from WIP: Override World per View Layer to Override World per View Layer 2024-02-07 19:19:29 +01:00
Jonas Dichelle changed title from Override World per View Layer to Cycles: Override World per View Layer 2024-02-07 19:48:09 +01:00
Jonas Dichelle requested review from Brecht Van Lommel 2024-02-07 19:50:25 +01:00
Brecht Van Lommel requested changes 2024-02-08 15:31:27 +01:00
Brecht Van Lommel left a comment
Owner

Thanks.

Thanks.
@ -1877,6 +1877,15 @@ void rna_ViewLayer_material_override_update(Main *bmain, Scene * /*scene*/, Poin
DEG_relations_tag_update(bmain);
}
void rna_ViewLayer_world_override_update(Main *bmain, Scene *scene, PointerRNA *ptr)

Instead of adding a new function, can you rename rna_ViewLayer_material_override_update to rna_ViewLayer_override_update, and use it for both?

The NC_SCENE | ND_RENDER_OPTIONS, as used for material overrides are correct for the world too, it should not be NC_WORLD because it's not the world itself that is changing.

Instead of adding a new function, can you rename `rna_ViewLayer_material_override_update` to `rna_ViewLayer_override_update`, and use it for both? The `NC_SCENE | ND_RENDER_OPTIONS,` as used for material overrides are correct for the world too, it should not be `NC_WORLD` because it's not the world itself that is changing.
JonasDichelle marked this conversation as resolved
@ -4740,0 +4751,4 @@
RNA_def_property_struct_type(prop, "World");
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
RNA_def_property_ui_text(prop, "World Override", "World to override world in this view layer");

Would shorten the description to: "Override world in this view layer"

Would shorten the description to: "Override world in this view layer"
JonasDichelle marked this conversation as resolved

@blender-bot build

@blender-bot build
Jonas Dichelle added 1 commit 2024-02-08 17:35:47 +01:00
Jonas Dichelle added 1 commit 2024-02-08 18:19:06 +01:00
-merged functions for material and world overrides into view layer override function
-updated description
Jonas Dichelle requested review from Brecht Van Lommel 2024-02-08 18:19:18 +01:00
Brecht Van Lommel requested changes 2024-02-08 18:31:57 +01:00
@ -1874,2 +1873,3 @@
void rna_ViewLayer_override_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Scene *scene = (Scene *)ptr->owner_id;
Scene *screen = (Scene *)ptr->owner_id;

Don't change scene to screen, it's actually a scene.

Don't change scene to screen, it's actually a scene.
Author
Contributor

I had coppied that from rna_Scene_world_update while testing.
Do you think it's a typo there?

I had coppied that from `rna_Scene_world_update` while testing. Do you think it's a typo there?
JonasDichelle marked this conversation as resolved
@ -1876,1 +1875,4 @@
Scene *screen = (Scene *)ptr->owner_id;
rna_Scene_render_update(bmain, scene, ptr);
WM_main_add_notifier(NC_SCENE | ND_RENDER_OPTIONS, &screen->id);

This should not be needed, it's already done through specifying those flags to RNA_def_property_update.

Really the operation of this function should be unchanged, only its name needs to be changed.

This should not be needed, it's already done through specifying those flags to `RNA_def_property_update`. Really the operation of this function should be unchanged, only its name needs to be changed.
JonasDichelle marked this conversation as resolved
Jonas Dichelle added 1 commit 2024-02-08 18:46:29 +01:00
made rna_ViewLayer_override_update like old rna_ViewLayer_material_override_update
Some checks failed
buildbot/vexp-code-patch-lint Build done.
buildbot/vexp-code-patch-linux-x86_64 Build done.
buildbot/vexp-code-patch-windows-amd64 Build done.
buildbot/vexp-code-patch-coordinator Build done.
78eafbc938
Jonas Dichelle requested review from Brecht Van Lommel 2024-02-08 18:48:05 +01:00
Brecht Van Lommel approved these changes 2024-02-08 18:54:52 +01:00

@blender-bot build

@blender-bot build
Jonas Dichelle added 1 commit 2024-02-08 19:09:55 +01:00
fixed formatting
All checks were successful
buildbot/vexp-code-patch-darwin-x86_64 Build done.
buildbot/vexp-code-patch-windows-amd64 Build done.
buildbot/vexp-code-patch-coordinator Build done.
50be531933

@blender-bot build

@blender-bot build
Brecht Van Lommel approved these changes 2024-02-08 19:13:03 +01:00
Brecht Van Lommel merged commit f2e27ef7b6 into main 2024-02-09 12:16:25 +01:00
Brecht Van Lommel deleted branch override-background 2024-02-09 12:16:27 +01:00
Sign in to join this conversation.
No reviewers
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Code Documentation
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#117920
No description provided.