Page MenuHome

Blender Internal: render preview with Freestyle + full-sample AA generates many unneeded .exr files
Closed, ResolvedPublic

Description

System Information
Ubuntu 18.10

Blender Version
Broken: 2.79b or earlier

Short description of error
When using Freestyle and full-sample AA, render preview in 3D viewport spends a very long time and wastes disk space for generating many .exr files not to be used each time the viewport is redrawn.

Example of console output:

write exr tmp file, 1665x883, /tmp/blender_D3e5mT/Freestyle_fullsampleAA.blend_FRS1_Scene_RenderLayer.exr
write exr tmp file, 1665x883, /tmp/blender_D3e5mT/Freestyle_fullsampleAA.blend_FRS1_Scene_RenderLayer1.exr
write exr tmp file, 1665x883, /tmp/blender_D3e5mT/Freestyle_fullsampleAA.blend_FRS1_Scene_RenderLayer2.exr
write exr tmp file, 1665x883, /tmp/blender_D3e5mT/Freestyle_fullsampleAA.blend_FRS1_Scene_RenderLayer3.exr
write exr tmp file, 1665x883, /tmp/blender_D3e5mT/Freestyle_fullsampleAA.blend_FRS1_Scene_RenderLayer4.exr
write exr tmp file, 1665x883, /tmp/blender_D3e5mT/Freestyle_fullsampleAA.blend_FRS1_Scene_RenderLayer5.exr
write exr tmp file, 1665x883, /tmp/blender_D3e5mT/Freestyle_fullsampleAA.blend_FRS1_Scene_RenderLayer6.exr
write exr tmp file, 1665x883, /tmp/blender_D3e5mT/Freestyle_fullsampleAA.blend_FRS1_Scene_RenderLayer7.exr
write exr tmp file, 1665x883, /tmp/blender_D3e5mT/Freestyle_fullsampleAA.blend_FRS1_Scene_RenderLayer8.exr
write exr tmp file, 1665x883, /tmp/blender_D3e5mT/Freestyle_fullsampleAA.blend_FRS1_Scene_RenderLayer9.exr
write exr tmp file, 1665x883, /tmp/blender_D3e5mT/Freestyle_fullsampleAA.blend_FRS1_Scene_RenderLayer10.exr
write exr tmp file, 1665x883, /tmp/blender_D3e5mT/Freestyle_fullsampleAA.blend_FRS1_Scene_RenderLayer11.exr
write exr tmp file, 1665x883, /tmp/blender_D3e5mT/Freestyle_fullsampleAA.blend_FRS1_Scene_RenderLayer12.exr
write exr tmp file, 1665x883, /tmp/blender_D3e5mT/Freestyle_fullsampleAA.blend_FRS1_Scene_RenderLayer13.exr
write exr tmp file, 1665x883, /tmp/blender_D3e5mT/Freestyle_fullsampleAA.blend_FRS1_Scene_RenderLayer14.exr
write exr tmp file, 1665x883, /tmp/blender_D3e5mT/Freestyle_fullsampleAA.blend_FRS1_Scene_RenderLayer15.exr
read exr tmp file: /tmp/blender_D3e5mT/Freestyle_fullsampleAA.blend_FRS1_Scene_RenderLayer.exr

In this case, only "Freestyle_fullsampleAA.blend_FRS1_Scene_RenderLayer.exr" is used for rendering later but the remaining files are never used.

Exact steps for others to reproduce the error

  1. Start Blender from command line
  2. Open attached .blend file
  3. Set the display method "Render" (shift+z)
  4. Move/rotate/zoom the view to redraw

Cause and possible solution
I found that 'R_FULL_SAMPLE' flag not inherited from BI render to FRS render causes the problem.
The following patch seems to resolve the issue:

diff --git a/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp b/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp
index 9c3ff8999b7..94a70761dc2 100644
--- a/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp
+++ b/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp
@@ -96,7 +96,8 @@ BlenderStrokeRenderer::BlenderStrokeRenderer(Render *re, int render_count) : Str
        //freestyle_scene->r.maximsize = old_scene->r.maximsize; /* DEPRECATED */
        freestyle_scene->r.ocres = old_scene->r.ocres;
        freestyle_scene->r.color_mgt_flag = 0; // old_scene->r.color_mgt_flag;
-       freestyle_scene->r.scemode = old_scene->r.scemode & ~(R_SINGLE_LAYER | R_NO_FRAME_UPDATE | R_MULTIVIEW);
+       freestyle_scene->r.scemode = old_scene->r.scemode & ~(R_SINGLE_LAYER | R_NO_FRAME_UPDATE | R_MULTIVIEW) &
+                                    (re->r.scemode | ~R_FULL_SAMPLE);
        freestyle_scene->r.flag = old_scene->r.flag;
        freestyle_scene->r.threads = old_scene->r.threads;
        freestyle_scene->r.border.xmin = old_scene->r.border.xmin;