Cycles slowdown and disk reading issues with large textures #79836

Closed
opened 2020-08-16 23:36:40 +02:00 by mantissa · 27 comments

System Information
Operating system: Void Linux (Kernel 5.7.15)
System Specs: AMD TR 3990X, 256GB RAM, AMD Radeon 5700XT

Blender Version
Broken: 2.83, 2.90, 2.91

Short description of error
When rendering with large (6K+) textures some file formats cause Cycles to slow down during rendering. Tested on CPU.

Exact steps for others to reproduce the error

In the below example I started with a fresh scene to test the different formats and their impact on render time.
In a simple scene with small textures <= 4K, there doesn't seem to be much of an impact.
However, when using larger textures (6-8K+) Cycles can sometimes hangs after "Updating shaders", when loading the textures, for an extended time.

The scene below just has Suzanne with a material that has three 8K textures.
When using TGA (the fastest in testing) vs JPG, the scene with targas starts rendering instantly and the scene with jpegs hangs for about 10 seconds after "Updating Shaders"
Other scenes start rendering and hang when the render tiles hit an object with large textures on it.

comparison.jpg

JPG seems to be the most affected, but I've also seen similar behavior with PNG and TIF files, it's hard to pin down what problematic about specific files and causes this behavior. There's a lot of disk reading happening, even though it pulls more data than the actual size of the textures.

On some scenes, I've seen slowdowns of multiple minutes, both in the viewport render preview and when rendering a frame. Anytime Cycles has to load the textures basically.
Switching color profiles in the image texture settings is also very slow with these jpegs. Packing the textures doesn't alleviate the problem.

Here's another scene that's just that same asset with three 8K textures again and here you can really see the difference in performance.

tree-linux.jpg

Just to eliminate any potential system variables, I tested the same file on a Windows machine with an Intel processor and witnessed the same behavior.

tree-windows.jpg

One thing I did notice is that Blender is pinned at 100% cpu usage the entire time and it's constantly reading from the disk, even though it seems to read way more data than the actual size of the file. For the jpegs in the example, that's three full minutes of high cpu use and roughly 10-20MB/s reads from the disk, even though the textures only total roughly 115MB for the tree example.

cpu_kernel_use.jpg

I'm more than happy to share the pine tree file, just not publicly as it contains some assets that I purchased and I want to respect the license.

**System Information** Operating system: Void Linux (Kernel 5.7.15) System Specs: AMD TR 3990X, 256GB RAM, AMD Radeon 5700XT **Blender Version** Broken: 2.83, 2.90, 2.91 **Short description of error** When rendering with large (6K+) textures some file formats cause Cycles to slow down during rendering. Tested on CPU. **Exact steps for others to reproduce the error** In the below example I started with a fresh scene to test the different formats and their impact on render time. In a simple scene with small textures <= 4K, there doesn't seem to be much of an impact. However, when using larger textures (6-8K+) Cycles can sometimes hangs after "Updating shaders", when loading the textures, for an extended time. The scene below just has Suzanne with a material that has three 8K textures. When using TGA (the fastest in testing) vs JPG, the scene with targas starts rendering instantly and the scene with jpegs hangs for about 10 seconds after "Updating Shaders" Other scenes start rendering and hang when the render tiles hit an object with large textures on it. ![comparison.jpg](https://archive.blender.org/developer/F8786040/comparison.jpg) JPG seems to be the most affected, but I've also seen similar behavior with PNG and TIF files, it's hard to pin down what problematic about specific files and causes this behavior. There's a lot of disk reading happening, even though it pulls more data than the actual size of the textures. On some scenes, I've seen slowdowns of multiple minutes, both in the viewport render preview and when rendering a frame. Anytime Cycles has to load the textures basically. Switching color profiles in the image texture settings is also very slow with these jpegs. Packing the textures doesn't alleviate the problem. Here's another scene that's just that same asset with three 8K textures again and here you can really see the difference in performance. ![tree-linux.jpg](https://archive.blender.org/developer/F8786349/tree-linux.jpg) Just to eliminate any potential system variables, I tested the same file on a Windows machine with an Intel processor and witnessed the same behavior. ![tree-windows.jpg](https://archive.blender.org/developer/F8786356/tree-windows.jpg) One thing I did notice is that Blender is pinned at 100% cpu usage the entire time and it's constantly reading from the disk, even though it seems to read way more data than the actual size of the file. For the jpegs in the example, that's three full minutes of high cpu use and roughly 10-20MB/s reads from the disk, even though the textures only total roughly 115MB for the tree example. ![cpu_kernel_use.jpg](https://archive.blender.org/developer/F8786366/cpu_kernel_use.jpg) I'm more than happy to share the pine tree file, just not publicly as it contains some assets that I purchased and I want to respect the license.
Author

Added subscriber: @Mantissa

Added subscriber: @Mantissa

Added subscriber: @SteffenD

Added subscriber: @SteffenD

Added subscriber: @iss

Added subscriber: @iss

Is this a regression from some specific Blender version?

Is this a regression from some specific Blender version?
Author

I did some quick testing in 2.82 and 2.81 and the behavior seems present there as well. I can have a look at 2.79 once I have some time to see it the problem exists there as well.

I did some quick testing in 2.82 and 2.81 and the behavior seems present there as well. I can have a look at 2.79 once I have some time to see it the problem exists there as well.
Author

Just had some time to check 2.80 and 2.79b to compare and it looks like this behavior goes pretty far back.

2.80:
comp-280.jpg

2.79b:
comp-279.jpg

Just had some time to check 2.80 and 2.79b to compare and it looks like this behavior goes pretty far back. 2.80: ![comp-280.jpg](https://archive.blender.org/developer/F8793707/comp-280.jpg) 2.79b: ![comp-279.jpg](https://archive.blender.org/developer/F8793710/comp-279.jpg)

In #79836#998743, @Mantissa wrote:
Just had some time to check 2.80 and 2.79b to compare and it looks like this behavior goes pretty far back.

Thanks for info. Can you upload example file that can be accessed publicly? Or is it as simple as just plug few 8K textures to shader and render?

I could have a look at this, as in at least confirm issue and do some profiling to see where is the bottleneck in my case, but my HW is like pentium 386 compared to yours :)

> In #79836#998743, @Mantissa wrote: > Just had some time to check 2.80 and 2.79b to compare and it looks like this behavior goes pretty far back. Thanks for info. Can you upload example file that can be accessed publicly? Or is it as simple as just plug few 8K textures to shader and render? I could have a look at this, as in at least confirm issue and do some profiling to see where is the bottleneck in my case, but my HW is like pentium 386 compared to yours :)
Author

No problem, here's a link to the files: https://cloud.mantissa.xyz/index.php/s/PmfJLaNHqzewPwr (1.7GB)
If you want the tree scene as well, I'll have to share it directly, as it has assets I can't link publicly.

You can just turn each collection on and off to test the different textures.

No problem, here's a link to the files: https://cloud.mantissa.xyz/index.php/s/PmfJLaNHqzewPwr (1.7GB) If you want the tree scene as well, I'll have to share it directly, as it has assets I can't link publicly. You can just turn each collection on and off to test the different textures.

Added subscriber: @ChristophWerner

Added subscriber: @ChristophWerner

Added subscriber: @zaster

Added subscriber: @zaster

I tested the monkey file on the latest master. WIN 10, Ryzen 3900X and files loaded from SATA-SSD I get the order:

Slowest render is Jpeg, next is EXR, then next is virtually a tie between png and tga and the fastest is the tiff. Mem usage reports 581Mb on every render aprat from .EXR which states 1157MB.

I tested the monkey file on the latest master. WIN 10, Ryzen 3900X and files loaded from SATA-SSD I get the order: Slowest render is Jpeg, next is EXR, then next is virtually a tie between png and tga and the fastest is the tiff. Mem usage reports 581Mb on every render aprat from .EXR which states 1157MB.

Not sure what to make out of this:
I find it logical that heavily compressed jpgs take longer on initialisation and best practise would be to avoid them anyway for final textures.
However, the order of speed from the tree file contradicts the order from the monkey in most regards- maybe because of transparency?

Not sure what to make out of this: I find it logical that heavily compressed jpgs take longer on initialisation and best practise would be to avoid them anyway for final textures. However, the order of speed from the tree file contradicts the order from the monkey in most regards- maybe because of transparency?
Author

It doesn't occur during rendering, only when loading all the assets before the actual rendering starts. When the render starts (ie. tiles start calculating), the speed of that part is the same. The trees are all geometry so there's no transparency being used in the materials.

In my case the tests are being run from NVMe SSDs so there's no bottlenecks in the storage to speak of. EXR is multitreaded by design so it's normal that it's fast. I can open 8K+ jpgs in an image editor in a matter of seconds and the tifs are uncompressed to avoid compression bottlenecks. The only format that could slow down a little are PNG's as they can be slow to load depending on compressed they are.

Even then the difference should be seconds, not minutes as seen in the tree example. It would be great to get more eyes on this to pin down the reason why this is happening exactly.

It doesn't occur during rendering, only when loading all the assets before the actual rendering starts. When the render starts (ie. tiles start calculating), the speed of that part is the same. The trees are all geometry so there's no transparency being used in the materials. In my case the tests are being run from NVMe SSDs so there's no bottlenecks in the storage to speak of. EXR is multitreaded by design so it's normal that it's fast. I can open 8K+ jpgs in an image editor in a matter of seconds and the tifs are uncompressed to avoid compression bottlenecks. The only format that could slow down a little are PNG's as they can be slow to load depending on compressed they are. Even then the difference should be seconds, not minutes as seen in the tree example. It would be great to get more eyes on this to pin down the reason why this is happening exactly.

Can you post your order on the monkey file with a recent build? Also can you send the tree file?

Can you post your order on the monkey file with a recent build? Also can you send the tree file?
Member

Added subscriber: @EAW

Added subscriber: @EAW
Member

Nicely laid out demo file!

NOTE: The EXR files aren't EXR files, they are PNGs with LZ77 compression and an incorrect file extension. This can be seen on Windows using MediaInfo and IrfranView.

Just some thoughts without doing any profiling:
JPEGs need to go through several decoding conversions before being displayed. Link to the encoding section on Wikipedia. JPEGs are encoded as YCbCr, which has to be transformed to a RGB color space. According to the section What is taking so long? in D8126: Speed up saving when rendering movies / Profiling walk-though, we can see at least one color operation in Blender is done one pixel at a time, perhaps others are as well.
From OIIO's JPEG documentation under Limitations:

OpenImageIO’s JPEG/JFIF reader and writer always operate in scanline mode and do not support tiled image input or output.

From OIIO's Targa documentation under Limitations

The Targa reader reserves enough memory for the entire image. Therefore it is not a good choice for high-performance image use such as would be used for ImageCache or TextureSystem.

—-

I’ll do some profiling and see what I can find.

Nicely laid out demo file! NOTE: The EXR files aren't EXR files, they are PNGs with LZ77 compression and an incorrect file extension. This can be seen on Windows using MediaInfo and IrfranView. Just some thoughts without doing any profiling: JPEGs need to go through several decoding conversions before being displayed. [Link to the encoding section on Wikipedia.](https://en.wikipedia.org/wiki/JPEG#Encoding) JPEGs are encoded as YCbCr, which has to be transformed to a RGB color space. According to the section **What is taking so long?** in [D8126: Speed up saving when rendering movies / Profiling walk-though](https://archive.blender.org/developer/D8126), we can see at least one color operation in Blender is done one pixel at a time, perhaps others are as well. From [OIIO's JPEG documentation](https://openimageio.readthedocs.io/en/latest/builtinplugins.html#jpeg) under **Limitations**: >OpenImageIO’s JPEG/JFIF reader and writer always operate in scanline mode and do not support tiled image input or output. From [OIIO's Targa documentation](https://openimageio.readthedocs.io/en/latest/builtinplugins.html#targa) under **Limitations** >The Targa reader reserves enough memory for the entire image. Therefore it is not a good choice for high-performance image use such as would be used for ImageCache or TextureSystem. —- I’ll do some profiling and see what I can find.

Added subscriber: @steven850

Added subscriber: @steven850

This is normal and expected behavior with the various compressions that are used. If your doing more then a single render, go to the performance section and enable persistent images. This keeps the textures in memory instead of reloading them for each render/frame. so the first render will take 10s, but the subsequent frames will take 1s. You will see in increase in speed with all image formats, since they dont need to be loaded again, but the greatest difference will obviously be with JPGs. Persistent images is a must for animations, especially when using lots of textures, or high res.

This is normal and expected behavior with the various compressions that are used. If your doing more then a single render, go to the performance section and enable persistent images. This keeps the textures in memory instead of reloading them for each render/frame. so the first render will take 10s, but the subsequent frames will take 1s. You will see in increase in speed with all image formats, since they dont need to be loaded again, but the greatest difference will obviously be with JPGs. Persistent images is a must for animations, especially when using lots of textures, or high res.
Member

Added subscriber: @ankitm

Added subscriber: @ankitm
Member

In #79836#999738, @Mantissa wrote:
No problem, here's a link to the files: https://cloud.mantissa.xyz/index.php/s/PmfJLaNHqzewPwr (1.7GB)
If you want the tree scene as well, I'll have to share it directly, as it has assets I can't link publicly.

The link has expired

> In #79836#999738, @Mantissa wrote: > No problem, here's a link to the files: https://cloud.mantissa.xyz/index.php/s/PmfJLaNHqzewPwr (1.7GB) > If you want the tree scene as well, I'll have to share it directly, as it has assets I can't link publicly. The link has expired
Member

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

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

Added subscriber: @mano-wii

Added subscriber: @mano-wii

This seems to be a duplicate of #78033 (Disproportional Render Time approaching 16k Environment Textures on CUDA Device)

This seems to be a duplicate of #78033 (Disproportional Render Time approaching 16k Environment Textures on CUDA Device)
Member

Added subscriber: @lichtwerk

Added subscriber: @lichtwerk
Member

@Mantissa : can you put up that example file again somewhere?

@Mantissa : can you put up that example file again somewhere?
Member

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

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

No activity for more than a week. As per the tracker policy we assume the issue is gone and can be closed.

Thanks again for the report. If the problem persists please open a new report with the required information.

No activity for more than a week. As per the tracker policy we assume the issue is gone and can be closed. Thanks again for the report. If the problem persists please open a new report with the required information.
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
10 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#79836
No description provided.