Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Maya Lambert Shader Export

  1. #1
    Junior Member
    Join Date
    Mar 2006
    Location
    Netherlands
    Posts
    2

    Maya Lambert Shader Export

    Hey,

    I have a question about transparency in materials. In Collada, transparency is defined by a transp.color and a transp.key.

    But when I export from maya, the key is always 1.0 (not transparanent) and the resulting transp. color contains the amount of transparency as well. (so a white color is full transparent).

    In my opinion, transparency is defined by a color and a key. The color does not affect the amount of transparency at all. This is only defined by the key.

    Does anybody have some insight?

    - Pieter
    Pieter Visser
    Illusoft
    http://www.illusoft.com

  2. #2
    Senior Member
    Join Date
    Apr 2005
    Location
    Feeling Software, Montreal, Quebec
    Posts
    111
    Hey Pieter,

    The transparency factor is usually in the range [0,1]. Maya does always export a transparency factor of 1.0, which implies full transparency. As defined in the COLLADA specifications: you multiply the transparency factor with the transparent color: so the transparency factor is basically unused. In our viewer, I believe we average the three color components and factor in the transparency factor. Then, we do alpha-blending with that value. In truth: you should blend each color-component channel independently.

    Maya supports a color (or textures) for the transparency without any extra factor: so it makes sense to rid ourselves of the transparency factor by always forcing its value to 1.0. In 3dsMax, you can use either an opacity factor or an opacity color, so the transparency factor does have some use there.

    Hope this helps some,
    Sincerely,
    Guillaume Laforte
    Feeling Software Inc
    http://www.feelingsoftware.com

  3. #3
    Junior Member
    Join Date
    Mar 2006
    Location
    Netherlands
    Posts
    2
    Hey Guillaume,

    Thanks for your help. That makes sense. I'm developing the Collada 1.4 plugin for Blender. A lot of values from collada do not match the settings in Blender, so it's a big puzzle .
    Pieter Visser
    Illusoft
    http://www.illusoft.com

  4. #4
    Junior Member
    Join Date
    Jan 2005
    Location
    California
    Posts
    2
    Quote Originally Posted by glaforte
    Hey Pieter,

    The transparency factor is usually in the range [0,1]. Maya does always export a transparency factor of 1.0, which implies full transparency. As defined in the COLLADA specifications: you multiply the transparency factor with the transparent color: so the transparency factor is basically unused. In our viewer, I believe we average the three color components and factor in the transparency factor. Then, we do alpha-blending with that value. In truth: you should blend each color-component channel independently.

    Maya supports a color (or textures) for the transparency without any extra factor: so it makes sense to rid ourselves of the transparency factor by always forcing its value to 1.0. In 3dsMax, you can use either an opacity factor or an opacity color, so the transparency factor does have some use there.

    Hope this helps some,
    Sincerely,
    I'm still unclear (I'm writing a Collada to X3D converter). I see some files with transparency 0 and some with transparency 1. Should I ignore this thing completely, as it seems to have dual meaning? Or should I use the transparent color all the time?

  5. #5
    Senior Member
    Join Date
    Aug 2005
    Location
    California
    Posts
    165
    Take a look at the COLLADA 1.4.1 Release Notes revision A. It has a section explaining how to use transparency.
    I suggest you implement it according to the spec and not based on the other implementations. They often get this wrong and we will definately be bugging them to get it fixed.

    COLLADA Release Notes Rev. A

    -Andy

  6. #6
    Junior Member
    Join Date
    Feb 2006
    Location
    Paris, France
    Posts
    17

    Still some transparency issues

    Hi,

    I'am created an COLLADA importer, and I've tested with several DCCs (3DSMax, Maya, Blender, ...)... and my conclusion is that no one exports the transparency in the same way.

    According to the 1.4.1 release notes, we have those two equations :
    Code :
    In A_ONE opaque mode:
    result.r = fb.r * (1.0f - transparent.a * transparency) + mat.r *
    (transparent.a * transparency)
    result.g = fb.g * (1.0f - transparent.a * transparency) + mat.g *
    (transparent.a * transparency)
    result.b = fb.b * (1.0f - transparent.a * transparency) + mat.b *
    (transparent.a * transparency)
    result.a = fb.a * (1.0f - transparent.a * transparency) + mat.a *
    (transparent.a * transparency)
     
    In RGB_ZERO opaque mode:
    result.r = fb.r * (transparent.r * transparency) + mat.r *
    (1.0f -transparent.r * transparency)
    result.g = fb.g * (transparent.g * transparency) + mat.g *
    (1.0f -transparent.g * transparency)
    result.b = fb.b * (transparent.b * transparency) + mat.b *
    (1.0f -transparent.b * transparency)
    result.a = fb.a * (luminance(transparent.rgb) * transparency) + mat.a *
    (1.0f - luminance(transparent.rgb) * transparency)

    From that two equation, I conclude that :
    • * In A_ONE, <transparency> == 1 means fully opaque

      * In RGB_ZERO, <transparency> == 0 means fully opaque


    But earlier in the release notes, it is specified that :
    Your application can get these results by assuming the following if <transparent> or <transparency> is
    not specified:
    transparent = <color> 0.0 0.0 0.0 1.0 </color>
    transparency = <float> 1.0 <float>
    It is not clear to me : it means that if <transparency> is not specified, and transparent is in RGB_ZERO mode, the material will always be fully transparent... There must be a mistake in the release notes, isn't it ?

    Can some infirm or confirm what i'm saying, so that all COLLADA developpers can go further, and follow a strict rule for handling <transparent> and <transparency> tags ?

    Regards,
    Thomas

  7. #7
    Senior Member
    Join Date
    Aug 2004
    Location
    California
    Posts
    771

    Re: Still some transparency issues

    Quote Originally Posted by Thomas
    It is not clear to me : it means that if <transparency> is not specified...
    The release notes say that transparency is not part of the calculation if it is not specified:

    If <transparent> exists but <transparency> does not then transparency is assumed to have no effect on the percentage of opacity or transparency defined in <transparent>.

  8. #8
    Senior Member
    Join Date
    Aug 2004
    Location
    California
    Posts
    771

    Re: Still some transparency issues

    Quote Originally Posted by Thomas
    But earlier in the release notes, it is specified that :
    Your application can get these results by assuming the following if <transparent> or <transparency> is
    not specified:
    transparent = <color> 0.0 0.0 0.0 1.0 </color>
    transparency = <float> 1.0 <float>
    It is not clear to me : it means that if <transparency> is not specified, and transparent is in RGB_ZERO mode, the material will always be fully transparent... There must be a mistake in the release notes, isn't it ?
    If you look at the equations you will see that the assumption given in the text is based on the fact that the transparency value of one is the multiplicative identity i.e. it's not going to have an effect on the result.

    Does that help?

  9. #9
    Junior Member
    Join Date
    Feb 2006
    Location
    Paris, France
    Posts
    17
    Hi Marcus, thank you for the quick answer.

    In fact I gave my conclusion according to the equations.

    In A_ONE mode, we have :
    Code :
    result.r = fb.r * (1.0f - transparent.a * transparency) + mat.r *
    (transparent.a * transparency)

    Let's set transparency to 0 :
    Code :
    result.r = fb.r * (1.0f - transparent.a * 0) + mat.r * (transparent.a * 0)
               = fb.r * (1.0f - 0) + mat.r * (0)
               = fb.r
    ==> in A_ONE mode, transparency = 0 make the material fully transparent, thus here 1 is the neutral value.


    In RGB_ZERO mode, we have :
    Code :
    result.r = fb.r * (transparent.r * transparency) + mat.r *
    (1.0f -transparent.r * transparency)

    Let's set transparency to 1, and transparent values to 1 (fully transparent):
    Code :
    result.r = fb.r * (1) + mat.r * (1.0f -1) 
               = fb.r + mat.r * (0) 
               = fb.r

    Let's try with transparency = 0, and transparent values to 1 (fully transparent):
    Code :
    result.r = fb.r * (1 * 0) + mat.r * (1.0f -1 * 0) 
               = fb.r * 0+ mat.r * 1
               = mat.r

    ==> in RGB_ZERO mode, transparency = 1 means fully transparent... a value of 0 make the material opaque, whatever the transparent color is.

    Moreover, according to the equations, in A_ONE mode the transparency value modulate the transparency material (the less transparency value is, the less transparent is the material), whereas in RGB_ONE mode the transparency modulates the opacity of the material (the less transparency value is, the mode opaque is the material). As in both mode the transparency has not the same even, it cannot have the same default value for both modes.

    Maybe I'm totally wrong, but in that case I don't see my mistake.

  10. #10
    Senior Member
    Join Date
    Aug 2004
    Location
    California
    Posts
    771
    Quote Originally Posted by Thomas
    As in both mode the transparency has not the same even, it cannot have the same default value for both modes.

    Maybe I'm totally wrong, but in that case I don't see my mistake.
    I see what you're saying and I agree that the relnotes are not crystal clear on this topic. First please note that there are no default values for these elements. The relnotes talk about assumptions, not defaults, in order to explain the difference based on the opaque attribute values. The relnotes say:
    Your application can get these results by assuming the following if <transparent> or <transparency> is not specified:
    Code :
    transparent = <color> 0.0 0.0 0.0 1.0 </color>
    transparency = <float> 1.0 <float>
    Perhaps the example given is not as clear as the language preceeding it asserts.

    Can you submit a bug in Bugzilla for this issue to be addressed?

    Thanks

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •