Volume rendering transfer function

Also, curious thing I don’t understand. If I volume import the disney cloud, specifically wdas_cloud_quarter.vdb, it gets added to the scene with a +90 rotation in X. While if I add my own vdb, generated through pyopenvdb, it does not get that rotation. The transformations in the metadata do not contain any rotation, only a scale. I can’t find definitions for most of the metadata fields, but do they cause the difference?

melis@juggle 20:29:~/courses/blender-course/webcontent/modules/advanced/volumes$ vdb_print -m /extra/data/wdas_cloud/wdas_cloud_quarter.vdb 
creator: Houdini/SOP_OpenVDB_Write
density      float (-261,-81,-358)->(236,256,254) 498x338x613  24.1MVox 9.41MB
   background: 0
   voxel size: 0.833
   index to world:
      [0.833, 0, 0, 0] 
      [0, 0.833, 0, 0] 
      [0, 0, 0.833, 0] 
      [0, 0, 0, 1] 
   class: fog volume
   creator: Houdini 16.0.504.20/GEO_VDBTranslator
   file_bbox_max: [236, 256, 254]
   file_bbox_min: [-261, -81, -358]
   file_compression: active values
   file_mem_bytes: 92494808
   file_voxel_count: 24063202
   is_local_space: false
   is_saved_as_half_float: false
   name: density
   value_type: float
   vector_type: invariant
   voxelsize: 0
melis@juggle 20:32:~/courses/blender-course/webcontent/modules/advanced/volumes$ vdb_print -m mummy.vdb 
value        float (0,0,3)->(127,127,127)       128x128x125   1.6MVox  779KB
   background: 0
   voxel size: 1
   index to world:
      [1, 0, 0, 0] 
      [0, 1, 0, 0] 
      [0, 0, 1, 0] 
      [0, 0, 0, 1] 
   file_bbox_max: [127, 127, 127]
   file_bbox_min: [0, 0, 3]
   file_compression: blosc + active values
   file_mem_bytes: 7633632
   file_voxel_count: 1600201
   name: value

Edit: ah, wasn’t expecting such a dirty trick :slight_smile:

bool BKE_volume_is_y_up(const Volume *volume)
{
  /* Simple heuristic for common files to open the right way up. */
#ifdef WITH_OPENVDB
  VolumeGridVector &grids = *volume->runtime.grids;
  if (grids.metadata) {
    openvdb::StringMetadata::ConstPtr creator =
        grids.metadata->getMetadata<openvdb::StringMetadata>("creator");
    if (!creator) {
      creator = grids.metadata->getMetadata<openvdb::StringMetadata>("Creator");
    }
    return (creator && creator->str().rfind("Houdini", 0) == 0);
  }
#else
  UNUSED_VARS(volume);
#endif

  return false;
}