[Bf-blender-cvs] [de75be1eaaf] cycles_texture_cache: Merge branch 'master' into cycles_texture_cache

Stefan Werner noreply at git.blender.org
Thu Jan 16 15:21:44 CET 2020


Commit: de75be1eaaf73959407ff1968484ba873bcc3ffd
Author: Stefan Werner
Date:   Thu Jan 16 15:16:24 2020 +0100
Branches: cycles_texture_cache
https://developer.blender.org/rBde75be1eaaf73959407ff1968484ba873bcc3ffd

Merge branch 'master' into cycles_texture_cache

===================================================================



===================================================================

diff --cc intern/cycles/blender/addon/properties.py
index a7aabf3ddbb,5f163c2510b..c94a7d66de4
--- a/intern/cycles/blender/addon/properties.py
+++ b/intern/cycles/blender/addon/properties.py
@@@ -705,81 -717,12 +717,87 @@@ class CyclesRenderSettings(bpy.types.Pr
          items=enum_texture_limit
      )
  
 +    use_texture_cache: BoolProperty(
 +        name="Use Texture Cache",
 +        default=False,
 +        description="Enables out-of-core texturing to conserve RAM"
 +    )
 +
 +    texture_cache_size: IntProperty(
 +        name="Texture Cache Size (MB)",
 +        default=1024,
 +        description="The size of the OpenImageIO texture cache in MB",
 +        min=0
 +    )
 +
 +    texture_auto_convert: BoolProperty(
 +        name="Auto Convert Textures",
 +        default=True,
 +        description="Automatically convert textures to .tx files for optimal texture cache performance"
 +    )
 +
 +    texture_accept_unmipped: BoolProperty(
 +        name="Accept Unmipped",
 +        default=True,
 +        description="Texture cached rendering without mip mapping is very expensive. Uncheck to prevent Cycles from using textures that are not mip mapped"
 +    )
 +
 +    texture_accept_untiled: BoolProperty(
 +        name="Accept Untiled",
 +        default=True,
 +        description="Texture cached rendering without tiled textures is very expensive. Uncheck to prevent Cycles from using textures that are not tiled"
 +    )
 +
 +    texture_auto_tile: BoolProperty(
 +        name="Auto Tile",
 +        default=True,
 +        description="On the fly creation of tiled versions of textures that are not tiled. This can increase render time but helps reduce memory usage"
 +    )
 +
 +    texture_auto_mip: BoolProperty(
 +        name="Auto Mip",
 +        default=True,
 +        description="On the fly creation of mip maps of textures that are not mip mapped. This can increase render time but helps reduce memory usage"
 +    )
 +
 +    texture_tile_size: IntProperty(
 +        name="Tile Size",
 +        default=64,
 +        description="The size of tiles that Cycles uses for auto tiling"
 +    )
 +
 +    texture_blur_diffuse: FloatProperty(
 +        name="Diffuse Blur",
 +        default=0.0156,
 +        description="The amount of texture blur applied to diffuse bounces",
 +        min = 0.0, max = 1.0
 +    )
 +
 +    texture_blur_glossy: FloatProperty(
 +        name="Glossy Blur",
 +        default=0.0,
 +        description="The amount of texture blur applied to glossy bounces",
 +        min = 0.0, max = 1.0
 +    )
 +
 +    use_custom_cache_path: BoolProperty(
 +        name="Use Custom Cache Path",
 +        default=False,
 +        description="Use a custom path for the texture cache, as oppoosed to placing cache files next to the original file"
 +    )
 +
 +    custom_cache_path: StringProperty(
 +        name="Custom Cache Path",
 +        default="",
 +        subtype="DIR_PATH",
 +        description="Custom path for the texture cache"
 +    )
+     ao_bounces: IntProperty(
+         name="AO Bounces",
+         default=0,
+         description="Approximate indirect light with background tinted ambient occlusion at the specified bounce, 0 disables this feature",
+         min=0, max=1024,
+     )
  
      ao_bounces_render: IntProperty(
          name="AO Bounces Render",
diff --cc intern/cycles/blender/blender_sync.cpp
index 8a191db628b,20dbe23cdb7..eabed4a89c6
--- a/intern/cycles/blender/blender_sync.cpp
+++ b/intern/cycles/blender/blender_sync.cpp
@@@ -714,27 -736,7 +735,28 @@@ SceneParams BlenderSync::get_scene_para
                                                                     params.bvh_layout;
  #endif
  
 +  params.texture.use_cache = RNA_boolean_get(&cscene, "use_texture_cache");
 +  params.texture.cache_size = RNA_int_get(&cscene, "texture_cache_size");
 +  params.texture.auto_convert = RNA_boolean_get(&cscene, "texture_auto_convert");
 +  params.texture.accept_unmipped = RNA_boolean_get(&cscene, "texture_accept_unmipped");
 +  params.texture.accept_untiled = RNA_boolean_get(&cscene, "texture_accept_untiled");
 +  params.texture.tile_size = RNA_int_get(&cscene, "texture_tile_size");
 +  params.texture.auto_mip = RNA_boolean_get(&cscene, "texture_auto_mip");
 +  params.texture.auto_tile = RNA_boolean_get(&cscene, "texture_auto_tile");
 +  params.texture.diffuse_blur = RNA_float_get(&cscene, "texture_blur_diffuse");
 +  params.texture.glossy_blur = RNA_float_get(&cscene, "texture_blur_glossy");
 +  params.texture.use_custom_cache_path = RNA_boolean_get(&cscene, "use_custom_cache_path");
 +  if (params.texture.use_custom_cache_path) {
 +    char *path = RNA_string_get_alloc(&cscene, "custom_cache_path", NULL, 0);
 +    if (path) {
 +      params.texture.custom_cache_path = path;
 +      MEM_freeN(path);
 +    }
 +  }
 +  else {
 +    params.texture.custom_cache_path.clear();
 +  }
+   params.background = background;
  
    return params;
  }
diff --cc intern/cycles/kernel/kernel_path.h
index c9cea20bef4,1a0b67275a7..e746647ecbb
--- a/intern/cycles/kernel/kernel_path.h
+++ b/intern/cycles/kernel/kernel_path.h
@@@ -27,9 -27,10 +27,10 @@@
  #include "kernel/geom/geom.h"
  #include "kernel/bvh/bvh.h"
  
+ #include "kernel/kernel_write_passes.h"
  #include "kernel/kernel_accumulate.h"
 -#include "kernel/kernel_shader.h"
  #include "kernel/kernel_light.h"
 +#include "kernel/kernel_shader.h"
  #include "kernel/kernel_passes.h"
  
  #if defined(__VOLUME__) || defined(__SUBSURFACE__)
@@@ -363,17 -362,11 +362,17 @@@ ccl_device_noinlin
      light_ray.D = ao_D;
      light_ray.t = kernel_data.background.ao_distance;
      light_ray.time = sd->time;
 +#ifdef __RAY_DIFFERENTIALS__
      light_ray.dP = sd->dP;
 -    light_ray.dD = differential3_zero();
 +    /* This is how pbrt v3 implements differentials for diffuse bounces */
 +    float3 a, b;
 +    make_orthonormals(ao_D, &a, &b);
 +    light_ray.dD.dx = normalize(ao_D + 0.1f * a);
 +    light_ray.dD.dy = normalize(ao_D + 0.1f * b);
 +#endif /* __RAY_DIFFERENTIALS__ */
  
      if (!shadow_blocked(kg, sd, emission_sd, state, &light_ray, &ao_shadow)) {
-       path_radiance_accum_ao(L, state, throughput, ao_alpha, ao_bsdf, ao_shadow);
+       path_radiance_accum_ao(kg, L, state, throughput, ao_alpha, ao_bsdf, ao_shadow);
      }
      else {
        path_radiance_accum_total_ao(L, state, throughput, ao_bsdf);
diff --cc intern/cycles/kernel/svm/svm.h
index aeff69e1148,fd2833ee687..3674b57b59e
--- a/intern/cycles/kernel/svm/svm.h
+++ b/intern/cycles/kernel/svm/svm.h
@@@ -312,10 -311,10 +311,10 @@@ ccl_device_noinline void svm_eval_nodes
  #  endif /* NODES_FEATURE(NODE_FEATURE_BUMP) */
  #  ifdef __TEXTURES__
        case NODE_TEX_IMAGE:
-         svm_node_tex_image(kg, sd, path_flag, stack, node);
 -        svm_node_tex_image(kg, sd, stack, node, &offset);
++        svm_node_tex_image(kg, sd, path_flag, stack, node, &offset);
          break;
        case NODE_TEX_IMAGE_BOX:
 -        svm_node_tex_image_box(kg, sd, stack, node);
 +        svm_node_tex_image_box(kg, sd, path_flag, stack, node);
          break;
        case NODE_TEX_NOISE:
          svm_node_tex_noise(kg, sd, stack, node.y, node.z, node.w, &offset);
diff --cc intern/cycles/kernel/svm/svm_image.h
index 06e511a5bcf,90f1a7845c7..155c2ee5252
--- a/intern/cycles/kernel/svm/svm_image.h
+++ b/intern/cycles/kernel/svm/svm_image.h
@@@ -25,68 -17,15 +25,73 @@@
  CCL_NAMESPACE_BEGIN
  
  #ifdef __TEXTURES__
 -
 -ccl_device float4 svm_image_texture(KernelGlobals *kg, int id, float x, float y, uint flags)
 +ccl_device float4 svm_image_texture(KernelGlobals *kg,
 +                                    int id,
 +                                    float x,
 +                                    float y,
 +                                    differential ds,
 +                                    differential dt,
 +                                    uint flags,
 +                                    int path_flag)
  {
+   if (id == -1) {
+     return make_float4(
+         TEX_IMAGE_MISSING_R, TEX_IMAGE_MISSING_G, TEX_IMAGE_MISSING_B, TEX_IMAGE_MISSING_A);
+   }
+ 
 -  float4 r = kernel_tex_image_interp(kg, id, x, y);
 +  float4 r;
 +#ifdef __OIIO__
 +  if (kg->oiio && kg->oiio->textures.size() > id && kg->oiio->textures[id].handle) {
 +    OIIO::TextureOpt options;
 +    options.swrap = options.twrap = kg->oiio->textures[id].extension;
 +    options.anisotropic = 8;
 +    float missingcolor[4] = {
 +        TEX_IMAGE_MISSING_R, TEX_IMAGE_MISSING_G, TEX_IMAGE_MISSING_B, TEX_IMAGE_MISSING_A};
 +    options.missingcolor = missingcolor;
 +
 +    if (path_flag & NEAREST_LOOKUP_PATHS && !(path_flag & PATH_RAY_SINGULAR)) {
 +      options.interpmode = OIIO::TextureOpt::InterpClosest;
 +      options.mipmode = OIIO::TextureOpt::MipModeOneLevel;
 +    }
 +    else {
 +      options.interpmode = kg->oiio->textures[id].interpolation;
 +      options.mipmode = OIIO::TextureOpt::MipModeAniso;
 +    }
 +
 +    if (path_flag & DIFFUSE_BLUR_PATHS) {
 +      options.sblur = options.tblur = kg->oiio->diffuse_blur;
 +    }
 +    else if (path_flag & PATH_RAY_GLOSSY) {
 +      options.sblur = options.tblur = kg->oiio->glossy_blur;
 +    }
 +    else {
 +      options.sblur = options.tblur = 0.0f;
 +    }
 +
 +    bool success = kg->oiio->tex_sys->texture(kg->oiio->textures[id].handle,
 +                                              (OIIO::TextureSystem::Perthread *)kg->oiio_tdata,
 +                                              options,
 +                                              x,
 +                                              y,
 +                                              ds.dx,
 +                                              ds.dy,
 +                                              dt.dx,
 +                                              dt.dy,
 +                                              4,
 +                                              (float *)&r);
 +    if (!success) {
 +      (void)kg->oiio->tex_sys->geterror();
 +    }
 +    else {
 +      /* Mip maps are always linear. */
 +      if (kg->oiio->textures[id].is_linear) {
 +        flags &= ~NODE_IMAGE_COMPRESS_AS_SRGB;
 +      }
 +    }
 +  }
 +  else
 +#endif
-     r = kernel_tex

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list