Quantum Sushi
Quantum Sushi

Reputation: 514

3D Model not loading with colors in Ursina (python 3)

I'm trying to load low poly FPS arms I made in Blender. I gave them colors using a material that I set a color to, it appears nicely in Blender. But when I load them into Ursina, they are totally white, no color ! I clearly think the problem is the "way" I applied the color, which may be a problem for some reason or another.

Here is how I imported the file :

class Hand(Entity):
    def __init__(self):
        super().__init__(model = 'ARMS.obj',
            scale = (0.1, 0.1, 0.1),
            rotation = (0, -20, 0),
            color = color.white,
            position = (0, 2, 0))

(sorry for minimum reproductible example, would be hard to do without posting my whole code)

So yeah, it shows with the color I set in the color parameter (white to avoid affecting the colors I apply in Blender... That don't show). Does someone know how to do that please ? By this, I mean, does someone have experience loading 3D models into Ursina/an equivalent, and knows what I did wrong ? I did as well as I could, following this : https://blender.stackexchange.com/questions/75872/not-showing-colors-in-material-mode. I will join an image of the properties of my material I assigned into blender :

enter image description here

I'm really wondering how I can get my color/future textures to load into ursina !

Upvotes: 0

Views: 1040

Answers (1)

mandaw2014
mandaw2014

Reputation: 21

OBJ models can't be loaded in with colours in ursina. What you have to do is

  1. At the top of Blender click on the Texture Paint tab
  2. On the Top Left side of the screen, you will see a button called Image.
  3. Click it, and if you already have an image loaded (which it looks like you do), click Save and Save it into your project folder
  4. In the hand class, include the texture param
class Hand(Entity):
   def __init__(self):
       super().__init__(
           model = 'ARMS.obj',
           scale = (0.1, 0.1, 0.1),
           rotation = (0, -20, 0),
           color = color.white,
           position = (0, 2, 0),
           texture = "ARMS.png"
       )

Upvotes: 1

Related Questions