Jump to content
Juraj

Mantra auto check and replace if RAT texture exists

Recommended Posts

Hello,
Mantra during rendering is always converting all non-rat textures into rat and then discarding them after the render is finished. So I am considering batch-converting all of them to rat using the iconvert tool while keeping their original name and replacing only file extension. Batch conversion of textures is not a problem, but I am curious about re-linking them in shader networks.

Arnold has an elegant solution for that - it checks if there is a .tx version of a texture and if so, it will use it and save some time. It also allows to do one-time conversion during the first use of a texture and then it will keep .tx version around inside the texture folder.
So I am humbly hoping that there is somewhere hidden feature for this behavior also in Mantra. Any experience with that?

Otherwise I can just scan all shading nodes in Houdini with python and replace texture file extensions for rat.

 

Thanks,
Juraj

  • Like 1

Share this post


Link to post
Share on other sites

Mantra, right now, has no feature like that one in Arnold... shame. as for replacing all the textures, the best is to make a setup that allows for easy replacement anytime, of course :) 

anyway, try 'opchange' in texport. it works like a search > replace for any strings in the scene so I suppose if you type something like...

opchange -T SHOP exr rat

...you should get "rat" wherever was "exr" before. -T SHOP tells it to look at the shop networks only,

check the docs for more info.

 

cheers.

  • Like 1

Share this post


Link to post
Share on other sites

Hi, thanks for great tips :)
I will think about the converter, but to make it easy to use for artists I guess it will be a shelf tool where you will select a folder and the tool with scan all textures and convert them.

I will check this opchange hscript command, seems to be good and easy choice for this task :)

Share this post


Link to post
Share on other sites

A Python script could make quick work of this problem looking at every parameter in the scene, calling iconvert (comes with Houdini) on the images, and change the path to the new image.

Share this post


Link to post
Share on other sites
Guest tar

It's worth running tests to see if the conversion to Rat is slowing anything down. Last time I checked EXR was just as fast.

Share this post


Link to post
Share on other sites
13 minutes ago, marty said:

It's worth running tests to see if the conversion to Rat is slowing anything down. Last time I checked EXR was just as fast.

yes. not using rats slows down everything and it eats much more memory. with a few textures you may not even notice the difference but at some point your renders will become very slow and very memory hungry. I'm talking about differences like 4h/90gb ram/frame with exrs vs. 1h/40gb ram/frame with rats. These are made up numbers but I've seen this on some texture heavy projects.

Edited by davpe

Share this post


Link to post
Share on other sites

yes. it converts the files and holds it in the memory while rendering. so not only converting alone for every frame can take quite a long time but also it can easily fill up your ram and then actual rendering runs on swap.

Share this post


Link to post
Share on other sites
Guest tar

that sounds like a bug then, it should convert to a rat, write that as a temp file then use that to continue rendering. There is no reason to hold the original in ram.

Share this post


Link to post
Share on other sites

exactly. and it would make even more sense not having to do it for every frame.

Share this post


Link to post
Share on other sites
Guest tar

this env variable is pretty useful then:

MANTRA_NONRAT_ERROR

Quote

 

    Normally, mantra will automatically convert texture files that are not

    in .rat format to .rat format internally - which can slow down render

    startup.  To disable automatic conversion to .rat format and instead

    print out an error when textures are not in the native format, set this

    variable.

 

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×