Wie kann man die Texturinterpolation vieler Bilder gleichzeitig ändern? [Duplikat]

Nov 19 2020

Ich habe viele Bilder als Ebenen importiert und muss die Texturinterpolation von linear auf am nächsten ändern, um ein ähnliches Problem zu lösen: Transparente Bildebenen in Zyklen haben seltsame Ränder (obwohl ich am Vorabend bin).

Das könnte man mit Python machen, oder?

Antworten

5 susu Nov 19 2020 at 03:28

Sie müssten alle Bildtexturknoten finden und ihren Interpolationstyp auf Folgendes setzen 'Closest':

import bpy

# Run through all materials of the current blend file
for mat in bpy.data.materials:
    # If the material has a node tree
    if mat.node_tree:
        # Run through all nodes
        for node in mat.node_tree.nodes:
            # If the node type is texture 
            if node.type == 'TEX_IMAGE':
                # Set the interpolation -> Linear, Closest, Cubic, Smart
                node.interpolation = 'Closest' 

Sehen: https://docs.blender.org/api/current/bpy.types.ShaderNodeTexImage.html#bpy.types.ShaderNodeTexImage.interpolation