new guy with chicken / blender / importing problem

I did the panda tutorial and it works fine, I made a baby panda and added it to the scene, now I’m trying to add a model of my own…

I made a cube in blender, exported it with chicken, and added it to the scene. It works, but no textures at all. just a white cube

I tried replacing the environment model with my own hills. Again blender file converted to .egg It works as well, but just green, no texture.

are the textures included in the .egg file? do I have to set them in python?

I tried to set the texture, but it does nothing. I think I’m missing something here…

environ = loader.loadModel("models/mountains")
environ.reparentTo(render)
tex = loader.loadTexture("maps/grstexture.jpg")
environ.setTexture(tex, 1)
environ.setScale(3,3,3)
environ.setPos(0,42,0)

thanks

If it shows up as white, it is because there are no light in your scene. Can this be the problem?

I briefly touched this in the tutorial I released yesterday (link in the signature).

Cheers,

that might be it. In the hello panda tutorial I don’t see any lights added, so I assumed it was in the .egg file. In blender I do have a light, but I don’t think it is being exported.

i just went back and exported it again, making sure the light was selected as well as the plane, but i still only get a pale green plane, no grass texture

edit: just figured out what you refering to and found your tutorial. i’m gonna go attempt it, thanks for posting.

I got confused about this, and I couldn’t find anything in the egg file about a light even after exporting the model + light. Adding a light with code should work. Are you using textures or just vertex colors?

Most likely explanation is that your texture paths were exported as relative paths. If your .blend file is in a different place than your .egg file, panda won’t find the textures. Check the .egg file to see what the textures’ paths are; they should somewhere in the first 10 or so lines of the file.

hey, i’ve been having the exact same issue…

as perscribed, I checked the path in the egg file, and it’s a full path, not a relative one. It reads “/c/Documents and Settings/Owner/Desktop/icon_play.png” which was the path to a temp image I was trying to test as a texture.

I first had tried a jpg, but then a png… both images aren’t being used in Panda.

When i used the jpg, I got the same pasty green for my planar mesh. When I tried the png, I see nothing at all, as if the model is completely transparent.

there aren’t any errors in the console, and the export itself seems to be 100% working…

Lights don’t effect anything in blender… I can’t view the included models with panda, because they’re all compiled into a “.egg.pz” format… (??)

any more suggestions out there?

ah, i have a theory. ( :slight_smile: )

when i export with Chicken, it doesn’t seem to be giving the vertexes or polygons any (U,V) coordinates! thus loading a texture is completely ineffective because there are no corrdinates to map it to.

this is what i did in panda to render the texture… (it’s not a “fix”, since it’s obviously more effective to just find out how to make Chicken export properly)

island = loader.loadModel("models/maps/test_island.egg")
island.reparentTo(render)

tex = loader.loadTexture('textures/terrain/beachMoss.jpg')
island.setTexGen(TextureStage.getDefault(), TexGenAttrib.MWorldPosition)
island.setTexProjector(TextureStage.getDefault(), render, island);
island.setTexture(tex)

i realized what the problem was after reading the tutorials on “Simple Texturing” (www.panda3d.org/manual/index.php/A … oordinates )

the idea is that you have to tell panda how to generate the coordinates for your model. I used default values. the 3rd-to-last and 2nd-to-last lines in the code block above are added to variably acquire the model’s position, since it may not be at the origin (explained in the auto-texture-coords tutorial)

thought the question still remains… how should blender be used differently in order for Chicken to know how to export the UV coordinates with the model?

just use the uv-editor to create one.
there should be blender-tuts on the net about it. but you do it as this.
create a new area so you have 2 different ones. switch one to “3D-Mode” the other to “UV / Image Editor”
then switch into object-edit-mode . select the the faces you want to uv-map.
then press “U” to get a menue with un-wrapping methods available. pick one. you should see the uv-map in the uv-/image editor now. feel free to edit it as you please. you can also use the image-editor to asign an image to the selected faces.
sometimes this can be confusing when you use it together with material-assigned textures. but you’ll get used to it.

so then, the best idea is to use this UV/Image mapping, instead of material textures? I’ll have to give it a try.

Thanks very much for the reply. that’s exactly what I was looking for.

(a tutorial on wiki about this: http://en.wikibooks.org/wiki/Blender_3D:_Noob_to_Pro/UV_Map_Basics )

I made a cube in Blender and gave it a red material with a cloud texture generated in Blender. Exported with chicken, viewed in pview and the cube appears white. Wrote a little panda program which loads the cube; it appeared white – until I realized that I needed to add lighting to the scene, and then after adding lights, the red material is apparent but no texture.

So, if I understand this correctly, Panda will only use textures from image files and they must be UV-mapped, not the material textures generated in Blender like cloud, stucci, etc.? And that is why Chicken won’t export the material textures?

So if I want a cloud texture, I need to make it in GIMP, or is there a way to take the Blender cloud texture and turn it into an image file?

I am also puzzled about pview – why doesn’t it show the red material? There were no lights selected for export from Blender, the first time, but later when I did select them, it made no difference – the lights were not exported. Does pview only show textures, and not colored materials? So when I pview some of the model files distributed with panda and see colors, they’re all from textures?

if you want to use blenders texture-plugin to generate textures for your models you can use blenders texture bakeing tools to render them into a texture.
materials and textures are somewhat confusing. i prefer NOT to use materials in blender at all. aside from that. you can toggle lights in pview by pressin “L” if i’m not totaly wrong.

Yes, I see that L toggles light, and also found that T toggles texture in pview – actually there are quite a lot of pview controls that I didn’t know – documented here: http://www.panda3d.net/wiki/index.php/Previewing_3D_Models_in_Pview

I will look into texture baking but also keep in mind that avoiding Blender materials altogether may be best. Thanks for the advice!

And many thanks to the developers of chicken for giving us this tool! In the last few weeks I’ve tried two or three other game engines before Panda – but gave up on them partly because the Blender exporters did not work – chicken is the first exporter from Blender to a game engine I’ve tried that actually works!

I have a bunch of models already made in blender3D, and they all have many colors. These are “materials,” not “textures” or anything else. Is there any exporter that will create .egg files with the colors included? So far, all I can do is make a model a single, solid color by texturing an image of the color onto the object. Even if I can’t use the “materials” in my old models, how do I get multiple colors?

Multiple colors and materials work fine for me. Are you sure you added lighting to your scene? (Otherwise they won’t show up). Or, in pview, press L for lighting and P for per-pixel lighting.

Thanks, it works now. There weren’t any lights. I assumed my teammates had added lights before when I mentioned it might be the problem – they didn’t.

Hej,
I had the same issue, but could solve it by adding some light.
Yet now I have a question: why do the included models for example from the ‘Hello World’-tutorial in the manual do not need light?
if you just start

import direct.directbase.DirectStart

panda=loader.loadModel('panda')
panda.setPos(0,50,0)
panda.reparentTo(render)
run()

or with pview

pview panda

the models are displayed with full textures.