autoshader:undefined variable "tot_diffuse"

I have a human model as mentioned here:

At the beginning it has problem on the tangents and binormals, because it is too complicated and vertexes are merged together. Somehow in the new model the problem goes away. So I export it with tangents and binormals. This model also has normal maps and specular maps defined.

If I turn on the autoshader, an error message is shown:
:gobj(error): created-shader: (51) : error C1008: undefined variable “tot_diffuse”

If it is off, everything is ok. What’s wrong ?

Also, I find that the scene graph of the actor is like this:
Armature -> Character -> GeomNode

The human model actually has:
Body + Head - has color maps, bump maps, and specular maps
Tongue - only color map
Teeth - color map and bump maps
Eye - color map and specular maps

I have to write a skin shader for this model, an eye shader for the Eye, but there is only on GeomNode in the scene graph, how can I write it with the proper reference to the corresponding textures for each vertex group?

Which version of Panda? I can recall I fixed a bug that looked like that.

Otherwise, send me the .egg file in question (or just the material).

I am still at 1.5.4. The files are very big, I will package it and update you later.

How about the second question ? If I have such a complicated model, how to have various shaders interfaces various vertex groups with various materials defined in the egg file ?

I would split them up in several sub-geomnodes.

Does the problem still occur in 1.6.0?

I’m about to freeze 1.6.1, so if you want to get it fixed in 1.6.1 still, send me something that errors.
Probably you can get the same error by reducing the geometry to 1 polygon, not changing the materials - then the files will be smaller.

You are so quick ! I have not yet installed 1.6.0, still busy on some demos.

I have uploaded the files to: … oads/entry

In the meantime, I have another problem about it.

The head of the model disappears when it is view at certain angle:

I move the camera up and down and the head disappear consistently at certain position.

The zip file named “david”? I had no errors generating a shader for that model. Must have been already fixed in 1.6.0 (I recall fixing a bug with that error message).

As for your other problem: no idea, maybe it’s related to a NaN entry in the animation? (Or, try enabling double-sided and see if the error goes away.)

Thank you very for your test.

The animation is driven by controlling the joints of the backbones, not from exporting of blender.

I am wondering, if the head contains some sub-parts, the eyebrows may be semi-transparent. Is it a possible cause ?

Do you mean to split them in the original model or split them in Panda ?
I have not yet figured out how to do it in either way. Can you give more advice ?

Original model. If you use blender, use P to separate.

Though - on second thought, you might not need to separate at all. Just use vertex groups to say what material belongs to what part.

But my original model is already composed of several separated meshes, say the body, eye, teeth, tongue. They are connected through the same armature. I still see only one geomnode after it is loaded.
(may be you can cross check in david1.egg)

How to make it work ?

Hmm, what was the problem again?
You can just apply a different material for each part, right?

For a character model, the geoms are automatically combined together at load time by default. To avoid this, use “egg-optchar -flag” and give a different name to each of the pieces you wish to use individually.


Hmm, but they won’t be flattened if they have different materials or textures, right?

Well, not completely–they will remain separate Geoms, because they have to be, but they will probably still end up in the same GeomNode, and it will be difficult to tell which Geom is which (because they will be stored in arbitrary order). So using the -flag option is the most reliable way to make a particular piece findable at runtime.


Yes, it works. Thank you very much.

I use these parameters for egg-optchar:

-keepall -flag Body -flag Eyes -flag Teeth

keepall helps to keep all the joints, otherwise they will be “optimized” away.

But it is interesting that the egg file size reduced from 7M to 5M after use this option.