Realtime Compositor: Immediately realize transformations #112332

Merged
Omar Emara merged 6 commits from OmarEmaraDev/blender:realize-transformation into main 2023-10-12 11:04:59 +02:00
Member

This patch immediately realizes the scale and rotation components of
transformations at the point of transform nodes. The translate component is
still delayed and only realized when really needed to avoid clipping.

Transformed results are always realized in an expanded domain that avoids
clipping due to rotation or scaling. The size of the transformed domain is
clipped to the GPU texture size limit for now until we have support for huge
textures, that limit is typically 16k.

A potential optimization is to join all consecutive transform and realize
operations into a single realize operation.

This patch immediately realizes the scale and rotation components of transformations at the point of transform nodes. The translate component is still delayed and only realized when really needed to avoid clipping. Transformed results are always realized in an expanded domain that avoids clipping due to rotation or scaling. The size of the transformed domain is clipped to the GPU texture size limit for now until we have support for huge textures, that limit is typically 16k. A potential optimization is to join all consecutive transform and realize operations into a single realize operation.
Omar Emara added 1 commit 2023-09-13 16:30:07 +02:00
9bc909b336 Realtime Compositor: Immediately realize transformations
This patch immediately realizes the scale and rotation component of
transformations at the point of transform nodes, as per the discussion
in #108944.
Omar Emara added 1 commit 2023-09-14 14:12:19 +02:00
Omar Emara added 1 commit 2023-09-14 15:07:34 +02:00
Omar Emara changed title from WIP: Realtime Compositor: Immediately realize transformations to Realtime Compositor: Immediately realize transformations 2023-09-14 15:09:29 +02:00
Omar Emara requested review from Sergey Sharybin 2023-09-14 15:18:07 +02:00
Author
Member

A consequence of that change is that rotated tiles are now impossible to achieve using the Translate Wrapping mechanism.

Also, since the wrapping mode is inherited by transform nodes down the node tree, the user might not get an alpha background. But this is less of an implication of this patch and more an implication of the design of the wrapping mechanism in the compositor.

20230914-162501.png

A consequence of that change is that rotated tiles are now impossible to achieve using the Translate Wrapping mechanism. <video src="/attachments/d06d7970-f17d-47ce-bcc4-37f06bbcae7e" title="20230914-162226.mp4" controls></video> Also, since the wrapping mode is inherited by transform nodes down the node tree, the user might not get an alpha background. But this is less of an implication of this patch and more an implication of the design of the wrapping mechanism in the compositor. ![20230914-162501.png](/attachments/35d4c155-be29-4efe-91eb-9cb0b15e85b1)
Omar Emara added 1 commit 2023-09-15 11:01:21 +02:00
buildbot/vexp-code-patch-coordinator Build done. Details
cd2214350a
Fix jittered rotations
Author
Member

@blender-bot package

@blender-bot package
Member

Package build started. Download here when ready.

Package build started. [Download here](https://builder.blender.org/download/patch/PR112332) when ready.

I always found wrapping a bit hard to follow because of its inheritance. Would it be possible to make it non-inheritable, applied immediately, and added to the Transform node?

I always found wrapping a bit hard to follow because of its inheritance. Would it be possible to make it non-inheritable, applied immediately, and added to the Transform node?
Author
Member

@Sergey It can't be applied immediately, since wrapping technically just specifies the method of realizing on a domain, "on a domain" being the keyworkd here. So that's not possible, but we always use a None wrapping method when realizing transforms if we choose to.

@Sergey It can't be applied immediately, since wrapping technically just specifies the method of realizing on a domain, "on a domain" being the keyworkd here. So that's not possible, but we always use a None wrapping method when realizing transforms if we choose to.

"On a domain" is the current implementation. And to me this is kind of confusing. So the idea was to not set it on a domain, and apply it immediately. So if you translate by 100px you'll immediately get an image with the translation and wrapping applied, without attempting to chain it with other nodes (and this is why we would need the option on the Transform node).

Surely, it could break some compatibility, but it does seem to simplify mental model.

"On a domain" is the current implementation. And to me this is kind of confusing. So the idea was to not set it on a domain, and apply it immediately. So if you translate by 100px you'll immediately get an image with the translation and wrapping applied, without attempting to chain it with other nodes (and this is why we would need the option on the Transform node). Surely, it could break some compatibility, but it does seem to simplify mental model.
Author
Member

But this would remove the ability to create a repeating pattern like was possible before. Would that be acceptable?

But this would remove the ability to create a repeating pattern like was possible before. Would that be acceptable?

I think it still would be possible if the Wrap option is added to the Transform node.

I think it still would be possible if the Wrap option is added to the Transform node.
Author
Member

If I understand correctly, immediate realization of wrapping is essentially what the Full Frame compositor already does. And it is not possible to make a repeating pattern in that case, this was described in "Section 7: Wrapping" in the comparison document, in particular, see figure 17.

If I understand correctly, immediate realization of wrapping is essentially what the Full Frame compositor already does. And it is not possible to make a repeating pattern in that case, this was described in "Section 7: Wrapping" in the comparison document, in particular, see figure 17.
Omar Emara added the
Module
VFX & Video
Interest
Compositing
labels 2023-10-06 10:22:28 +02:00

To compensate for the lost functionality with repeating, it would be nice to add a wrapping mode option to the Transform node.

To compensate for the lost functionality with repeating, it would be nice to add a wrapping mode option to the Transform node.
Sergey Sharybin approved these changes 2023-10-10 17:08:23 +02:00
Sergey Sharybin left a comment
Owner

To me it also seem we can add option to the transform node, and repeat when scaling is used. That fits the current semantic better.

If that's the only known downside i think it is easier to move on with the patch, and add option as needed.

To me it also seem we can add option to the transform node, and repeat when scaling is used. That fits the current semantic better. If that's the only known downside i think it is easier to move on with the patch, and add option as needed.
Author
Member

@Sergey @brecht I am a bit confused on what was agreed on now. So just to clarify:

  • Should we immediately apply translation if wrapping is enabled in a "clip on one side, wrap on the other side" fashion?
  • Should we fill the empty areas after rotation based on wrapping options?
  • Should we ignore wrapping in future domain realizations, and hence lose the ability to do repetitions?
  • Should we also add the Wrapping options to the Rotate node?
@Sergey @brecht I am a bit confused on what was agreed on now. So just to clarify: - Should we immediately apply translation if wrapping is enabled in a "clip on one side, wrap on the other side" fashion? - Should we fill the empty areas after rotation based on wrapping options? - Should we ignore wrapping in future domain realizations, and hence lose the ability to do repetitions? - Should we also add the Wrapping options to the Rotate node?

Should we immediately apply translation if wrapping is enabled in a "clip on one side, wrap on the other side" fashion?

Yep.

Should we fill the empty areas after rotation based on wrapping options?

I think so.
In theory, it will make the transform code more generic: "just" apply matrix transform with wrapping option enabled.

Should we ignore wrapping in future domain realizations, and hence lose the ability to do repetitions?

Ignore the wrapping in the future domain indeed.

Wrapping can be brought back by adding wrapping option to the Transform node, and doing scale operation there. This would fit closer to the current paradigm of compositor.
Alternatively (something I am not fully convinced in) we can add Repeat/Tile node. This is how some compositing tools do it, but it has its drawbacks.

Regardless, adding more options to other nodes or adding new nodes should be done as separate PR. I do not see it a stopper for this incremental step.

Should we also add the Wrapping options to the Rotate node?

I think all transformation nodes can have it. But it is something to tackle separately from this PR.

> Should we immediately apply translation if wrapping is enabled in a "clip on one side, wrap on the other side" fashion? Yep. > Should we fill the empty areas after rotation based on wrapping options? I think so. In theory, it will make the transform code more generic: "just" apply matrix transform with wrapping option enabled. > Should we ignore wrapping in future domain realizations, and hence lose the ability to do repetitions? Ignore the wrapping in the future domain indeed. Wrapping can be brought back by adding wrapping option to the Transform node, and doing scale operation there. This would fit closer to the current paradigm of compositor. Alternatively (something I am not fully convinced in) we can add Repeat/Tile node. This is how some compositing tools do it, but it has its drawbacks. Regardless, adding more options to other nodes or adding new nodes should be done as separate PR. I do not see it a stopper for this incremental step. > Should we also add the Wrapping options to the Rotate node? I think all transformation nodes can have it. But it is something to tackle separately from this PR.
Author
Member

@Sergey Thanks. The plan is now clear to me.

@Sergey Thanks. The plan is now clear to me.
Omar Emara added 2 commits 2023-10-12 10:56:26 +02:00
Omar Emara merged commit e592763940 into main 2023-10-12 11:04:59 +02:00
Omar Emara deleted branch realize-transformation 2023-10-12 11:05:00 +02:00
Sign in to join this conversation.
No reviewers
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
4 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#112332
No description provided.