Using 3d obj files and textures in Ursina for python

Question:

I am trying to load a 3d object into a program written with Ursina. I am able to load the 3d file, and I can load the textures, but they won’t load together. I’m sure there is something I am misunderstanding about the 3d file as I am pretty new to using 3d files. When I load the obj file, it is the correct shape but it is just black without the texture. It looks 2d. I can load the texture on a cube, but it is not the correct shape. How can I combine the two so it shows the correct texture on the correct 3d object? This is my code:

from ursina import *


app = Ursina()

cube = Entity(model = 'toybear.obj', color = color.white, scale=(.02,.02,.02), texture='toybearcolor')
app.run()
Asked By: Samantha Garcia

||

Answers:

My first thought is that you should not delcare color = color.white and
texture = ‘toybearcolor’ at the same time.
If this doesnt fix the problem, then make sure
import ursina
is declared above
from ursina import *
If the problem still consists then it must be an issue with the UV texture that you are using because besides the things mentioned above your code is fine.

EDIT:
I am not an expert UV Unwrapping but if that is the problem there are a few ways to do this.
If you want custom textures you have to go in to Blender and mark the seams on the model and save the texture to a .png file like this tutorial
https://www.youtube.com/watch?v=xPoxqOcUzNQ&t=560s

You can also do what’s called texture baking in Blender like this
https://www.youtube.com/watch?v=c2ut0Trcdi0

Alternatively some times the people who make game assets leave a UV texture as a .png file in there downloads like this artist here
https://opengameart.org/content/low-poly-mushrooms
So always look out for those

Answered By: BellVirtual
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.