Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collada <transparency> setting #229

Open
iche033 opened this issue Jul 12, 2021 · 0 comments
Open

Collada <transparency> setting #229

iche033 opened this issue Jul 12, 2021 · 0 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@iche033
Copy link
Contributor

iche033 commented Jul 12, 2021

Environment

  • OS Version: Ubuntu 18.04
  • Source or binary build? both - all versions

Description

The transparency result is different between Ignition ColladaLoader and threejs's CollaLoader if <transparency> tag is present, and <transparent> tag is missing, e.g. the follow tag produces an opaque mesh in Ignition but a transparent mesh in threejs:

            <transparency>
              <float sid="transparency">0.000000</float>
            </transparency>

Looking at the collada spec (pdf) spec, the default mode should be A_ONE. The current code sets transparency in the following way:

      dstFactor = 1.0 - color.A() * transparency;
      srcFactor = color.A() * transparency;
      _mat->SetTransparency(dstFactor);

This should produce a transparency value of 1.0 which means fully transparent.

Other notes

_mat->SetTransparency(dstFactor); is a bit confusing since srcFactor is the one that corresponds to the object's material opacity. However, the math works out to be correct because:

transparency = 1.0 - opacity
             = 1.0 - srcFactor
             = dstFactor
@iche033 iche033 added the bug Something isn't working label Jul 12, 2021
@chapulina chapulina added the help wanted Extra attention is needed label Jul 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants