question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Anaglyph Shader Matrix Values

See original GitHub issue

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!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
Mugen87commented, Feb 17, 2021

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.

1reaction
makccommented, Feb 17, 2021

Those seem to be the values dumped to the console by tschw script under default settings: Screen Shot 2021-02-17 at 4 58 18

tschw comment about them is here (but does not really explain much :~)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Kleinian Anaglyph 3d Fractal - Shadertoy
Build shaders, share them, and learn from the best community.
Read more >
The Graphics Pipeline and OpenGL IV: - Stanford University
paper: Eric Dubois “A Projection Method to Generate Anaglyph Stereo Images”, ... translation matrix to generate view matrix from eye,center,up parameters.
Read more >
3d Stereoscopy anaglyph-izer Unity 3 and Unity 2.6
Practically, we introduced one parametric shaders which allows you to create any kind of material optimized for any kind of anaglyph matrix, ...
Read more >
anaglyph effect webgl pop out from screen? - Stack Overflow
The 3d effect is controlled by having a different camera matrix for those two passes. By changing them the effect will change. No...
Read more >
Anaglyph - Foundry Learn
By default, Anaglyph converts the input images into grayscale images. To add color into the images, select a value between 0 (grayscale) and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found