chimera stereo anaglyph implementation

Dear madam, dear sir, I am trying to write a bundle for ChimeraX that includes the possibility to apply an anaglyph (red-cyan) filter to a model. It has come to my attention that this function had already been featured in chimera but not in chimerax. I have been trying to find how it has been implemented in the chimera sourcecode but have not been successful. I found the method declaration in the include/_chimera/stereo.h file but not the code that defines the logic. If you could help me find it I would greatly appreciate it. This is in the context of a research project of the Hochschule Bonn-Rhein-Sieg. Yours sincerefuly, Jonas Hiltmann

Hi Jonas, ChimeraX has completely different (modernized) graphics compared to Chimera so I don't think knowing how Chimera did red-cyan (anaglyph) stereo will help you. But if you want to look it is in file chimera/libs/_chimera/Stereo.cpp and you can get a tar ball of the Chimera source code here https://www.cgl.ucsf.edu/chimera/docs/sourcecode.html Here's the only relevant code in Chimera (in C++). bool StereoAnaglyph::setup(const Viewer *, int view) const { switch (view) { case 0: glColorMask(GL_TRUE, GL_FALSE, GL_FALSE, GL_FALSE); break; case 1: glColorMask(GL_FALSE, GL_TRUE, GL_TRUE, GL_FALSE); break; } return true; } For implementing a new ChimeraX camera mode you want to look at camera.py in ChimeraX https://github.com/RBVI/ChimeraX/blob/develop/src/bundles/graphics/src/camer... All OpenGL graphics is done from Python in ChimeraX (it was all in C++ in Chimera). You might start with a copy of the SplitStereoCamera class in that file. Your anaglyph camera mode would want to do the same thing, render two eye images, use the glColorMask() option to make one image red, the other cyan. The main difference is you want to draw the two on top of each other by adding instead of side-by-side. The additive blending OpenGL code you need is probably not too hard. If you get stuck I can advise. Tom
On Jun 11, 2024, at 1:28 AM, Jonas Hiltmann via Chimera-dev <chimera-dev@cgl.ucsf.edu> wrote:
Dear madam, dear sir,
I am trying to write a bundle for ChimeraX that includes the possibility to apply an anaglyph (red-cyan) filter to a model. It has come to my attention that this function had already been featured in chimera but not in chimerax. I have been trying to find how it has been implemented in the chimera sourcecode but have not been successful. I found the method declaration in the include/_chimera/stereo.h file but not the code that defines the logic. If you could help me find it I would greatly appreciate it.
This is in the context of a research project of the Hochschule Bonn-Rhein-Sieg.
Yours sincerefuly, Jonas Hiltmann
_______________________________________________ Chimera-dev mailing list -- chimera-dev@cgl.ucsf.edu To unsubscribe send an email to chimera-dev-leave@cgl.ucsf.edu

Hello Tom, Thank you for the quick and detailed reply. I will try to make it work according to your instructions. I will let you know if I get stuck! Best regards Jonas Quoting Tom Goddard <goddard@sonic.net>:
Hi Jonas,
ChimeraX has completely different (modernized) graphics compared to Chimera so I don't think knowing how Chimera did red-cyan (anaglyph) stereo will help you. But if you want to look it is in file
chimera/libs/_chimera/Stereo.cpp
and you can get a tar ball of the Chimera source code here
https://www.cgl.ucsf.edu/chimera/docs/sourcecode.html
Here's the only relevant code in Chimera (in C++).
bool StereoAnaglyph::setup(const Viewer *, int view) const { switch (view) { case 0: glColorMask(GL_TRUE, GL_FALSE, GL_FALSE, GL_FALSE); break; case 1: glColorMask(GL_FALSE, GL_TRUE, GL_TRUE, GL_FALSE); break; } return true; }
For implementing a new ChimeraX camera mode you want to look at http://camera.py in ChimeraX
https://github.com/RBVI/ChimeraX/blob/develop/src/bundles/graphics/src/camer...> All OpenGL graphics is done from Python in ChimeraX (it was all in C++ in Chimera). You might start with a copy of the SplitStereoCamera class in that file. Your anaglyph camera mode would want to do the same thing, render two eye images, use the glColorMask() option to make one image red, the other cyan. The main difference is you want to draw the two on top of each other by adding instead of side-by-side. The additive blending OpenGL code you need is probably not too hard. If you get stuck I can advise.
Tom
On Jun 11, 2024, at 1:28 AM, Jonas Hiltmann via Chimera-dev <chimera-dev@cgl.ucsf.edu> wrote:
Dear madam, dear sir,
I am trying to write a bundle for ChimeraX that includes the possibility to apply an anaglyph (red-cyan) filter to a model. It has come to my attention that this function had already been featured in chimera but not in chimerax. I have been trying to find how it has been implemented in the chimera sourcecode but have not been successful. I found the method declaration in the include/_chimera/stereo.h file but not the code that defines the logic. If you could help me find it I would greatly appreciate it.
This is in the context of a research project of the Hochschule Bonn-Rhein-Sieg.
Yours sincerefuly, Jonas Hiltmann
_______________________________________________ Chimera-dev mailing list -- chimera-dev@cgl.ucsf.edu To unsubscribe send an email to chimera-dev-leave@cgl.ucsf.edu
participants (2)
-
Jonas Hiltmann
-
Tom Goddard