0 votes

I am changing/adding an albedo texture to a spatial material, which appears to be working, however instead of showing the texture, it is displaying a color that is an average color of the texture. The following is my code:

func _on_Button_pressed():
    var image = load("res://images/texture_wood_01.jpg")
    var mesh = get_node("/root/Standard_d20/D20/MeshInstance")
    var material = mesh.get_surface_material(0)
    material.albedo_texture = image
    material.albedo_color = Color(1,1,1,0)
    mesh.set_surface_material(0, material)

The MeshInstance is an .OBJ file that was loaded in. It does not appear to be an issue if I am using Godot's meshes.

I get the same result when setting this in the inspector as well. :(

The image below shows on the left what I am seeing and on the right is the texture that it is using.

Here is an image of what I am seeing

Godot version 3.2.3
in Engine by (24 points)
edited by

1 Answer

0 votes

It appears that my 3D models did not have their UV unwrapped. Was able to go into Blender and fix this.

by (24 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.