Jak zmienić interpolację tekstur dla wielu obrazów jednocześnie? [duplikować]

Nov 19 2020

Zaimportowałem wiele obrazów jako płaszczyzny i muszę zmienić interpolację tekstur z liniowej na najbliższą, aby rozwiązać problem podobny do tego: przezroczyste płaszczyzny obrazu w cyklach mają dziwne granice (chociaż jestem na eevee).

Można to zrobić za pomocą Pythona, prawda?

Odpowiedzi

5 susu Nov 19 2020 at 03:28

Musiałbyś znaleźć wszystkie węzły tekstur obrazu i ustawić ich typ interpolacji na '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' 

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