Untextured materials not displayed in Collada files

I have been experimenting with importing models from Google 3D Warehouse. Collada files exported from Sketchup 7.1 can be opened in pview, but only textured geometry is displayed properly. Many of the models in 3D Warehouse are untextured, they just have colored faces. This untextured but colored geometry just shows up white in pview so a lot of the models in 3D Warehouse are unusable. Is there a way to get these colors to show up in Panada, or is this a feature that has yet to be added?

You need to enable lighting (press L in pview) for material colours to show up correctly.

Thank you!

I’m using Panda 1.6.2, and pview now displays dae’s just fine (with lighting turned on). But opening the same model in python code with loader.loadModel(myModel.dae) crashes giving me one of those “Please tell Microsoft about this problem” errors. My code works fine with egg files. Any thoughts on why this is happening?

I don’t know about the crash, but you might be able to avoid it by pre-processing your model with dae2egg and then loading the egg file instead.

David

Ok dae2egg works. Thanks. Unfortunately, I have another stupid question. I’m trying to enable lighting in my python code. Directional lighting works fine, but ambient lighting doesn’t do anything.

It seems like it’s an issue with the egg file, because I can take the lighting code from the manual which runs fine and switch the panda.egg file for my egg file (which came from google 3d warehouse download -> .skp -> sketchup export -> .dae -> dae2egg -> .egg) and then ambient lighting doesn’t work, but directional light does. Any idea why this is happening. Help much appreciated.

Ambient light doesn’t work? Really? If you have no lights at all other than the ambient light, is your model completely black? But other models are the color of the light?

You can try hand-editing the egg file and remove (or comment out with //) all lines. This will remove the application of the entries within your egg file. If this makes the ambient light work, then it tells you that the problem is in one or more of your material properties.

David

I commented out all lines and ambient light worked, so it’s a material problem.

In the egg file, this is one of the materials:

<Material> Material2.mref9 {
  <Scalar> diffr { 0.564706 }
  <Scalar> diffg { 0.568627 }
  <Scalar> diffb { 0.619608 }
  <Scalar> ambr { 0 }
  <Scalar> ambg { 0 }
  <Scalar> ambb { 0 }
  <Scalar> emitr { 0 }
  <Scalar> emitg { 0 }
  <Scalar> emitb { 0 }
  <Scalar> specr { 0 }
  <Scalar> specg { 0 }
  <Scalar> specb { 0 }
  <Scalar> shininess { 20 }
}

I assume that the ambr/ambg/ambb{ 0 } means this material does not produce any ambient light. I changed these values to 1 and it looks better, there is ambient light. But I’m guessing the amb values should really be the same as the diff values so that the ambient colour matches the diff colour.

So this seems to be the problem. Any idea where the root of this problem is? Is it the Sketchup exporter, or the dae2egg converter? I can’t tell from the .dae file whether the material has no ambient light.

Thanks for your help.

The problem has to be in either FCollada or the .dae file. dae2egg just takes the value from FCollada and puts it in the .egg file.

I had some problems with my model (converted from collada) that colors were not displayed correctly with directional lighting turned on.
The surfaces facing the directional light were rendered completely in white.
This was because the ambient and specular colors in the material were set to 1.
When I changed these to 0 instead the colors were rendered correctly.
The downside is that now the surfaces that don’t get any directional light on them are rendered completely in black.
Have I misunderstood something of how colors in the material work with lighting?
(I haven’t that much of experience with models/materials.)

It sounds like your lights are too bright: if the total of all the light influences on a model exceed 1.0 in the r, g, b components, then the lighting will supersaturate your model and make it appear white.

David

I have tested some more and gotten the result I want when placing the same color value on the ambient and specular parts as was in the diffuse part (in the material definition).
Just to be sure, is this the right way to go when using colors in the material?