Karma .rat texture auto-conversion on CPU / workflow

   1951   6   4
User Avatar
Member
49 posts
Joined: Feb. 2017
Offline
I'm a bit confused about how Karma handles the auto-conversion and usage of .rat files.

1) First of all, contrary to what the documentation says, conversion only seems to happen when using XPU - it does not do anything on CPU (https://www.sidefx.com/docs/houdini/solaris/kug/textures.html#autoconvert). I checked the log viewer as well. Is that intentional or a bug? Can I force it for CPU as well?

2) As the documentation states, using .rat files is beneficial for performance and memory reasons - which makes sense. However, when I create USD assets, I don't want to export USD assets with .rat files as texture inputs because that would make it very much not universal again and that's the point after all. So I would want to save usd assets with common file type textures and let Karma convert them when needed.
When I use Karma XPU to auto convert it will place the textures besides the original ones in the usd asset's texture folder. Will Karma CPU then use the .rat files automatically or are these only used by XPU and ignored?

3) Does Karma recognize when original textures have changed and re-convert the .rat files? (I know could check this but it just popped into my mind and since I'm at it it would be great to get a definitive answer on any corner cases)

4) What exactly is happening on the renderer side when textures are loaded? I presume that non-rat or non-tiled-exrs like jpgs or pngs are loaded fully into RAM and then used from there. I also presume that .rat files are not loaded into memory fully but only the tile/mip that is currently needed as determined by the renderer?

Thanks for any help on that
User Avatar
Member
153 posts
Joined: June 2020
Offline
1) You can use this environment variable: HOUDINI_TEXTURE_DISK_CACHE to enable for CPU.
Check the docs for the different options.

3) Seems so

4) That sounds right, I believe this needs to be enabled for XPU though using the KARMA_XPU_OPTIX_SPARSE_TEXTURES variable.
User Avatar
Member
49 posts
Joined: Feb. 2017
Offline
Thanks for the reply! That's quite helpful I will try that out. I read about the Disk_cache variable but since the docs said it does conversion by default now I just assumed it would override where it would go - not enable it for cpu as well.
User Avatar
Member
153 posts
Joined: June 2020
Offline
It might actually be enabled by default now, I don't really know, I enabled it with the variable some versions ago and just keep using the same config..
User Avatar
Member
49 posts
Joined: Feb. 2017
Offline
So, I tried it out. With the Environment variable set to "all" , Karma CPU will also do the conversion to .rat. It won't do it without the Environment variable.
Also of note, it seems that it will only convert and place the .rat files next to the original if the asset using those textures is already saved on disk. When I have an unsaved component builder it will not do a conversion (I also checked the log viewer to be sure), even with the Env variable set, both xpu and cpu.
Edited by racoonart - Aug. 14, 2024 12:12:12
User Avatar
Member
654 posts
Joined: Aug. 2014
Offline
freshbaked
racoonart
3) Does Karma recognize when original textures have changed and re-convert the .rat files? (I know could check this but it just popped into my mind and since I'm at it it would be great to get a definitive answer on any corner cases)
3) Seems so

Judging by my recent activity and file timestamps of images that I used while rendering stuff during an unspecified period, my guess is that Karma calculates hashes of input images before each render, and regenerates .ratfiles only when hashes of those files change.
User Avatar
Member
49 posts
Joined: Feb. 2017
Offline
Yes, that I would hope.. but you know, better to ask in case there's some logic behind it that may not have been noted anywhere
  • Quick Links