grdimage to produce 3D-anaglyphs
|Target version:||Candidate for next minor release|
I saw today a poster with a 3D red/cyan anaglyph of the moon. And of course I thought: GMT5 should be able to do that!The way it could work in grdimage is the following:
- Add an additional option to assign a "depth map"
- Add an additional option to assign a maximum left-to-right displacement
- Compute the pixel colors as per usual (with shading if so desired)
- Normalize the depth map so that 0 is the largest depth of view, 1 is the nearest.
- Shift pixels right proportional to the normalized depth map; this is your left image
- Shift pixels left proportional to the normalized depth map; this is your right image
- Merge the left and right images to a single image
For links on these steps, see: http://stackoverflow.com/questions/7714289/3d-anaglyph-creation-algorithm-using-depth-map-image-where-to-find
#1 Updated by Joaquim over 2 years ago
and you know what? Some 10 years ago grdimage was able to do anaglyphs but I lost that version long ago.
I have it in Mirone. It only lacks an optional amplification factor. Have a look at line 2208 of (it even uses grdgradient)