How to disable importing blue images as NormalMap?

Hello

My images in blue colors. And UE import it as NormallMap.
How to disable it?

I know about changing this texture setting AFTER import. But I dont need after. I need import without compression to NormapMap (because I import > 1000 textures)

Is anybody anwser on this f…ng forum about this f…ng engine?

Hi, I think you can achieve that by changing this in ProjectSettings to true:

Then when you will try to import textures ImportWindow should show up and you can disable there DetectNoramlMapTexture:

Hope this will work for you :slight_smile:

1 Like

There WAS option: “Detect Normal Maps Based on Texture Content” in editor preferences, but cannot find it anymore.

However since you importing 1000 textures, you should look into python script and bulk import them that way. I am sure there are some code snippets floating around, or you can ask chatGPT (hopefully it will not screw that simple code). :smiley:

1 Like

THANK YOU!!!
But I do it automatically. Using Python script. I import more than 1000 textures. I can not uncheck checkbox for each texture manually. How to do it in Python script - did not find. Trying to playing with “comporession_settins” but not working

This is what my rubber duck gave me:

import unreal

# Define the path to your textures
import_path = "/Game/MyTextures"

# Get all texture assets in the import path
assets = unreal.EditorAssetLibrary.list_assets(import_path)

# Iterate through the assets and update compression settings
for asset_path in assets:
    asset = unreal.EditorAssetLibrary.load_asset(asset_path)
    
    # Check if it's a texture
    if isinstance(asset, unreal.Texture):
        asset.compression_settings = unreal.TextureCompressionSettings.TC_DEFAULT  # Not a normal map
        asset.srgb = True  # Enable sRGB if needed
        asset.modify()  # Apply changes
        unreal.EditorAssetLibrary.save_asset(asset_path)  # Save changes

As usual there may be really silly bugs in this, but that last if statement looks correct at first glance.

So it may be enough to just force TC_DEFAULT, and asser.srgb = True. in your script.

And you can always create blueprint tool, or event (executable from editor) that goes trough textures in folder and changes compression.

Or use property matrix on whole folder and change all textures to SRGB

1 Like

In need to edit already imported asset?
But why? It so slow!!! Why I can not setup it BEFORE import?

Here is my script for import:

 import unreal
 import glob
 import shutil
 
 def imprtImages():
     allFilese = glob.glob("D:/Trail/renderRS/*")
     j = 0
     for cur in allFilese:
             shutil.copy2(cur, 'D:/CometTMP.png')
             task = unreal.AssetImportTask()
             task.filename = 'D:/CometTMP.png'
             task.destination_path = '/Game/HoudiniRing/framesImages/'
             task.destination_name = 'Comet.'+ str(j).zfill(4)
             task.automated = True
             task.save = True
             task.replace_existing = True
             #cs = unreal.TextureCompressionSettings.TC_DEFAULT 
             #task.set_editor_property("compression_settings", cs)
             tasks = [task, ]
             unreal.AssetToolsHelpers.get_asset_tools().import_asset_tasks(tasks)
         j = j + 1
 
 imprtImages()

No idea about importing to unreal with python. Just did not combined python and unreal yet.

This is next chatGPT reply:

import unreal

def import_textures(source_directory, destination_path):
    # Create AssetImportTask
    task = unreal.AssetImportTask()
    task.automated = True
    task.destination_path = destination_path
    task.replace_existing = True
    task.filename = source_directory
    task.save = True

    # Configure Texture Factory Settings
    texture_factory = unreal.TextureFactory()
    texture_factory.automated_import_should_detect_type = False  # Prevent Unreal from detecting normal maps
    texture_factory.compression_settings = unreal.TextureCompressionSettings.TC_DEFAULT  # Set default compression
    texture_factory.srgb = True  # Ensure sRGB is enabled
    task.factory = texture_factory  # Assign factory to the import task

    # Import the assets
    unreal.AssetToolsHelpers.get_asset_tools().import_asset_tasks([task])

    print(f"Imported textures from {source_directory} to {destination_path}")

# Example Usage
import_textures("C:/TexturesToImport", "/Game/ImportedTextures")

and this is YOUR code modified by rubber duck:

import unreal
import glob
import shutil

def import_images():
    all_files = glob.glob("D:/Trail/renderRS/*")
    j = 0
    for cur in all_files:
        # Copy the current image to a temporary file
        shutil.copy2(cur, 'D:/CometTMP.png')

        # Create an import task
        task = unreal.AssetImportTask()
        task.filename = 'D:/CometTMP.png'
        task.destination_path = '/Game/HoudiniRing/framesImages/'
        task.destination_name = f'Comet.{str(j).zfill(4)}'
        task.automated = True
        task.save = True
        task.replace_existing = True

        # Configure TextureFactory settings
        texture_factory = unreal.TextureFactory()
        texture_factory.automated_import_should_detect_type = False  # Prevent auto-detecting as normal map
        texture_factory.compression_settings = unreal.TextureCompressionSettings.TC_DEFAULT  # Force default compression
        texture_factory.srgb = True  # Ensure sRGB is enabled

        # Assign the factory to the task
        task.factory = texture_factory

        # Execute the import
        unreal.AssetToolsHelpers.get_asset_tools().import_asset_tasks([task])

        j += 1  # Increment counter

    print(f"Imported {j} images successfully.")

# Run the import function
import_images()

ps.
I wonder if it works. :smiley:

1 Like

As I see this in AssetImportTask

automated (bool): [Read-Write] Avoid dialogs

Maybe if you set automated to false, it will show one Dialogue for all textures and then you can set one setting for all of them?

THANK YOU!!!
But no :frowning:

AttributeError: ‘TextureFactory’ object has no attribute ‘automated_import_should_detect_type’
AttributeError: ‘TextureFactory’ object has no attribute ‘compression_settings’

No, not for all. For each!
1000 dialogues? :frowning:

Get chatGPY (or any derp aii that "can code) and haunt it until it produces working code, it will be faster iterations.

1 Like

I runned second script for modify imported. Ok. It working
THANK YOU!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.