Anaglyph Shader Matrix Values
See original GitHub issueIs 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!
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top GitHub Comments
What do you think about replacing the matrices with the one from the paper? This is essentially what the OP did in his first post.
The example will look different with the new matrices but at least we have a clear resource we can link to.
Those seem to be the values dumped to the console by tschw script under default settings:
tschw comment about them is here (but does not really explain much :~)