Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image Texture node set to Linear instead of Closest in Blender import #132

Closed
Zophiekat opened this issue May 8, 2020 · 6 comments
Closed
Labels

Comments

@Zophiekat
Copy link

when importing the .obj into blender 2.82, all image texture nodes are set to linear by default making the textures blurry, changing them to closest fixes the issue but would take forever to change every individual material back to closest. Can this be the default?

@mmdanggg2
Copy link
Collaborator

AFAIK this is a limitation with the OBJ/MTL file format, you can't change the texture filtering.

The best workaround is to make a script to change each texture, then it's a 1 click fix.

Another way is to just export the textures at 8x scale from jmc, then it will be less blurry with linear interp but you will use way more ram loading them and they will still be blurry close up; so it's not ideal.

@danijel3
Copy link
Member

danijel3 commented May 8, 2020

Another way would be to export Blender files directly, but then the project would be jmc2blend not jmc2obj. We considered this a long time ago, but people ususally figured out ways to deal with it. I'd look for some Blender extensions, if anyone's made them.

@vitphire
Copy link

vitphire commented Jun 5, 2020

Here's a python script to change the interpolation of all the textures of all the materials of the active object:

import bpy
mats=bpy.context.active_object.material_slots
for mat in mats:
    nodes=mat.material.node_tree.nodes
    for node in nodes:
        if node.type=="TEX_IMAGE":
            node.interpolation="Closest"

You can paste this into the text editor in blender, and run it.

@StandingPadAnimations
Copy link
Contributor

MCprep also does all this

@mmdanggg2 mmdanggg2 pinned this issue Nov 30, 2021
@Sirkku
Copy link

Sirkku commented Jan 18, 2022

Just a FYI: I tried to implement COLLADA 1.4.1 and realized that Blender (3.0.0) nor Unity (2021.2.8) support the file format sufficiently, the supplied texture filtering gets ignored by Blender/Unity.
How to recreate a simple example:

  1. create a new scene in Blender
  2. add a material to the cube, give it a texture and link it to the BSDF.
  3. export as COLLADA .dae
  4. add <magfilter>NEAREST</magfilter><minfilter>NEAREST</minfilter> to the <sampler2D></sampler2D> entry in the .dae file
  5. Import the modified .dae into a fresh project in Unity or Blender

@Macintosh-Fan
Copy link

This script works for me instead for some reason. I'll leave it here just incase.

import bpy

for mat in bpy.data.materials:
    if not mat.node_tree:
        continue
    for node in mat.node_tree.nodes:
        if node.type == "TEX_IMAGE":
            node.interpolation = "Closest"

@mmdanggg2 mmdanggg2 unpinned this issue Aug 5, 2023
@mmdanggg2 mmdanggg2 pinned this issue Aug 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants