pipeline automation: packed texture maps as linear not sRGB

By default packed texture maps (for example red: AO, green: roughness, blue: metal) are imported in with sRGB on, which is incorrect as this is non-color data and should be linear.

I’m aware this can of course be manually changed, including in bulk with the asset actions > bulk edit via property matrix. However, I’m looking for a way to set it up so these textures would be recognized automatically and be set to linear, either based on naming convention or file type (EXR should always be linear).

Is there a way to do this in the project settings perhaps? Or a blueprint or Python script that can change how these textures are imported into the engine?

In project settings you can type in “import” in the search bar, there you have the pipeline stack => see textures => DefaultTexturePipeline.

You can copy that pipeline or modify it. There you can change some settings.
I guess if you want really granular control then maybe try extending
D:\Programy\Unreal Engine\UE_5.1\Engine\Plugins\Interchange\Runtime\Source\Pipelines\Public\InterchangeGenericTexturePipeline.h so that it has extra options.

Only accessible options would be

virtual void AdjustSettingsForContext(EInterchangePipelineContext ImportType, TObjectPtr<UObject> ReimportAsset) override;
	virtual void ExecutePreImportPipeline(UInterchangeBaseNodeContainer* InBaseNodeContainer, const TArray<UInterchangeSourceData*>& InSourceDatas) override;
	virtual void ExecutePostImportPipeline(const UInterchangeBaseNodeContainer* InBaseNodeContainer, const FString& NodeKey, UObject* CreatedAsset, bool bIsAReimport) override;

Thanks for this. We are still in UE5.0 as 5.1 has some bugs (panoramic rendering is broken).

Would this be possible to do in UE5.0? I’m thinking really all I’d need to do is figure where it sets the imported textures to sRGB, and change that to false:

Texture->SRGB = false;

If we used EXR for texture maps, that could work as EXRs are always linear.

I’m pretty unfamiliar with C++ so I’m unsure if this would be the proper way to do this and where it should be done for texture imports in UE5.0.

I tried to extend the interchangeable texture pipeline class and it was able to register the import. Even after casting the asset to a texture2d (which works) it seems to crash when turning off sRGB on the texture (engine hard crashes with a bit error).

Interchangeability is just out of the experimental phase perhaps it still has a bug in it.

Gosh that’s a bummer. Is there another way to set the default behavior for texture files?

I noticed that when the texture compression settings are set to “Masks(no sRGB)" this automatically turns off the sRGB toggle. Don’t know if that’s relevant to the crash at all.

So I’m thinking if there was a way to have the texture compression settings change to “Masks” based on the texture file naming convention containing a suffix (like “myTexture_ORM.png” for example).

However, if the only way to do that would still be via the interchangeable texture pipeline, perhaps I’ll have to wait til they iron things out a bit more.

Hopefully by 5.2 it should be working well.

I’ve also tried from a blueprint standpoint .You can experiment yourself using the interchangeable pipeline classes (specifically the texture one) as a base / parent class implementing the post asset load function (don’t remember the exact name now but it’s in the override functions list). It should in theory work.

You grab the asset pin and cast it to texture2d (this works and retrieves the asset name) and the cast is even successful.
But it crashes on setRGB like the asset isn’t fully initialized :frowning:

Good to know. Thanks so much for all your help! I’m going to mark your first post as the solution.

BTW, I was able to solve the issue by coming at it from the other direction. The packed texture comes in as sRGB color, and then in the Material Editor for my Base Material I run each channel (for example green for roughness) through a sRGB to Linear node before plugging it into the roughness in the marerial. This reverses the unwanted sRGB conversion in the texture giving me raw linear values for each channel.