Need Help

I don’t have access to Maya this week, but if you can post the egg file, I might be able to tell something.

How have you encoded the color in the shader?

David

Hi David,

Thanks for your prompt reply. I used Phong shader, but just change the color(not by applying the image file), but the color is not extracted to the egg file, but if i apply the image file, it is extracted to the egg file. I tried to make simple animation, just moving one box, it also not working while i convert to .egg, please advise.
for example

phong12SG {
“…/green.jpg”
format { rgb }
wrapu { repeat }
wrapv { repeat }
minfilter { linear_mipmap_linear }
magfilter { linear }
}

test.egg

{ Y-Up }

{
“maya2egg2009 -a model -keep-uvs ‘C:\Panda3D\models\test.mb’ -o ‘C:\Panda3D\models\test.egg’”
}
test {
{ 1 }
groundPlane_transform {
}
pCube1 {
pCubeShape1.verts {
0 {
-1.45556 -1.38264 1.7392
{ 0.375 0 }
{ 0 0 1 }
{ 0.5 0.5 0.5 1 }
}
1 {
1.45556 -1.38264 1.7392
{ 0.625 0 }
{ 0 0 1 }
{ 0.5 0.5 0.5 1 }
}
2 {
1.45556 1.38264 1.7392
{ 0.625 0.25 }
{ 0 0 1 }
{ 0.5 0.5 0.5 1 }
}
3 {
-1.45556 1.38264 1.7392
{ 0.375 0.25 }
{ 0 0 1 }
{ 0.5 0.5 0.5 1 }
}
4 {
-1.45556 1.38264 1.7392
{ 0.375 0.25 }
{ 0 1 0 }
{ 0.5 0.5 0.5 1 }
}
5 {
1.45556 1.38264 1.7392
{ 0.625 0.25 }
{ 0 1 0 }
{ 0.5 0.5 0.5 1 }
}
6 {
1.45556 1.38264 -1.7392
{ 0.625 0.5 }
{ 0 1 0 }
{ 0.5 0.5 0.5 1 }
}
7 {
-1.45556 1.38264 -1.7392
{ 0.375 0.5 }
{ 0 1 0 }
{ 0.5 0.5 0.5 1 }
}
8 {
-1.45556 1.38264 -1.7392
{ 0.375 0.5 }
{ 0 0 -1 }
{ 0.5 0.5 0.5 1 }
}
9 {
1.45556 1.38264 -1.7392
{ 0.625 0.5 }
{ 0 0 -1 }
{ 0.5 0.5 0.5 1 }
}
10 {
1.45556 -1.38264 -1.7392
{ 0.625 0.75 }
{ 0 0 -1 }
{ 0.5 0.5 0.5 1 }
}
11 {
-1.45556 -1.38264 -1.7392
{ 0.375 0.75 }
{ 0 0 -1 }
{ 0.5 0.5 0.5 1 }
}
12 {
-1.45556 -1.38264 -1.7392
{ 0.375 0.75 }
{ 0 -1 0 }
{ 0.5 0.5 0.5 1 }
}
13 {
1.45556 -1.38264 -1.7392
{ 0.625 0.75 }
{ 0 -1 0 }
{ 0.5 0.5 0.5 1 }
}
14 {
1.45556 -1.38264 1.7392
{ 0.625 1 }
{ 0 -1 0 }
{ 0.5 0.5 0.5 1 }
}
15 {
-1.45556 -1.38264 1.7392
{ 0.375 1 }
{ 0 -1 0 }
{ 0.5 0.5 0.5 1 }
}
16 {
1.45556 -1.38264 1.7392
{ 0.625 0 }
{ 1 0 0 }
{ 0.5 0.5 0.5 1 }
}
17 {
1.45556 -1.38264 -1.7392
{ 0.875 0 }
{ 1 0 0 }
{ 0.5 0.5 0.5 1 }
}
18 {
1.45556 1.38264 -1.7392
{ 0.875 0.25 }
{ 1 0 0 }
{ 0.5 0.5 0.5 1 }
}
19 {
1.45556 1.38264 1.7392
{ 0.625 0.25 }
{ 1 0 0 }
{ 0.5 0.5 0.5 1 }
}
20 {
-1.45556 -1.38264 -1.7392
{ 0.125 0 }
{ -1 0 0 }
{ 0.5 0.5 0.5 1 }
}
21 {
-1.45556 -1.38264 1.7392
{ 0.375 0 }
{ -1 0 0 }
{ 0.5 0.5 0.5 1 }
}
22 {
-1.45556 1.38264 1.7392
{ 0.375 0.25 }
{ -1 0 0 }
{ 0.5 0.5 0.5 1 }
}
23 {
-1.45556 1.38264 -1.7392
{ 0.125 0.25 }
{ -1 0 0 }
{ 0.5 0.5 0.5 1 }
}
}
{
{ 0 0 1 }
{ 0 1 2 3 { pCubeShape1.verts } }
}
{
{ 0 1 0 }
{ 4 5 6 7 { pCubeShape1.verts } }
}
{
{ 0 0 -1 }
{ 8 9 10 11 { pCubeShape1.verts } }
}
{
{ 0 -1 0 }
{ 12 13 14 15 { pCubeShape1.verts } }
}
{
{ 1 0 0 }
{ 16 17 18 19 { pCubeShape1.verts } }
}
{
{ -1 0 0 }
{ 20 21 22 23 { pCubeShape1.verts } }
}
}
}

test-anim.egg

{ Y-Up }

{
“maya2egg2009 -a chan -keep-uvs ‘C:\Panda3D\models\test.mb’ -o ‘C:\Panda3D\models\test-anim.egg’”
}

{
test {
“” {
pCube1 {
<Xfm$Anim_S$> xform {
fps { 24 }
<Char*> order { srpht }
<S$Anim> x {
{
0 0.391072 0.782143 1.17321 1.56429 1.95536 2.34643 2.7375
3.12857 3.51964 3.91072 4.30179 4.69286 5.08393 5.475
5.86607 6.25715 6.64822 7.03929 7.43036 7.82143 8.2125
8.60357 8.99465
}
}
}
}
}
morph {
}
}
}

Well, that egg file does indeed include the horizontal animation of a cube to the right.

I don’t know what’s going on with the color, but I suspect the way you applied it is not understood by maya2egg. But what’s with the entry you posted? Why did you include that on its own? Was it part of the egg file or not? In any case, the color specification would appear in the entries of the polygons, and not in the entry.

David

Hi David,

Thanks for your prompt reply.

  1. for texture do we need to load an image file or we can just change the color of the polygon in maya?
  2. the below animation is not working, please advise why?

Thanks,
James

The word “texture” means specifically an image file. But if you just want to change the polygon color, you can do that without using a texture.

Have you tried viewing the animation with the pview command, e.g. “pview test.egg test-anim.egg”? That’s what I did to confirm the animation works. You could try that too.

Assuming you can see the animation in pview, then you can also load it in Python with the Actor interface, as described in the manual.

David

Hi David,

I can see the animation in pview, but when i tried using program c++ cannot. I really wonder why. the code is below, it is working when i tried to load sample panda-model and panda-walk4.

NodePath pandaActor = window->load_model(framework.get_models(), “16/Kila”);
pandaActor.set_scale(0.025);
pandaActor.reparent_to(window->get_render());

// Load the walk animation
window->load_model(pandaActor, “16/Kila_Walk”);
window->loop_animations(pandaActor);

You have to call auto_bind() to bind the animation to the model.

David

Hi David,

Thanks, the animation is working with auto_bind, but why in the manual c++, when it load panda-model and panda-walk4, it didn’t require auto_bind but the animation is working.

Thanks,
James

Ah, I see what is happening.

When you call window->loop_animations(), it automatically calls auto_bind() on render. That’s why it works in the manual version, because in that code the panda and its animation have both been parented to render. But in your code, you have parented the panda only, and not the animation. So the default call to auto_bind() doesn’t find the animation.

Note that the first parameter to loop_animations() is an integer, and not a NodePath. When you pass a NodePath, it’s probably implicitly converting that to a boolean value, which is probably not what you had in mind.

David