effects with multiple profiles, and <bind_material>

I would like to clarify something:

I’ve got a scene in Maya.

I have a box which has a single material.

The material is a lambert and has texture inputs (a diffuse, a specular and a bump).

In addition I have a cgfxShader which is connected to the lambert through it’s hardwareShader attribute.

In Maya, I can choose to view the box with the cgfxShader active OR with the lambert shader network (traditional maya shader network) active.

I export this scene to Collada.

Is this sensible:

In the file I have a single <material> in the <library_materials>. This references a single <effect> in the <library_effects>.

The effect has multiple profiles. One profile is <profile_COMMON> and describes the lambert shader network, describing the lambert material and it’s connected textures.

The second is a <profile_CG> which describes the cgfxShader, it’s parameters and the textures which are connected to it.

In the <visual_scene> there is a <bind_material> referencing the single material. Under this are multiple <bind> which give bindings for both the lambert shader network and the cgfxShader network. The <bind_material> has no way to ‘know’ which profile of the <effect> I want, so there are bindings for all possible profiles.

When reading this file, I read the material and the effect, then choose which profile I want to read in.

The different profiles in the effect are therefore different ways of describing the same material but by different methods.

Is this correct?

Or do the multiple profiles in the effect describe a multi-pass effect?

You are correct.

The different profiles in an effect are the same effect just different ways of doing it, like fixed function vs. a cg shader.

Multipass effects would be described within the profile that allows them. profile_COMMON does not have any multipass effects. profile_CG does allow multiple techniques and multiple passes. They are denoted by the <technique> and <pass> elements respectively.