Skip to content

Anaglyph Shader Matrix Values #21135

@jdeboi

Description

@jdeboi

Is your feature request related to a problem? Please describe.
I noticed that the anaglyph effect really didn't look good with my red cyan glasses-lots of ghosting that doesn't appear when using an anaglyph Processing library based on the Dubois red/cyan algorithms. I did some digging, and (I think, but totally correct me if I'm wrong) the current three.js anaglyph shader uses right/left matrices that prioritize color purity over 3D.

I'm pretty sure the angler matrices this.colorLeft and this.colorRight (at least in the linked shader) are Dubois. I replaced the three.js matrices in the AnaglyphShader with these angler values (below), which helped with the ghosting of my models.

this.colorMatrixLeft = new Matrix3().fromArray( [
     0.456100, -0.0400822, -0.0152161,
     0.500484, -0.0378246, -0.0205971,
     0.176381, -0.0157589, -0.00546856
] );

this.colorMatrixRight = new Matrix3().fromArray( [
     -0.0434706, 0.378476, -0.0721527,
     -0.0879388, 0.73364, -0.112961,
     -0.00155529, -0.0184503, 1.2264
] );

Describe the solution you'd like
I think a simple comment in the AnaglyphEffect.js mentioning what type of anaglyph matrix / algorithm is being used (e.g. red/cyan or red/amber? Dubois or something else?). A more complete and complex solution might be an extra parameter to the anaglyph effect to set the type of matrices used in the shader based upon glasses color or desired effect.

Describe alternatives you've considered
As mentioned, I was able to copy the Dubois angler matrix values here, so maybe this isn't a feature request as much as a documentation request.

I've been trying to find a good resource w/ the computed matrix values. This is the best I've been able to find so far:
Processing lib and optimized anaglyph.

Anyway, thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions