Particle System missing on right eye when renderd via terminal #70114

Closed
opened 2019-09-20 15:05:07 +02:00 by Simeon Conzendorf · 23 comments

System Information
Operating system: Windows-10-10.0.18362 64 Bits
Graphics card: GeForce GTX 980/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 431.36

Blender Version
Broken: version: 2.81 (sub 12), branch: master, commit date: 2019-09-19 20:35, hash: c8df6f2cf9
I tested also 2.8 and it's also broken.

Short description of error
If you render a stereo image via terminal and use particle system emitter/hair the particle are only visible on one eye (left).

Exact steps for others to reproduce the error

  • Add a second cube and make it smaller
  • Add a Particle System to the first cube, as hair, set "render as" to object and choose second cube.
  • In output properties enable stereoscopy. Set Outputfilename.
  • Save blendfile and start rendering via terminal, like this on windows:
    C:\Users\simeo\Desktop\blender2.8_nightly\blender.exe -b C:\Users\simeo\Desktop\bugreports\stereo_terminal_bug.blend -f 1
    Here's my blendfile:
    stereo_terminal_bug.blend

Here's a comparison between rendered with and without terminal:
stereobug_with_ui.jpg

**System Information** Operating system: Windows-10-10.0.18362 64 Bits Graphics card: GeForce GTX 980/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 431.36 **Blender Version** Broken: version: 2.81 (sub 12), branch: master, commit date: 2019-09-19 20:35, hash: `c8df6f2cf9` I tested also 2.8 and it's also broken. **Short description of error** If you render a stereo image via terminal and use particle system emitter/hair the particle are only visible on one eye (left). **Exact steps for others to reproduce the error** - Add a second cube and make it smaller - Add a Particle System to the first cube, as hair, set "render as" to object and choose second cube. - In output properties enable stereoscopy. Set Outputfilename. - Save blendfile and start rendering via terminal, like this on windows: C:\Users\simeo\Desktop\blender2.8_nightly\blender.exe -b C:\Users\simeo\Desktop\bugreports\stereo_terminal_bug.blend -f 1 Here's my blendfile: [stereo_terminal_bug.blend](https://archive.blender.org/developer/F7760782/stereo_terminal_bug.blend) Here's a comparison between rendered with and without terminal: ![stereobug_with_ui.jpg](https://archive.blender.org/developer/F7760784/stereobug_with_ui.jpg)

Added subscriber: @SimeonConzendorf

Added subscriber: @SimeonConzendorf

#70702 was marked as duplicate of this issue

#70702 was marked as duplicate of this issue
Member

Added subscriber: @JacquesLucke

Added subscriber: @JacquesLucke
Member

This issue only seems to affect Cycles, can you confirm that?

This issue only seems to affect Cycles, can you confirm that?

Yes, I can confirm, that it's a bug only in cycles.

Yes, I can confirm, that it's a bug only in cycles.

Added subscriber: @sorinv

Added subscriber: @sorinv

Added subscriber: @lpug21

Added subscriber: @lpug21

I have been able to replicate this while rendering from the command line, but for a few days one of my files was having this issue while also rendering from the GUI.

My scene is complex, and is being rendered out in spherical (equirectangular) stereoscopic format. On cycles, affects both GPU and CPU render.

I have been able to replicate this while rendering from the command line, but for a few days one of my files was having this issue while also rendering from the GUI. My scene is complex, and is being rendered out in spherical (equirectangular) stereoscopic format. On cycles, affects both GPU and CPU render.

For anyone requiring a work-around for this bug, I have been able to successfully render from the terminal by rendering one eye at a time, and manually combining both left and right eyes into one image, after the render is complete.

image.png

For anyone requiring a work-around for this bug, I have been able to successfully render from the terminal by rendering one eye at a time, and manually combining both left and right eyes into one image, after the render is complete. ![image.png](https://archive.blender.org/developer/F7797636/image.png)

Another possible workaround is the operator "make instances real". Execute, then deactivate the particle system. At least for rendering still images it worked for me, before I sent the file to our renderfarm.

Another possible workaround is the operator "make instances real". Execute, then deactivate the particle system. At least for rendering still images it worked for me, before I sent the file to our renderfarm.
Member

Added subscribers: @bernardoiraci, @lichtwerk, @grosgood

Added subscribers: @bernardoiraci, @lichtwerk, @grosgood

Added subscriber: @seunggs

Added subscriber: @seunggs

Any update on this?

Any update on this?

Added subscriber: @Saulzar

Added subscriber: @Saulzar

We also have this problem, ran into it using a multi-view render from the terminal. From in the interface the render works fine.

Blender 2.83, Linux

We also have this problem, ran into it using a multi-view render from the terminal. From in the interface the render works fine. Blender 2.83, Linux

Added subscriber: @GuillaumePayet

Added subscriber: @GuillaumePayet

One workaround we have been using is to use emitters instead of hair, perhaps this won't work for many uses of hair but for us it seems enough.

for settings in bpy.data.particles:
  settings.type = "EMITTER"
  settings.frame_start = 0
  settings.frame_end = 3000
  settings.lifetime = 3000
  settings.show_unborn = True
  settings.physics_type = "NO"
One workaround we have been using is to use emitters instead of hair, perhaps this won't work for many uses of hair but for us it seems enough. ``` for settings in bpy.data.particles: settings.type = "EMITTER" settings.frame_start = 0 settings.frame_end = 3000 settings.lifetime = 3000 settings.show_unborn = True settings.physics_type = "NO"
Philipp Oeser removed the
Interest
Render & Cycles
label 2023-02-09 13:59:31 +01:00

The issue is still present in Version 3.5.1 as long as you turn on motion blur. Seems to be closely related to issue concerning curves (even if it seems to affect different blender versions). (#107589)

The issue is still present in Version 3.5.1 as long as you turn on motion blur. Seems to be closely related to issue concerning curves (even if it seems to affect different blender versions). (https://projects.blender.org/blender/blender/issues/107589)
Member

I think I found the issue here:

After the first view syncs the data into Cycles, it calls BlenderSync::free_data_after_sync, which frees the object caches (and therefore also the particle cache), but only when rendering headless.
Therefore, when syncing for the second view, the depsgraph iterator in BlenderSync::sync_objects doesn't see the instanced object anymore, so it's skipped in the second view.

To me, the obvious fix would be to only free the caches if it's the last (or only) view. However, immediately after free_data_after_sync, we already call BlenderSession::free_blender_memory_if_possible if it's the last view, which also frees the caches.

Therefore, I guess we might as well remove free_data_after_sync completely? Doing so fixes this bug, as well as #107589. Or is there a smarter way to fix this?

cc @Sergey @brecht

I think I found the issue here: After the first view syncs the data into Cycles, it calls `BlenderSync::free_data_after_sync`, which frees the object caches (and therefore also the particle cache), but only when rendering headless. Therefore, when syncing for the second view, the depsgraph iterator in `BlenderSync::sync_objects` doesn't see the instanced object anymore, so it's skipped in the second view. To me, the obvious fix would be to only free the caches if it's the last (or only) view. However, immediately after `free_data_after_sync`, we already call `BlenderSession::free_blender_memory_if_possible` if it's the last view, which also frees the caches. Therefore, I guess we might as well remove `free_data_after_sync` completely? Doing so fixes this bug, as well as #107589. Or is there a smarter way to fix this? cc @Sergey @brecht
Lukas Stockner self-assigned this 2024-04-01 20:19:43 +02:00
Member

Also fixes #73221 actually.

Also fixes #73221 actually.

The original intent of the code was to minimize peak memory during render by avoiding having copies of essentially the same data on Blender and Cycles side, before even more memory is allocated for images, BVH, etc. Unfortunately, the code around it got a bit more entangled than it should have over the years. So to me it is not off the desk to take a step back, and revisit this memory saving strategy, and make it more fitting into the current Blender design.

Without going into a deeper redesigns, it does sound correct to only make it so free_data_after_sync is run after the last synchronized view (maybe it can happen prior to builtin_images_load ?). However, it does not sound correct that we can simply remove free_data_after_sync, because free_blender_memory_if_possible only saves memory in headless memory, while free_data_after_sync can save memory in UI as well.

What I've also noticed is that b_ob.cache_release() does not seem to do things fully properly. It goes to BKE_object_free_caches, which frees some runtime memory, and tags object. However, tagging is supposed to happen on the original ID, not on the evaluated ID. So that could be the reason why there are more reports which do not use particles yet suffer from the same memory saving code. So maybe we can somehow properly tag objects for recalc, and keep peak memory low even when multiple views are rendered?

The original intent of the code was to minimize peak memory during render by avoiding having copies of essentially the same data on Blender and Cycles side, before even more memory is allocated for images, BVH, etc. Unfortunately, the code around it got a bit more entangled than it should have over the years. So to me it is not off the desk to take a step back, and revisit this memory saving strategy, and make it more fitting into the current Blender design. Without going into a deeper redesigns, it does sound correct to only make it so `free_data_after_sync` is run after the last synchronized view (maybe it can happen prior to `builtin_images_load` ?). However, it does not sound correct that we can simply remove `free_data_after_sync`, because `free_blender_memory_if_possible` only saves memory in headless memory, while `free_data_after_sync` can save memory in UI as well. What I've also noticed is that `b_ob.cache_release()` does not seem to do things fully properly. It goes to `BKE_object_free_caches`, which frees some runtime memory, and tags object. However, tagging is supposed to happen on the original ID, not on the evaluated ID. So that could be the reason why there are more reports which do not use particles yet suffer from the same memory saving code. So maybe we can somehow properly tag objects for recalc, and keep peak memory low even when multiple views are rendered?
Member

@Sergey Good point about the tagging - changing it to use DEG_get_original_object and tag the original object fixes #73221, but not the other two. On the other hand, !120543 fixes all three even without the tagging change. Do you think it still makes sense to change the tagging?

@Sergey Good point about the tagging - changing it to use `DEG_get_original_object` and tag the original object fixes #73221, but not the other two. On the other hand, !120543 fixes all three even without the tagging change. Do you think it still makes sense to change the tagging?

@LukasStockner I think it makes sense to fix the tagging, just to avoid things left in a inconsistent state, preventing other scenarios from accessing incorrect data.

The tricky part is the thread-safety. If someone deletes an object, doing DEG_get_original_object could lead to de-referencing freed memory. I don't think it is something that could happen currently because the free-caches is only used when the interface is locked, but it worth adding a warning comment around the function about it.

@LukasStockner I think it makes sense to fix the tagging, just to avoid things left in a inconsistent state, preventing other scenarios from accessing incorrect data. The tricky part is the thread-safety. If someone deletes an object, doing `DEG_get_original_object ` could lead to de-referencing freed memory. I don't think it is something that could happen currently because the free-caches is only used when the interface is locked, but it worth adding a warning comment around the function about it.
Blender Bot added
Status
Resolved
and removed
Status
Confirmed
labels 2024-04-15 17:41:09 +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
12 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#70114
No description provided.