Textures of Models in Blender not Showing up in Panda3D

Hi,
I am trying to create a 3D model in Blender and if I run the exported egg file in pview or a program I coded, the model shows up, however, the colors and textures are not showing up.

Problem:
Colors/Textures in models created by Blender are not showing up in Panda3D.

Programs/Versions:
Blender 2.72 (latest)
Panda3D 1.81 (latest)
Python 2.7.3 (required version of Panda3D 1.8.1)
Yabee 13.1 (latest)

Description:
I have tried as many things as I could have possibly tried, from just basic material coloring to advanced texture painting. No matter what I do, I just can’t get textures or colors to show up in Panda3D. Models already provided in Panda3D’s SDK download work fully, however. I have used Yabee to export egg files, and it didn’t work. I even tried exporting obj and dae files from blender and using the obj2egg and dae2egg files given in the Panda3D download. Nothing seems to be working to fix my problem. I have searched Google and the Panda3D forums dozens of times. Nothing seems to be helping.

Question(s):
How do I create the file in blender so the texture shows up in Panda3D?
How can I fix my problem?
What do I need to do in order to fix my problem?
What am I doing wrong?

Extra:
I will greatly appreciate any helpful answers that lead me closer to fixing my problem or do fix my problem. I will be very pleased if my problem is fixed. If I cannot manage to fix my problem, I cannot continue further into game development in Panda3D. I don’t want this to happen. I want to be able to create games in Panda3D with 3D models that are properly colored and textured. Thanks in advance!

Hi! Could you post a simple model which reproduces your problem? Thank you!

First of all, do your models have UV-maps? If so, do your textures use those UV-maps (rather than another system, such as generated UV coordinates)? To the best of my knowledge, YABEE only exports UV-mapped textures.

Material colours should work; when viewing in PView, did you turn on PView’s light? I believe that in Panda, material colours only show up when lit. (If I’m not much mistaken, when viewing a model in PView, you can toggle the light using the “l” key.)

[edit]
Oh, one more thing: there may be a conflict between your version of Blender and YABEE.

From what I gather, Blender’s API sometimes changes between releases, meaning that a given version of YABEE won’t necessarily work with all versions of Blender. Looking at the YABEE thread, I see that YABEE version 13.1 is intended for Blender version 2.66–have you tried using that version of Blender?

Yeah, they are using UV Maps. I also did try the basic material colors. Thanks for your response, I will try out Blender 2.66 when I get a chance. Also, I did try the “l” thing in pview in the past. When I did that, my model just turned into a silver 3D-looking model. It did, in fact, look like a light was shining on it, however.

I doubt that the Blender version is an issue. I’ve not heard of any issues with Blender 2.7 and YABEE so far.

Fair enough on all counts; in which case, as Flavio suggested, a simple 3D model (perhaps as simple as a coloured or textured cube) that exhibits the issue might aid diagnosis.

rdb, that was the issue. I downloaded Blender 2.66 and my problem was fixed. However, if I move the egg export to a different location, the texture goes away. I even tried moving the tex folder with the image in it, but it didn’t work. When I moved it and the tex folder back to the folder i exported it in, however, the texture came back. It shows up in pview, but was white in the program when I moved it to the program’s model folder where I store the models I use for it. So I tried exporting it straight into that folder. Now it shows up with the textures in the program’s models folder. However, I would need to move it to a new folder when I pack the required files into that folder in order to create an installer and ship it to customers. Why is this happening and what can I do to be able to move the egg file and tex folder around and the model in the egg keeps its textures?

EDIT: This is messed up, sometimes the texture shows, sometimes it only shows when I press “l”, and most of the time my model doesn’t even show! (this is different models made in blender, and they are made the same way)

That suggests that your textures are being referenced via absolute paths rather than relative paths. (In case you’re unfamiliar with the terms: an “absolute path” is one that specifies the entire path, irrespective of the location at which it’s used; a “relative path” is specified with relation to the current path (for example: “…/cats/”, which might be read as "one directory level up, then into the directory “cats”).)

I’m not sure offhand of whether this helps, but I notice that in Blender, when opening an image for use as a texture, or saving one to file, there’s a check-box labelled “Relative Path”, which I see that I have checked.

In YABEE, note the option to copy texture files: this should create a copy of your textures in the indicated folder (which can be relative, and in my case by default is (specifically, my default seems to be “./tex”)).

Could the former cases be using textures and the latter just materials? The two are treated somewhat differently in Panda, as I recall; in particular at the moment I recall that materials, unlike textures, require lighting in order that they be visible.

Do you mean that the model isn’t visible at all, even white? If so, are your models perhaps offset from the origin in Blender, or very big or very small? They may be loading successfully, but be out of the camera’s initial view, sufficiently small that they’re hard to see, or so big that the camera is inside them.

To test this, when you load such a model into PView, press “c”–this should centre the view on the model, regardless of its size or location.

  1. Blender doesn’t give me the option to choose relative or absolute paths.
  2. I just want the texture in the egg file so I can move the egg file around as I please, and so customers that downloaded the game can see the textures.
  3. Blender no longer gives me the option to set my coordinates as UV for some odd reason!!! Yes, I am looking in the Mapping section with the Coordinate option. It doesn’t give me the UV option anymore!
  4. Right before I somehow lost the coordinate as UVMap option, my textures would never show!
  5. Now currently, I get images that are completely white and just turn silver when I press “l”.

Please help me with these problems! I’m getting to a point where I am going to rage and give up and I don’t want that to happen. I’ve been doing the exact same thing for each model I make, yet a very different result comes up for each!

Don’t worry, this is not likely insurmountable–I think that it’s taking a little time simply because we’re doing this asynchronously, only updating when we each visit the forum, and because those of us attempting to help aren’t in a position to see your screen, and how Blender, YABEE and PView are behaving on your end.

(Fair warning: I intend to head to bed in the next half- to one hour or so, so expect a bit of a wait if I don’t see a reply of yours before then.)

If I may ask, do you have a deadline that you’re becoming so frustrated?

As to your new problems:

That’s very odd indeed–my version does, I believe. In my version (2.66a), when opening an image from the UV/Image editor view for example, I see a panel on the left; the bottom-most section is labelled “Open Image”, and when expanded shows the check-box option “Relative Path”.

See the following image:


Again, very odd–I’m seeing it: Mapping–>Coordinates–>UV.

Given these past two issues, which version of Blender are you using, precisely? As I mentioned previously, I’m using 2.66a, and it seems to work for me–if you’re using an earlier version, try updating to that.

I don’t think that the egg format does that; textures are kept separately. However, I may be mistaken, and stand for correction.

Odd. Well, I think that the thing to do is to fix the rest of the issues, then see whether that remains.

(I presume that when you say “images” above you mean “models”, or “renderings of models”–if not, then my mistake; getting white images that turn silver would be very odd.)

Since you no longer have UV-maps, unless you’re assigning (untextured) materials, then this is the expected output; once we get textures exporting properly we should hopefully see that fixed.

I found the relative path option, it was already checked. I noticed the the egg files Panda3D had that was in the download were .egg.pz and not just .egg. I moved a couple around folders and pview’d them, but their textures stayed with the object. Everything was packed into their models, including the textures. I did something wrong with Blender, so I restarted it and found the UV coordinate option again. I am using Blender 2.66b, and it seems nothing helped. How and why is Panda3D’s egg files .egg.pz and not .egg? How can I get the egg file’s texture with it locally or in it so I can move it wherever I want with the texture and the egg file always have the texture?

EDIT: I tried making another model in Blender to export, and now under the “Export to Panda3D EGG” section at the left where the export options are, it has a warning. I click on it, and it says "Nothing to export. Please click on “Mesh”, “Curve”, or “Armature” objects. I did that, I had a mesh! I had everything set up for it properly. I exported it, and in the PView window there was absolutely nothing there!

Ah, I’m glad that you figured those out. :slight_smile:

To the best of my knowledge, the “pz” extention just indicates that the egg file is compressed. I don’t think that this is related to the textures (but may be mistaken).

First of all, get YABEE to export relative paths. I’ve done a bit more digging, and it looks as though YABEE does something odd: when “Copy texture files” (in the YABEE export screen) is not checked, it exports texture names with absolute paths. This seems odd to me, and I may be missing something, but that’s what seems to be the case. (I don’t usually run into this because I use “Copy texture files” as a matter of course.)

However, it’s quite simple to circumvent: just use the “Copy texture files” option. If you want to have the textures in the same directory as the egg file, set the path to “.” (that is, just a single full-stop); otherwise either use the default or specify another directory (relative to the directory into which you save the egg file).

That done, you should be able to move the egg and texture around as long as they retain their relationship. For example, let’s say that you have one texture, “myTex.png”, and specify that it should be kept in the directory one level above that of the egg. If you save the egg file as “myEgg.egg” into a directory named “Cat”, you might have a directory structure that looks like this:

SomeDirectory
 |-------------"myTex.png"
 |-------------Cat
                    |-------"myEgg.egg"

If you later move everything to another directory, then as long as “myTex” remains in the directory one level above that of the egg file the model should still work.

As to Panda’s models, well, Panda does set up a “model-path” variable–I think that it automatically searches for models and textures on that path. However, I’m not sure that it will still do so when the texture is given an absolute path–but someone more familiar with the model-path would be a better choice to explain this, so I’ll leave it there for now.

Again, to the best of my knowledge, egg files don’t store textures internally.

[edit]

It’s not enough to just have a mesh–YABEE requires that you select the mesh or meshes that you want to export. While I don’t claim to know the original reasoning for this, I’ve found it useful when keeping more than one model in a single file, as it allows me to export different meshes to different egg files.

OK, my problem with the warning was solved. I am no longer having millions of problems with this, however about the moving textures and egg files around, I have solved my problem with no textures. Recently I haven’t been exporting it with the texture folder, because I thought I had no need for it and it was just to store pictures of your model’s textures. However, it looks like now I have textures again because I saved it with the texture folder and texture. With it’s texture folder, I moved it somewhere else on my computer. Here’s how the egg file and texture were relative to each other: the egg file was by itself, and the texture was in a texture folder. The texture folder was with the egg file in the same folder. I kept it like that, and moved both the texture folder and the egg file somewhere else on my computer. The texture was gone when I viewed the model in pview. When I moved them back to the folder they were generated in, the texture came back. How can I fix this?

EDIT: Ahhh!!! I fixed my problem! I can now move it almost anywhere on my computer. Here is what I did:

  1. I first packed an image as PNG after texturing my model, so it generates a folder with the texture in it when I export the model.
  2. I export the model, then go to the folder I exported it in, finding a texture folder with the texture in it and my egg image. I delete the egg image, but I keep the texture folder.
  3. I go to Image > Open Image in Blender in the UV/Image Editor. I make sure the “From Relative Path” check box option is checked. I then open my generated texture even though it is already in my blender model. This is to tell Blender that when my egg file is exported, it opens the texture from the relative path.
  4. I export my model.
  5. I can now view the model in PView with texture, move the model and texture around, and it still have texture in PView.

I cannot put the egg file and texture folder in the Desktop, however, or the texture will not successfully load. I suppose there is no problem to this, as it will always be in a workspace folder?

EDIT #2: I’m having trouble with texturing UV/Image of circular objects. Have a look at this file:
pasteall.org/blend/32580
Look closely at it. Notice how the outer layer of the model is completely invisible, and the inside of the model is drawable on and viewable. It’s supposed to be the other way around. Can you take a look and play around with it a little bit and tell me what I’m doing wrong?

Hi,
I just took a look at your blend file and it seems that your normals are flipped to face inside of your model.
With your mesh selected if you go into edit mode and press Ctrl+N you will recalculate the normals and they should face correctly. Alternately, I believe you can go into edit mode and press W and in the specials menu that comes up select “Flip normals”.

Hope that helps.

Thanks! I tested it out and it worked. Without everyone’s help, I could not have done this. Thank you everyone who made an effort to help me :slight_smile:

I’m glad that you managed to find a process that worked for you. :slight_smile:

However, I am a little concerned that it’s so… convoluted. It shouldn’t require so many steps, nor care about being on the Desktop, in my experience.

In YABEE, have you perhaps checked the option “UV as texture”? I believe that this option instructs YABEE to use whatever image is assigned to the object in the UV/Image view as the texture to export–and shouldn’t be called for if you’re using a texture assigned in a material.

One thing that I’ve just been reminded of: when testing the same model multiple times–especially when the changes are only matters of moving files between folders–it might be a good idea to clear Panda’s model-cache, in case it’s using a cached version of your model and thus not reflecting your changes. To find your model-cache directory, check your project’s .prc file (or the default “config.prc” file if you don’t have a project-specific one), and look for an entry that begins with “model-cache-dir”.

Awesome! I created a fountain model and exported it with UV as texture and i can move it around my cpu. Thanks!

6 years after and I have the same trouble.
Resuming:
-There’s no obj/dae texture support in Panda 3D