'Diffuse' default when a texture is present?

Hi there,

I am trying to determine what would be a sensible default colour for ‘diffuse’ in a lambert element when a texture rather than a colour is provided. Checking the documentation reveals the following:

The schema does not specify default colors for <ambient>, <diffuse> and other child elements of the shaders <blinn>, <constant>, <lambert>, and <phong>. If any child element is unspecified, apply the specified shader equation without that portion. This provides equivalent results to explicitly specifying black for that child element.

The duck included in the model bank has the following colours:

  1. An emission of 0,0,0,1.
  2. An ambient of 0,0,0,1.
  3. A diffuse texture rather than a diffuse colour.
  4. A specular of 0,0,0,1.

As you can see, there is a diffuse texture rather than a diffuse colour and so technically the diffuse element is present. In this scenario, what should be the default for the diffuse colour please?

If I choose black then the duck appears black (due to the lack of emission, ambient or specular) but if I choose 0.8 (the OpenGL default) then the duck appears acceptably lit. However, choosing 0.8 goes against the specification.

Many thanks,
Richard.

However, choosing 0.8 goes against the specification.
Not really. There’s a mismatch between the Collada spec and OpenGL fixed function when it comes to lighting equations. In the Collada spec when you have a diffuse texture the diffuse color comes from that. There is no additional constant diffuse material color when you’re using a texture as there is in fixed function OpenGL. Use white as the diffuse material color for OpenGL to nullify its effect since it isn’t present in Collada’s lighting equation in this case.

Thank you for your reply. Having considered this further, my problem is this.

In fixed-function OpenGL it is possible to specify a diffuse material colour in addition to having a texture. In Maya it doesn’t go quite this far, but it does allow a diffuse value in addition to having a texture. This value is between 0 and 1 in Maya’s case.

This is highly desirable behaviour since specific textured geometry can receive a % of diffuse light rather than all of it. One use of this is to allow directional lighting to be less emphasised on some parts of a scene than others.

Since the texture and color elements of a diffuse element are mutually exclusive in Collada, this very useful data never makes it into the .dae file.

What are the chances of the mutual exclusivity for diffuse ‘color’ and ‘texture’ being relaxed in the next revision of the specification or at least there being a ‘percentage’ or ‘color’ attribute for the ‘texture’ element under ‘diffuse’?

If this is not a viable option, what would you recommend please?

Right, I see your problem.

Since the texture and color elements of a diffuse element are mutually exclusive in Collada, this very useful data never makes it into the .dae file.
Usually a DCC tool will export this info as <extra> data. I believe Max and Maya both export this as <extra>.

What are the chances of the mutual exclusivity for diffuse ‘color’ and ‘texture’ being relaxed in the next revision of the specification or at least there being a ‘percentage’ or ‘color’ attribute for the ‘texture’ element under ‘diffuse’?
Probably zero unless you become a Khronos member and formally propose this feature via the bugzilla and submit the necessary schema changes. Unfortunately all Collada design discussion happens on the Khronos mailing list, not on this public forum.

If this is not a viable option, what would you recommend please?
<extra>

Steve

Thank you for getting back to me.

Usually a DCC tool will export this info as <extra> data. I believe Max and Maya both export this as <extra>.

Unfortunately that doesn’t appear to be true for Maya using ColladaMaya 3.05b - I can’t comment on Max.

please consult the extension information for max and maya to see what is supported.
you can access this information from the product directory.
http://collada.org/mediawiki/index.php/Portal:Products_directory

BTW, each product owner is responsible to keep the product description and extension repository up to date. If you are reading this message and are responible for a product supporting COLLADA, please take a minute to make sure it is correctly represented.