Compositor: Viewport issues when zoomed in #111344

Open
opened 2023-08-21 14:55:25 +02:00 by Dalai Felinto · 4 comments

Blender Version
Broken: version: 4.0.0 Alpha, branch: main, commit date: 2023-08-21 10:12, hash: f0a8c1946162
Worked: never

Short description of error
Composition Mask is "rendered" wrongly in the viewport when the camera is not fully in view.

Exact steps for others to reproduce the error

  • Open this file: zoomed_in.blend
  • Notice that in the viewport the view is zoomed in inside the camera view.

Current buggy result:
image

The mask only matches when the entire camera is in view:
image

**Blender Version** Broken: version: 4.0.0 Alpha, branch: main, commit date: 2023-08-21 10:12, hash: `f0a8c1946162` Worked: never **Short description of error** Composition Mask is "rendered" wrongly in the viewport when the camera is not fully in view. **Exact steps for others to reproduce the error** * Open this file: [zoomed_in.blend](/attachments/6e786259-47d2-4d0b-b8b4-96dc8a51089f) * Notice that in the viewport the view is zoomed in inside the camera view. Current buggy result: ![image](/attachments/3d03ef99-cca0-4c22-b02f-e6d8219ba5c9) The mask only matches when the entire camera is in view: ![image](/attachments/afa94e35-ecc5-40af-a4df-c340c4ca3f20)
Dalai Felinto added this to the Compositing project 2023-08-21 14:55:53 +02:00
Germano Cavalcante added
Status
Confirmed
and removed
Status
Needs Triage
labels 2023-08-21 19:07:59 +02:00

I can confirm the problem.
I suppose it has something to do with the rcti get_compositing_region() function in compositor_engine.cc.

The code was introduced in cc78fd4e93 by @OmarEmaraDev

I can confirm the problem. I suppose it has something to do with the `rcti get_compositing_region()` function in `compositor_engine.cc`. The code was introduced in cc78fd4e9364338126e5145ff96ae6c544939042 by @OmarEmaraDev
Germano Cavalcante added the
Interest
EEVEE & Viewport
label 2023-08-21 19:30:16 +02:00
Member

Consider the following example where we have a 1000x800 viewport and a 500x500
final render resolution, and consequently a camera of the same resolution.

Illustration

We have two options for how the compositor should operate on that setup, each of
which is discussed in the following two sections.

Camera Compositing

The compositor can constrain itself to the camera region, and out of camera
regions will be left unaltered regardless of passepartout.

Advantages:

  • The aspect ratio of the compositing space will match that of the final render
    compositing pipeline.
  • Input resources that assume the size of the compositing space like Masks will
    have the same size in both compositions and will align with the camera in their
    identity transform.
  • The result of compositing will be viewport size invariant and the user will be
    able to align images easily.

Disadvantages:

  • Regions outside of the camera will remain unaltered, which can look weird if
    the passepartout is not opaque.

Viewport Compositing

The compositor will operate on the entire viewport and will ignore the camera
view.

The aforementioned advantages and disadvantages are essentially reversed, but
can be partially alleviated using the alternatives described in each of the
following sections.

Transformed Input Resources

Input resources can assume the size of the camera region and transformed
relative to the space of viewport such that they align with the camera.

The disadvantages is that pre-transformed resources can be unintuitive to work
with, for instance, rotating the resource will also move it due to the centered
pivot of the compositor transforms. Moreover, when realized on the domain of the
viewport, the areas outside of the original mask will assume a zero values,
which might not be what the users wants. Finally, the different domains of the
inputs can be harder to reason about for users, as opposed to having all inputs
have the same domain.

Padded Input Resources

Input resources can be zero padded to the size of the viewport, such that all
inputs will have the same size.

This alleviates the different sizes disadvantages but shares the rest of the
disadvantages as the transformed input resources alternative.


Neither of the alternatives workarounds the aspect ratio change and the
difference in sizes. To workaround those, one would have to change all nodes to
operate in the scene camera space. Except this would break setups where one is
processing an image that is standalone or simply is not related to the scene.

Consider the following example where we have a 1000x800 viewport and a 500x500 final render resolution, and consequently a camera of the same resolution. ![Illustration](/attachments/bc12154b-96c3-478e-a4ce-c59ef083dcdb) We have two options for how the compositor should operate on that setup, each of which is discussed in the following two sections. ## Camera Compositing The compositor can constrain itself to the camera region, and out of camera regions will be left unaltered regardless of passepartout. #### Advantages: - The aspect ratio of the compositing space will match that of the final render compositing pipeline. - Input resources that assume the size of the compositing space like Masks will have the same size in both compositions and will align with the camera in their identity transform. - The result of compositing will be viewport size invariant and the user will be able to align images easily. #### Disadvantages: - Regions outside of the camera will remain unaltered, which can look weird if the passepartout is not opaque. ## Viewport Compositing The compositor will operate on the entire viewport and will ignore the camera view. The aforementioned advantages and disadvantages are essentially reversed, but can be partially alleviated using the alternatives described in each of the following sections. #### Transformed Input Resources Input resources can assume the size of the camera region and transformed relative to the space of viewport such that they align with the camera. The disadvantages is that pre-transformed resources can be unintuitive to work with, for instance, rotating the resource will also move it due to the centered pivot of the compositor transforms. Moreover, when realized on the domain of the viewport, the areas outside of the original mask will assume a zero values, which might not be what the users wants. Finally, the different domains of the inputs can be harder to reason about for users, as opposed to having all inputs have the same domain. #### Padded Input Resources Input resources can be zero padded to the size of the viewport, such that all inputs will have the same size. This alleviates the different sizes disadvantages but shares the rest of the disadvantages as the transformed input resources alternative. ---- Neither of the alternatives workarounds the aspect ratio change and the difference in sizes. To workaround those, one would have to change all nodes to operate in the scene camera space. Except this would break setups where one is processing an image that is standalone or simply is not related to the scene.
40 KiB

Perhaps this deserves a topic on DevTalk.

For "Camera Compositing", in my opinion, even with the weirdness, I feel it would be more useful to constrain to the camera region.
(It would be interesting to see pictures showing the disadvantages.)

For "Viewport Compositing", if the camera aspect is kept for the composition region, I imagine the composition should also be cropped just like in camera view.
(Some kind of border should be drawn in this case.)

If compositing the entire viewport is really useful for some cases. Then it could have an option in the popover.
Like [X] Keep Rendering Aspect.

Perhaps this deserves a topic on [DevTalk](https://devtalk.blender.org/). For "Camera Compositing", in my opinion, even with the weirdness, I feel it would be more useful to constrain to the camera region. (It would be interesting to see pictures showing the disadvantages.) For "Viewport Compositing", if the camera aspect is kept for the composition region, I imagine the composition should also be cropped just like in camera view. (Some kind of border should be drawn in this case.) If compositing the entire viewport is really useful for some cases. Then it could have an option in the popover. Like `[X] Keep Rendering Aspect`.
Author
Owner

@OmarEmaraDev It may help to clarify how people expect (or are expected) to use the Viewport Compositing (as oppose to the camera compositing).


The Camera Compositing doesn't need all nodes to be in Scene Camera Space. What it needs is for nodes to have their absolute pixels to be internally converted to the scene camera space relative to the camera 100% size.

And on top of that to have the aspect ratio respected. For me the simpler example is how border render should just work with the viewport compositor, and give you the same result as if you were to render it out with F12.

@OmarEmaraDev It may help to clarify how people expect (or are expected) to use the Viewport Compositing (as oppose to the camera compositing). --- The Camera Compositing doesn't need all nodes to be in Scene Camera Space. What it needs is for nodes to have their absolute pixels to be internally converted to the scene camera space relative to the camera 100% size. And on top of that to have the aspect ratio respected. For me the simpler example is how border render should just work with the viewport compositor, and give you the same result as if you were to render it out with F12.
Sergey Sharybin removed this from the Compositing project 2023-09-06 10:37:50 +02:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
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
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
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
EEVEE & Viewport
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
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
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
3 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#111344
No description provided.