Suggestion about the lighting.

Hi, I have a suggestion about the lighting.

So far, as I know Panda3D lighting is object oriented. Is that possible to expand it to be material oriented ?
For example, the shininess and reflection applied to an object only affect the faces that have shininess material attribute. So, first, Panda3D must preserve those original attributes of the object when exporting it to egg format.
So far, if I have differrent materials with and without shininess applied to a single mesh, I have to separate those faces with different material to independent meshes, so that I can achieve the lighting effect I want by creating and assigning materials to those meshes on the fly.

How is it ? Is it possible ?

This should be handled by the converter that generates egg files from your model file format. For instance, I’m pretty sure that maya2egg handles this correctly.

Are you using Maya, or 3DSMax, or some other modeling package? What process are you using to convert your models to egg?

David

I’m currently using Maya and I simply use the MayaPandaTool.mel to export my models to egg.

regards,

JO

Hmm. Sounds like something’s broken. Can you post an .mb file somewhere I can download it, demonstrating two different materials within the same mesh? I think maya2egg should apply the materials just to the polygons specified. Does it currently apply one material to the whole mesh?

David

Ooh no, there is misunderstanding here. I meant 1 mesh has more than 1 material applied, with different shininess and specular, e.g. I have a single mesh with 2 materials. The 1st material is lambert material (no shininess) and the 2nd material is phong material (with shininess). In this case, I must split the mesh into 2 meshes, the 1st mesh is the faces without shininess, and the 2nd is the ones with shininess. Then on the fly I must set the shininess for the 2nd mesh.

That’s why I called it object/mesh oriented, not material oriented. If it is material oriented, then it will respect the shininess and other properties differences, even within one single mesh. I’ve just noticed that some other engines out there have this advanced lighting method.

best regards,

JO

Right, that’s what I understood you to say. You have one mesh, and parts of it have one material, and parts of it have another.

See, no graphics engine can actually render one mesh with two different materials like that. But what can be done (and presumably, this is what the other engines you’re referring to are doing) is the mesh can be implicitly split automatically between the materials, and rendered in two different parts, so you don’t have to split it yourself. This should happen during the conversion into the graphics engine, and it should be completely transparent, so you might not even be aware that it has happened.

This is what maya2egg is supposed to do. If you tell me it’s not doing that, I believe you, but since I have no skill with using Maya myself, and I don’t know how to set up a mesh with one material on some of its faces and a different material on the others, I will require your help to create me a Maya file that demonstrates this problem. Once I have a Maya file that I can see is not working, I should be able to fix maya2egg to do the right thing.

David

This is the example, just a sphere with 2 materials:

  • the 1st one is a white lambert material
  • the 2nd one is a red phong material

Get the Maya ASCII file HERE.

In the ASCII file, you can see the material attribute of the red ‘phong1’ in line 92 :

createNode phong -name “phong1”;
setAttr “.diffuse” 1;
setAttr “.color” -type “float3” 1 0.0125 0 ;
setAttr “.specularColor” -type “float3” 1 1 1 ;
setAttr “.cosinePower” 2;

Thanks,

JO