.rat vs .exr in Karma

   3974   10   4
User Avatar
Member
53 posts
Joined: March 2014
Offline
Is there an advantage of using .rat textures instead tiled and mipmapped .exr in Karma?
Thanks
F
Edited by flord - May 10, 2022 10:39:38
User Avatar
Staff
2593 posts
Joined: July 2005
Offline
There shouldn't be that much of a difference. .rat format supports different bit depths (8 bit integer, 32 bit float), while .exr is typically 16 bit float. Karma uses OpenImageIO for .exr textures, so it might be easier to troubleshoot texture issues. Performance wise, there shouldn't be that much of a difference.
User Avatar
Member
7801 posts
Joined: Sept. 2011
Offline
mark
There shouldn't be that much of a difference. .rat format supports different bit depths (8 bit integer, 32 bit float), while .exr is typically 16 bit float. Karma uses OpenImageIO for .exr textures, so it might be easier to troubleshoot texture issues. Performance wise, there shouldn't be that much of a difference.

There is a quality difference though since mipmapped exrs use the oiio library for texture filtering. I've found the filter width to be about 2x too wide with oiio textures, either that or it's picking the wrong mip levels for the filter. Performance was about the same.
User Avatar
Member
82 posts
Joined: June 2020
Offline
jsmack
There is a quality difference though since mipmapped exrs use the oiio library for texture filtering. I've found the filter width to be about 2x too wide with oiio textures, either that or it's picking the wrong mip levels for the filter. Performance was about the same.

I'm noticing this too.

I ran all my textures through imaketx to .rat and .exr and did a render with each. Memory usage and performance seemed basically identical but the .exrs were very blurry in comparison to the .rats. Increasing the shading quality multipler in the render settings helped out but I didn't expect there to be such a large difference in baseline quality.


Edit: The Mtlx Image node doesn't have a way to adjust the filter width but I've found that switching the filter type from 'linear' to 'closest' seems to correct the blurry .exr textures.
Edited by freshbaked - Sept. 4, 2022 13:14:22
User Avatar
Member
53 posts
Joined: March 2014
Offline
Perhaps I'm not doing the right test, but in 19.5 I'm not seeing a big difference between tiled EXR and tiled RAT. In fact, the very subtle differences I see look like sampling artifacts with the RAT texture.
Tiled RAT:

Tiled EXR:


And I see no difference at all when rendering in XPU.
Tiled RAT

Tiled EXR


This is with the mtlximage and mtlxstandard_surface nodes.

I converted my exr to tiled exr with oiiotool with the default settings.
Edited by flord - Sept. 6, 2022 09:18:16

Attachments:
Tiled_RAT.jpg (383.4 KB)
Tiled_EXR.jpg (381.0 KB)
Tiled_RAT_XPU.jpg (349.3 KB)
Tiled_EXR_XPU.jpg (349.2 KB)

User Avatar
Member
82 posts
Joined: June 2020
Offline
I tried to recreate what I was seeing in a simple scene like you have there but initially couldn't reproduce it. However, after moving the camera farther and farther away I managed to make it happen. It might be hard to see but if you load the images into Nuke to quickly switch between them the difference should be apparent.

Not really sure what to make of it, it's like the .exr is using the wrong mip level or a different filtering was used when it was generated. I honestly have no idea.

the commands I used were:

imaketx -v -m ocio --format RAT UV_GRID_01.jpg UV_GRID_01.rat

imaketx -v -m ocio --format OpenEXR UV_GRID_01.jpg UV_GRID_01.exr

Attachments:
exr.jpeg (156.1 KB)
rat.jpeg (161.6 KB)

User Avatar
Member
82 posts
Joined: June 2020
Offline
So, after some testing. Turns out switching the filtering type to 'closest' on the MtlxImage node just uses the highest mip level no matter what. So it was 'fixing' the blurry textures, but not really.

Attachments:
mip_levels_linear_filter.png (7.5 MB)
mip_levels_closest_filter.png (7.6 MB)

User Avatar
Member
7801 posts
Joined: Sept. 2011
Offline
freshbaked
So, after some testing. Turns out switching the filtering type to 'closest' on the MtlxImage node just uses the highest mip level no matter what. So it was 'fixing' the blurry textures, but not really.

would be cool if we had GL style args like GL_LINEAR_MIPMAP_LINEAR, GL_CLOSEST_MIPMAP_LINEAR, etc

You probably don't want to closest as a workaround as it will alias on minification and look pixelated on magnification.

I think OIIO texture sampling just picks mipmaps wrong, rat sampling can be wrong too but it's usually erring on the side of too high of a mip level.

Anyone know if karma supports anisotropic filtering?
User Avatar
Member
75 posts
Joined: Dec. 2017
Offline
jsmack
freshbaked
So, after some testing. Turns out switching the filtering type to 'closest' on the MtlxImage node just uses the highest mip level no matter what. So it was 'fixing' the blurry textures, but not really.

would be cool if we had GL style args like GL_LINEAR_MIPMAP_LINEAR, GL_CLOSEST_MIPMAP_LINEAR, etc

You probably don't want to closest as a workaround as it will alias on minification and look pixelated on magnification.

I think OIIO texture sampling just picks mipmaps wrong, rat sampling can be wrong too but it's usually erring on the side of too high of a mip level.

Anyone know if karma supports anisotropic filtering?

Checking this thread

https://www.sidefx.com/forum/topic/81939/ [www.sidefx.com]

The developers says "XPU will have anisotropic filtering in H19.5"
User Avatar
Staff
2593 posts
Joined: July 2005
Offline
The big difference between .exr and .rat textures is that the texture evaluation engine is different.
For .rat textures, we use the Houdini texture evaluation library. This does filtering one way.
For .exr textures, we use Open Image IO, which does texture filtering using a different way.
Since the two libraries use different algorithms for filtering, I don't think you'll ever get a 100% match between .rat and .exr files.

By default, we're using the "smart bicubic" filter for .exr files in OIIO.

You might get closer results by using "bicubic" filtering for both .exr and .rat files (as described in the filtermodekeyword argument in the texture documentation: https://www.sidefx.com/docs/houdini/vex/functions/texture.html [www.sidefx.com] )
User Avatar
Member
82 posts
Joined: June 2020
Offline
I could live with a small difference but the scene I am working on has a very noticable decrease in quality when using mipped exrs.

I think I found the cause. Here's a sphere rendered in Karma CPU with and without subdivision with a debug mipmap exr applied.

Without subdivision it's generally what I expect, you can see the separate mip levels.
With subdivision, it looks like several mip levels are blended on top of each other and as a result appears blurry.

I'm not smart enough to know if this is expected due to the difference between Houdini/OIIO filtering algorithms or if it's bug or what.

I don't know how to make the same debug texture in .rat format so I can't compare.
Edited by freshbaked - Sept. 9, 2022 13:33:21

Attachments:
mipmap_debug_exr_nosubdiv.jpeg (1.2 MB)
mipmap_debug_exr_subdiv.jpeg (1.4 MB)

  • Quick Links