Multitexturing, Maya... questions

I’m not experienced with either of these topics, so I thought it best to clear up some things here…

  1. I was looking at the Advanced Texturing section of the Converting from Maya manual page (http://panda3d.org/manual/index.php/Converting_from_Maya). This section describes how to add multiple textures to a surface. When this procedure is done on a model, and I load the model in Panda, how does Panda choose which blending mode is appropriate for which texture stage? Is this data passed on from Maya to Panda, or automatically deduced in Panda, or do I have to set this manually? If I export a model with a normal map and a regular color texture, am I assured that Panda will know how to blend these properly if I load the model?

  2. Does Maya have a way of specifying the order in which the texture stages are applied, and is this carried over to Panda?

  3. If I apply multiple textures in Maya, and I want to access one particular texture later on, how do I retrieve its texture stage?

  4. The Multiple Texture Coordinate Sets page of the Panda manual (http://panda3d.org/manual/index.php/Multiple_Texture_Coordinate_Sets) says that you can specify multiple UV sets in Maya… how do you retrieve these sets later on so you can name them and pass them to a texture stage?

  5. The Converting from Maya manual page says that I have to apply a Phong shader material to the Maya model in order for multitexturing to work properly in Panda. Does this mean that my Panda application will require graphics cards with shader support to run properly if I export from Maya? If I set this textures manually in Panda, will I still require shader support for multitexturing?

My intention is to create an effect for running water in Panda, without shaders. I wanted to model a lake, or river, with multiple textures to achieve this effect. Bottom texture will be the reflection of the world around it, on top of it I wanted to add a texture that would give the water a greenish or bluish tint, then a normal/opacity map. To make it look like the water was moving, I wanted to change the UV coordinates for the last texture during runtime. Will this work?

I don’t have any experience with Maya, but I’ll try to answer some of your questions.

The default blend mode is MModulate (aka Multiply), the textures are multiplied by each other here. I think the maya exporter will automatically choose a different blending mode for a texture stage if that is set so in maya.

Using NodePath.findAllTextureStages. That returns a TextureStageCollection, where you can extract the TextureStages from.

I think using the same way as the previous. Just supply the TextureStages you have acquired from the findAllTextureStages call in the setTexOffset (or any other function) as described in this manual page.

Well, no. If you want to use the automatic shader generator, you would have to call setShaderAuto in Panda3D on your model first, before any shaders are applied. I don’t know how this works in maya, but I think its best not to set any phong shading effects but just apply the textures, I’m pretty sure that will export good. But as I said, I don’t have a clue how that would work in Maya. Maybe some maya user can comment on this.

That sounds like an excellent idea. I was just thinking about it the other day, and I’d love to see that implemented one day.
Personally, if I would do this I wouldn’t set the textures in the modeler at all, not even the UV texcoords, but I’d manually set them all using setTexture in the program itself. That way you are also certain no shaders are used.

Oh, by the way. I think Panda3D’s NormalMap TextureStage mode requires the Automatic Shader Generator, while NodePath.setNormalMap does it using an old method that doesn’t require shaders, but does take several texturestages. Do watch the maximum number of texturestages your card supports. (mostly 4, but 8 on newer cards)

Thanks for the prompt reply!

Hmmm… is there a way to correctly identify the texture stages? How will I distinguish a texture stage that contains an opacity map from one that contains the base color? I guess this leads back to the question of whether these textures are arranged in a particular way when exported from Maya, and what other information they come with.

I ran into this page of the manual soon after I made the post. I think we’ll just stick to using Texture Transforms for the particular Texture Stage we want to move… It’s much simpler than having to worry about the actual coordinates of the polygon. This also looks very promising. I think we’ll have to move around the reflection texture as well, to maintain a proper perspective when the camera moves.

Actually, shader reliance is precisely what we don’t want. I was just concerned because Panda seems to require this to be done in Maya. I’m hoping this isn’t the case, and that someone can confirm I’m just misunderstanding the instructions with regards to exporting a multitextured Maya model to egg (I’m not an artist, I don’t have much experience with Maya). Maybe the manual page is old, and the maya2egg exporter has been updated to no longer require this?

Unfortunately, we’re working with an art studio. We want to keep the production process as streamlined as possible. The models we’re using as levels are very large and very complex, and we’d prefer to minimize having to load, set and manipulate textures during runtime, especially since the number of levels we’re going to have is indeterminate at this time. We’re trying for a generalized solution, with as few special cases as possible. Also, if something looks wrong, we have to send it back, and it can take awhile for the problem to get fixed and for us to get the level back.

We’ve already managed to do this trick with XNA in the past…

Anyone out there with more experience with Maya than me and pro-rsoft?

The application of a maya “shader” has nothing to do with Panda shaders. In Maya, every kind of coloring approach is called a shader. This has no relation to hardware shaders used for rendering on modern graphics cards. In fact, Maya’s “phong” shader duplicates the fixed-function rendering mechanism that you get when you don’t use hardware shaders on your graphics card, which is why “phong” was chosen as the necessary Maya shader type.

If you never call nodePath.setShader() or nodePath.setShaderAuto(), then Panda won’t use shaders to render your scene. Simple multitexturing does not require shaders.

The name of the TextureStage, by the way, corresponds to the name of the Maya shader you used. That’s the easiest way to identify the particular textures.

David

Great~! Really helpful. Thanks.

I tried following the instructions here, but I can’t seem to export a simple multitextured quad. I have two textures loaded from a file, a brownish texture, and a white texture with a black streak cutting across the middle. I open up the hypershader and follow the instructions. Since default multitexturing just multiplies the values of the two textures, I’d expect the final result to just be the brown texture with a black streak on it. White x Brown = Brown, and Black x Brown = Black.

Does this look right? Why isn’t the black streak showing up on the preview of the material?

When I render the quad in Maya, the black streak doesn’t show up either.

When I export this and check the EGG file, I find no reference to the black streak texture in the egg file. The Texture entry for the brown texture is there, but not for the black streak. Pviewing the EGG shows me a brown quad. What am I doing wrong?

Edit:

Okay, I got it rendering properly in Maya by changing the Blend Mode of the texture layer to Multiply. But when exporting still results into an EGG file that only loads one texture: the black streak texture. There is no entry for the brown texture in my EGG file.

Here’s the output using the PandaExporter. The problem seems to lie with the colorGain attribute… Any suggestions?

Initializing Maya.
:maya: Reading /c/Documents and Settings/mike/Desktop/New
Folder/scenes/temp_temp.mb
:maya:mayaegg: Converting from Maya.
:maya:mayaegg: ac_none
:maya(warning): Attribute colorGain does not have a vec3f object value.
:maya(warning): Object layeredTexture1 does not support attribute
colorGain
:maya:mayaegg: Converted, no errors.
Writing /c/Documents and Settings/mike/Desktop/New
Folder/scenes/test3.egg

This thread:
https://discourse.panda3d.org/viewtopic.php?p=9688&highlight=&sid=f415c1fe59becc63f508b6d29c1db3d4

…seems to describe my problem. Was this ever resolved? David?

You know, I don’t really know. I don’t use Maya myself, so I’m not that familiar with the ways you need to set up textures and whatnot in order for the converter to understand it.

Can someone else who is more familiar with using Maya offer some advice?

David

Which Panda version are you using ?
This is today shot of 1.5.1 :

discourse.panda3d.org/viewtopic.php?t=2428

Panda 1.4.2 Why? Were there reports that the maya2egg included with this version of Panda had problems exporting multitextures?

ynjh_jo:

Are there any steps that you took in making that EGG file that might not have been mentioned in the Panda manual? Things seasoned users of Maya and Panda might have taken for granted?

Thanks…

It has been supported before the time of v1.4.
Looking at your 1st picture, where was that phong5SG come from ? (could it be the way v2008 does it now ?)
The way I setup layered texture is already there in the picture in the link above.
So, how did you set yours up ?

"Looking at your 1st picture, where was that phong5SG come from ? (could it be the way v2008 does it now ?) "

Personally, I’m using Maya 7.0. I’m honestly not quite sure where the phong5SG comes from. I think it gets set-up automatically when I follow the manual instructions. I’ll check again when I have access to Maya tomorrow. May I see a screenshot of your Hypershade editor? So I have a better idea of how you managed to multitexture your model? Thanks.

Nothing serious, you don’t need to use HyperShade at all.

I tried the whole procedure from scratch, and I’m still getting anywhere. Here’s a step-by-step account of what I did… I took new screenshots to be on the safe side.

  1. Created a new scene in Maya 7.0, saved the empty scene
  2. Created a polygon plane in my scene, modified the scale, translated it down a bit… this part shouldn’t matter, right?
  3. Select my plane… right-click, Materials->Assign New Material->Phong
  4. I click on the Color Attribute Button… I select File, and then point it to my brown texture.
  5. I open up the HyperShade editor, show the graph of my material. I add a layered texture, and another file texture, and modify the connections to match the manual.

  1. I set the Blend Mode for the first layer to Multiply.
  2. I render the scene in Maya to check how it looks.

  1. I export to egg using the PandaExporter GUI for maya2egg.

I followed the manual, and when I compare the input/output graph for my material, it looks correct to me. There doesn’t seem to be any glaring difference with ynjh_jo’s work. At this point, I have an egg file… when I check it using a text editor, I can’t find an entry for my brown texture, but I have one for my black streak texture. When I pview the egg, I find myself looking at this:

Where’d my other texture go?

Have I failed to do something essential? Have I done something that prevents me from exporting my model correctly?

Your step 4 is wrong. You should select LayeredTexture, not File.
Where did you get those steps from ?
Have you seen my picture in the above link ?
Here it is :

The key is :
it doesn’t involve HyperShade at all.
If you need to add a texture layer, just click at the empty space next to the last layer (on the layered texture attributes panel).

I’m just learning Maya, and I guess everything I’ve learned so far about texturing is wrong. Is there an up to date tutorial that covers recent versions of Maya and Panda?

Hrmm… I checked the material I made the other day, and it looks like it matches your new example, even though I did it through the Hypershade editor:

I tried redoing things from scratch again, following your instructions… So I do everything the same, except I select the LayeredTexture option for my material’s color, and add layers through the window instead of the Hypershade editor. I still use Files for the color of each layer, and I set the blend mode to multiply. Here’s attempt #2:

I exported to egg again… still the same problem. Egg file has no entry for brown texture. When I pview, I get a white quad with a black strip down the middle. Is this a 1.4.2 bug? Should I try 1.5.2? Has anyone ever successfully exported a multitextured egg in 1.4.2? Has maya2egg7 and maya2egg85 changed since then?

What you see is what you get. There aren’t any resources beyond the manual and the forums we have here, as far as I know.

AHAH!

It IS a version problem. I have no problems exporting with Panda 1.5.2’s maya2egg executables. Which means that Panda 1.4.2’s exporter was malfunctioning all this time, with no one realizing it.

O.o;

1.4.2 exporters weren’t designed to work with the multi texture system I believe. It was introduced along with autoshaders in 1.5

I see… I must have misinterpreted ynjh_jo and the installer release notes… I was under the impression that advanced multi-texturing features weren’t supported by the exporter (glow maps, normal maps), but that the simpler ones were.

I guess this can serve as a reference for people still using older versions of Panda.

The simpler multitexture features are supported by the older versions of maya2egg, but I think the rules were different back then. For instance, there was no rule about phong shaders or whatnot. So it may be that the proper way of building up multitexture layers so that maya2egg could read it was different than it is now.

David