Multitexturing part2

Now that we’re the new version of panda, I’m assuming maya2egg now supports multitexturing. I can do the UV sets, but how should I setup the shader network to export the additional texture references? I guess I can edit the egg directly, but that will be a pain in the butt.

The maya2egg converter does convert multitexture properly. However, I know little about Maya. I understand from people who do use Maya that there are at least two ways to stack textures up in Maya, and one of them is recognized by the converter, and the other one is not.

More than that, I’m afraid, I can’t really tell you definitively. I believe the correct way to do it is to layer multiple different shaders, each with their own texture.

David

It diffinitely works. You can have to UV sets and you can link textures to UV sets via the UV Linking menu. To use multi-texturing, wire up your color channel in the material with a multi-layer node and attach textures to that. You can attach as many as you want as long as the graphics card supports it.

Thanks

hi,

resurrecting a long thread here.

essentially we have a related problem (see also a similiar problem described here discourse.panda3d.org/viewtopic … ltitexture):

we have one mesh which uses more than one texture for the color map. we calculate a shadow map for the whole mesh and using the method Bei describes in his previous post, we create the multi-texture information for the exporter (maya2egg).

it seems that maya2egg does not export all shaders (=materials) correctly. it does so correctly for one shader (and you can view the multi texturing in pview), the second shader just will export the color map, and the rest is totally ignored (resulting in white untextured objects).

now if anyone has a better understanding regarding maye2egg internals and how to fix this problem, we would be very happy. :slight_smile:

as an example see following screenshots (all viewed in pview).

this is the original mesh (one mesh) using different textures:

we calculate the shadow map in maya, and if we apply only one maya shader to the whole mesh (with one texture), apply Bei’s workflow, then we can see the shadow map and the color map correctly:

going back to our original mesh (with the various maya shader/textures) and using Bei’s suggestion to each shader seperatly, we only get the shadow map/color on the “last edited” correctly, the color map on the “previously edited”, and everything else is ignored:

i would try to fix this myself, but i have no clue about Maya or the exporter. any hints are appreciated.

cheers,
kaweh

Is it possible to split up your one mesh into several different meshes, according to texture? This is basically what maya2egg will have to do during the conversion process, anyway, since in Panda each different combination of textures will have to be applied to a different mesh.

Although it is true that maya2egg supports multiple different textures on the different polygons within a mesh, and it also supports multiple texture layers on a mesh, it’s quite possible that there’s a bug when both cases apply at once. We’ve never encountered that situation in our own Maya files, so if there is such a bug we’ve never seen it.

I’ll be happy to take a look at fixing this possible bug in maya2egg, if you’d like to email me your sample Maya file and supporting textures (though I only have Maya 6.0, so if you could possibly save it as that version, it would be helpful).

David

Thanks David!

That’s what we are doing right now, as fortunatly we can control the various parts. Works fine.

I will forward an example mesh soon, just need to find Maya 6 somewhere and a couple of free minutes. It’s on my list.

Cheers,
kaweh

I’ve been trying to use lightmap in my experimental scene and Pview it. Maya2egg does great work ! …unfortunately I’ve got a little, but annoying problem on Maya side. It’s about UV texture editor. If the texture is shown (Image>Display image), it would ruin the multitexture rendering on the 3D window, though the shading network is not compromised at all. I still able to achieve multitexturing if I render the scene. But it’ll never show up on the 3d window ever again, even after reloading the scene, or restarting Maya. …hah…it’s gone,…for good ! :laughing:
So, I checked it this way : I saved a copy of the healthy scene, opened UV texture editor, then the multitexture vanished, saved that version. Then I compared both ASCII files, and found 2 differences, and 1 of them is critical :

  • in the healthy scene :
connectAttr "layeredTexture1.message" "materialInfo1.texture" -nextAvailable;
  • in the crappy scene :
connectAttr "file1.message" "materialInfo1.texture" -nextAvailable;

What must be connected to materialInfo is the layeredtex, but it seems that showing the texture in UV tex editor alters the attributes connection.

Possible circumstances :

  1. it’s just a bug in v6.5, or
  2. there is a way to restore/revive the connection by standard effort/setting, but I’ve never found any simple way.

Being annoyed, I tried to find those attributes by myself using MEL script, by tracking the connections from geometry level -> uvChooser & shadingEngine -> material & materialInfo -> layeredTexture -> files. It’s a quite long way to go, since bypassing through shortcut, directly to layeredTexture or material level doesn’t return the “real” objects, and some of it and it’s attributes can not be found.
This appproach works beautifully in finding and breaking the incorrect connection and then connects the correct attributes. But it must to be done everytime after closing UV tex editor, IF the texture is shown.
Does anyone here ever suffer from such pain ? If it’s a bug, had it fixed in later versions ?
BTW, this is the script :

/*
|====================================================================|
|   This script restores the real-time multitexture rendering        |
|   (using layeredTextures approach only), which was damaged         |
|   if you opened UV texture editor and the texture was displayed.   |
|   (This problem might be just a bug of Maya v6.5)                  |
|                                                                    |
|   THE PROCESS WILL BE APPLIED TO SELECTED GEOMETRIES, OR           |
|   TO ALL GEOMETRIES IF NOTHING IS SELECTED.                        |
|====================================================================|
*/

global proc fix_multiTexture_connection()
{
print "\n\n\n\n##############################################\n";
print "Multitexture connections checking started.......\n";
print "##############################################\n\n";
// list selected geometries
string $sel[] = `ls -dag -type geometryShape -sl`;
string $numObjects = (`size($sel)`+" selected");
// if nothing is selected, list all geometries
if(`size($sel)`==0)
  {
  $sel =`ls -geometry`;
  $numObjects = "all";
  }

for ($g in $sel)
  {
  print ("GEOMETRY : "+$g+"\n");
  string $conn[] = `listConnections $g`;
  string $uvChooser="";
  string $shadingEngine;
  for ($c in $conn)
    {
    $objType = `objectType $c`;
    if ($objType=="uvChooser")
       $uvChooser = $c;
    if ($objType=="shadingEngine")
       $shadingEngine = $c;
    }

  /////////////////////////////////////////////////////////////////
  //  if current mesh has more than 1 UV set, fix the connection
  /////////////////////////////////////////////////////////////////
  if ($uvChooser!="")
     {
     print ("Geometry has multiple UV sets, start fixing the connection....\n");
     print (" SHADING ENGINE : "+$shadingEngine+"\n");

     // get the materialInfo of current geometry
     string $shadingEngineConn[] = `listConnections -type "materialInfo" $shadingEngine`;
     string $materialInfo = $shadingEngineConn[0];
     print (" MATERIAL INFO : "+$materialInfo+"\n");

     // get the material of current geometry
     string $mats[] = `listConnections -source true -destination false ($shadingEngine+".surfaceShader")`;
     string $material = $mats[0];
     print (" MATERIAL : "+$material+"\n");

     // get the layeredTexture of current geometry
     string $materialConn[] = `listConnections -type "layeredTexture" $material`;
     string $layeredTexture = $materialConn[0];
     print (" LAYERED TEXTURE : "+$layeredTexture+"\n");

     // get the texture files of current geometry
     string $textureFiles[] = `listConnections -type "file" $layeredTexture`;

     //===========================================================================
     // break the connection of "file.message"--"materialInfo.texture"
     //===========================================================================
     for ($f in $textureFiles)
       if ( !catchQuiet( `disconnectAttr ($f+".message") ($materialInfo+".texture") -nextAvailable` ) )
          print ("INCORRECT "+$f+" and "+$materialInfo+" ATTRIBUTES CONNECTION BROKEN SUCCESSFULLY...\n");

     //===========================================================================
     // create the connection of "layeredTexture.message"--"materialInfo.texture"
     //===========================================================================
     if ( !catchQuiet( `connectAttr ($layeredTexture+".message") ($materialInfo+".texture") -nextAvailable` ) )
        print ($layeredTexture+" and "+$materialInfo+" ATTRIBUTES CONNECTED CORRECTLY.\n");

     }
  else
     print ("geometry has 1 UV set, skipped...\n");

  print "=================================================\n";
  }

print ("\nDone fixing multitexture connections of "+$numObjects+" object(s).");
}

fix_multiTexture_connection();

Thanks in advance.