Multiview camera suffix limited to four characters for images in compositor. #97527

Closed
opened 2022-04-22 00:41:58 +02:00 by Stephen Imhoff · 15 comments

System Information
Operating system: Ubuntu 20.04
Graphics card: Nvidia GeForce 1080 Hybrid

Blender Version
Broken: 3.1.2
Worked: Unknown

Error description

When working with multiview, it's possible to set up camera suffixes to import individual images in the compositor to import camera-specific images. One use of this is for camera-specific backgrounds. While camera suffixes are allowed to be of any length in the stereoscopy settings, the same is not true when images are imported in the compositor, being limited to just four characters. If a suffix longer than four characters is used, blender fails to recognize that the image is "multiview", and will render using only one of the images.

This limitation is not called out in the documentation, and no warning is generated. This is especially egregious because multiview images are saved with whatever suffix is given, making the reason for failure completely mysterious. Note that the need for any suffix at all on individual images isn't specified in the documentation either.

Exact steps for others to reproduce the error

  • Open attached multiview_bug.blend file (You will notice that there are 4 images packed inside the file)
  • In Output Properties, enable Stereoscopy
    • Change the File Suffix "_L" to "_Lef" and "_R" to "_Rig"
    • In the Image settings for Background_Lef.png enable Use Multi-View (note that the image was detected due to the Suffix)
    • Click on the 3D Glasses (Show Stereo) icon to automatically detect the other corresponding image.
  • Repeat the steps A, B and C but now with the suffixes "_Left" and "_Right". (It will not work).
    multiview_bug.blend

Original Report:
Open the following blend files, then press F12. In the working blend file, multiview outputs separate backgrounds for right and left. In the broken blend file, only the left background is used, despite both files being present.
multiview_broken.blend
multiview_working.blend

**System Information** Operating system: Ubuntu 20.04 Graphics card: Nvidia GeForce 1080 Hybrid **Blender Version** Broken: 3.1.2 Worked: Unknown **Error description** When working with multiview, it's possible to set up camera suffixes to import individual images in the compositor to import camera-specific images. One use of this is for camera-specific backgrounds. While camera suffixes are allowed to be of any length in the stereoscopy settings, the same is **not** true when images are imported in the compositor, being limited to just four characters. If a suffix longer than four characters is used, blender fails to recognize that the image is "multiview", and will render using only one of the images. This limitation is not called out in the documentation, and no warning is generated. This is especially egregious because multiview images are saved with whatever suffix is given, making the reason for failure completely mysterious. Note that the need for any suffix at all on individual images isn't specified in the documentation either. **Exact steps for others to reproduce the error** - Open attached `multiview_bug.blend` file (You will notice that there are 4 images packed inside the file) - In `Output Properties`, enable `Stereoscopy` - Change the `File Suffix` "_L" to "_Lef" and "_R" to "_Rig" - In the Image settings for `Background_Lef.png` enable `Use Multi-View` (note that the image was detected due to the Suffix) - Click on the 3D Glasses (Show Stereo) icon to automatically detect the other corresponding image. - Repeat the steps A, B and C but now with the suffixes "_Left" and "_Right". (It will not work). [multiview_bug.blend](https://archive.blender.org/developer/F13032075/multiview_bug.blend) --- **Original Report:** Open the following blend files, then press F12. In the working blend file, multiview outputs separate backgrounds for right and left. In the broken blend file, only the left background is used, despite both files being present. [multiview_broken.blend](https://archive.blender.org/developer/F13015053/multiview_broken.blend) [multiview_working.blend](https://archive.blender.org/developer/F13015054/multiview_working.blend)
Author

Added subscriber: @Clockwork-Muse

Added subscriber: @Clockwork-Muse
Member

Added subscriber: @lichtwerk

Added subscriber: @lichtwerk
Member

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'
Member

Can confirm, will check

Can confirm, will check
Member

Changed status from 'Confirmed' to: 'Needs User Info'

Changed status from 'Confirmed' to: 'Needs User Info'
Member

So, while I just discovered #97547 (Regression: Stereoscopy rendering crashes), I tested a bit and I have this file which seems to still work even though it has a suffix longer than 4 characters.

multiview_still_working.blend

I can still repro in your file, but can you also repro my file works?
Then the error might be burried somewhere else...

So, while I just discovered #97547 (Regression: Stereoscopy rendering crashes), I tested a bit and I have this file which seems to still work even though it has a suffix longer than 4 characters. [multiview_still_working.blend](https://archive.blender.org/developer/F13016047/multiview_still_working.blend) I can still repro in your file, but can you also repro my file works? Then the error might be burried somewhere else...
Author

Yes, I can repro your file works.

What your working file is doing, though, is the original filename (as opposed to the image name) still has a four-character suffix (three plus separator).
I am able to duplicate a working file by;

  • Creating images with only a four-character suffix.
  • Creating cameras with those four-character suffixes
  • Setting up multi-view with those four-character suffixes
  • Opening one of the images in the compositor, and marking it as "multiview" so that the other image is loaded.
  • Changing the suffixes in the multi-view panel to whatever I want, and the cameras to match.

From other testing, the only time the image filename suffix has to match is during the initial load.
If the extensions don't match during load, it's stuck as a single-view texture, even if you change the camera/multiview suffix to match (you need to force a reload using the "reload" button on the image tag - reloading the blender file itself is insufficient).
This has a more insidious knock-on effect: once the file is loaded, it's locked to the view. If you made an error with your camera setup (swapped two views, say), simply swapping the camera name and suffix is insufficient.

.... this strikes me as incredibly fragile/brittle.

Yes, I can repro your file works. What your working file is doing, though, is the original *filename* (as opposed to the *image name*) still has a four-character suffix (three plus separator). I am able to duplicate a working file by; - Creating images with only a four-character suffix. - Creating cameras with those four-character suffixes - Setting up multi-view with those four-character suffixes - Opening one of the images in the compositor, and marking it as "multiview" so that the other image is loaded. - Changing the suffixes in the multi-view panel to whatever I want, and the cameras to match. From other testing, the only time the image filename suffix has to match is during the initial load. If the extensions don't match during load, it's stuck as a single-view texture, even if you change the camera/multiview suffix to match (you need to force a reload using the "reload" button on the image tag - reloading the blender file itself is insufficient). This has a more insidious knock-on effect: once the file is loaded, it's locked to the view. If you made an error with your camera setup (swapped two views, say), simply swapping the camera name and suffix is insufficient. .... this strikes me as incredibly fragile/brittle.
Author

A side note - the real reason my "non working" file repros is because the other file is literally not included. That is, it would appear non-working regardless. In light of that, here's a series of steps to create an example non-working file.

Steps -

  • Create two files "Background_Left.png" and "Background_Right.png"
  • In a new blender file
    • Create two cameras named "Camera_Left" and "Camera_Right"
    • Under Output Properties enable Stereoscopy
    • Under Output Properties > Stereoscopy Change the type to "Multi-View"
    • Under Output Properties > Stereoscopy change the left and right camera suffixes to "_Left" and "_Right", respectively.
    • Under Compositing, enable "Use Nodes"
    • Add an compositing image node. Open either one of the images created previously. Under the node properties, enable "Use Multi-View"
    • Attach the output of the image node to the input of the Composite node.
    • Hit F12 (Render). Only the image selected will be part of the render output.

If you instead use a pair of four-character suffixes, both images will be part of the render output.

A side note - the real reason my "non working" file repros is because the other file is literally not included. That is, it would appear non-working regardless. In light of that, here's a series of steps to create an example non-working file. Steps - - Create two files "Background_Left.png" and "Background_Right.png" - In a new blender file - Create two cameras named "Camera_Left" and "Camera_Right" - Under Output Properties enable Stereoscopy - Under Output Properties > Stereoscopy Change the type to "Multi-View" - Under Output Properties > Stereoscopy change the left and right camera suffixes to "_Left" and "_Right", respectively. - Under Compositing, enable "Use Nodes" - Add an compositing image node. Open either one of the images created previously. Under the node properties, enable "Use Multi-View" - Attach the output of the image node to the input of the Composite node. - Hit F12 (Render). Only the image selected will be part of the render output. If you instead use a pair of four-character suffixes, both images will be part of the render output.
Member

Changed status from 'Needs User Info' to: 'Needs Triage'

Changed status from 'Needs User Info' to: 'Needs Triage'

Added subscribers: @brecht, @mano-wii

Added subscribers: @brecht, @mano-wii

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'

I can confirm the problem and by analyzing the code it looks like something is wrong here...
For some uncommented reason, the suffix of a stereo image is only compared if its size is less than or equal to the file extension size (in this case ".png").

Removing this limitation (and using index_act for safeness instead), the problem is resolved.

diff --git a/source/blender/blenkernel/intern/scene.cc b/source/blender/blenkernel/intern/scene.cc
index 0430269b75a..11ea06faea8 100644
--- a/source/blender/blenkernel/intern/scene.cc
+++ b/source/blender/blenkernel/intern/scene.cc
@@ -3232,9 +3232,8 @@ void BKE_scene_multiview_view_prefix_get(Scene *scene,
   LISTBASE_FOREACH (SceneRenderView *, srv, &scene->r.views) {
     if (BKE_scene_multiview_is_render_view_active(&scene->r, srv)) {
       const size_t len = strlen(srv->suffix);
-      const size_t ext_len = strlen(*r_ext);
-      if (ext_len >= len && STREQLEN(*r_ext - len, srv->suffix, len)) {
-        BLI_strncpy(r_prefix, name, strlen(name) - ext_len - len + 1);
+      if (index_act >= len && STREQLEN(*r_ext - len, srv->suffix, len)) {
+        BLI_strncpy(r_prefix, name, index_act - len + 1);
         break;
       }
     }

This limitation was added in e608f2e7ec, so @brecht, is this something for you to take a look at?

I can confirm the problem and by analyzing the code it looks like something is wrong here... For some uncommented reason, the suffix of a stereo image is only compared if its size is less than or equal to the file extension size (in this case `".png"`). Removing this limitation (and using `index_act` for safeness instead), the problem is resolved. ``` diff --git a/source/blender/blenkernel/intern/scene.cc b/source/blender/blenkernel/intern/scene.cc index 0430269b75a..11ea06faea8 100644 --- a/source/blender/blenkernel/intern/scene.cc +++ b/source/blender/blenkernel/intern/scene.cc @@ -3232,9 +3232,8 @@ void BKE_scene_multiview_view_prefix_get(Scene *scene, LISTBASE_FOREACH (SceneRenderView *, srv, &scene->r.views) { if (BKE_scene_multiview_is_render_view_active(&scene->r, srv)) { const size_t len = strlen(srv->suffix); - const size_t ext_len = strlen(*r_ext); - if (ext_len >= len && STREQLEN(*r_ext - len, srv->suffix, len)) { - BLI_strncpy(r_prefix, name, strlen(name) - ext_len - len + 1); + if (index_act >= len && STREQLEN(*r_ext - len, srv->suffix, len)) { + BLI_strncpy(r_prefix, name, index_act - len + 1); break; } } ``` This limitation was added in e608f2e7ec, so @brecht, is this something for you to take a look at?
Member

thx checking @mano-wii

thx checking @mano-wii

This issue was referenced by 44b318bd22

This issue was referenced by 44b318bd226948b71b4e2f65030f4b3440954f02

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Brecht Van Lommel self-assigned this 2022-04-28 17:36:36 +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
5 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#97527
No description provided.