Tiled texture storage and sampling in Cycles kernel
Open, NormalPublic

Description

This task concerns the implementation of a compression technique for large sparse datasets (e.g. Volumes). This is done by subdividing the dataset into smaller grids, and discarding the ones that do not hold any meaningful data.

This task is part 1 of my GSoC 2018 project.

To-dos

  • Make this compatible with the Mesh Volume speedup. Because of they are currently mutually exclusive, using this implemntation will actually slow down rendering.
  • Modify sparse tiles to support generic types (currently only supports float4, should be fine as long they have a > operator overloaded).
  • Add support for all Volume attributes (currently only supports color).
  • Change detection method for calling sparse grid creation (currently, a new ImageDataType was created, but will probably change this to a bool member of Image).
  • Add support for CUDA and OpenCL.
  • Implement lookup for tricubic interpolation (currently just throws an assert if a compressed texture tries to call it).
  • Remove the SparseTile struct altogether and just treat tiles abstractly.
  • Create a wrapper class for device_memory's of SparseTiles?
  • Support 2D tiling and sampling?
  • Make threshold value a user-inputted value?
Geraldine Chua (gschua) triaged this task as Normal priority.

With threshold set to 0.0f (unfortunately hard-coded right now), memory usage of the color texture in this example is reduced by ~33%. If set to 0.2f, memory usage is reduced by ~66%, with no significant visual loss.

I have attached photos of the green smoke with no tiling, with 0 threshold, and with 0.2 threshold. You can also download the .blend file to try.

If you notice the rendering speeds, the non-tiling one rendered much faster. This is most likely because the sparse grid is no longer treated as a mesh volume, and hopefully does not have anything to do with this task. I will see if it is possible to make these two functions compatible.


No tiling:

0.0 threshold:

0.2 threshold: