Function Repository Resource:

 Stereogram3D

Source Notebook

Create a stereoscopic image with a 3D effect

Contributed by: Richard Hennigan (Wolfram Research)

ResourceFunction["Stereogram3D"][graphics]

displays side-by-side Graphics3D objects arranged to produce stereoscopic depth perception.

ResourceFunction["Stereogram3D"][graphics,form]

gives results in the format specified by form.

Details and Options

The value for graphics can be any of the following:
primitivesany graphics primitives accepted by Graphics3D
Graphics3D[…]a Graphics3D object
func[…]an expression that can be converted to a Graphics3D object using Show
A few possible examples of func are Graph3D, MeshRegion and Image3D.
Many functions that produce 3D graphics produce Graphics3D as their output, which means they are automatically compatible with ResourceFunction["Stereogram3D"].
The value for form can be any of the following:
"Anaglyph"a single image with color-encoded depth that is suitable for viewing with 3D glasses »
Grida side-by-side stereogram »
Leftthe left image only
Rightthe right image only
Allan association containing all forms
ResourceFunction["Stereogram3D"] accepts all of the same options as Graphics3D, with the following additions:
"AnaglyphColors"{Red,Cyan}colors to use for the left and right anaglyph channels
"Divergence"0.125amount of separation between the two camera perspectives
"DivergenceMethod"Rotatehow to separate the two camera perspectives
The value for "DivergenceMethod" can be either Rotate or Translate.
When "DivergenceMethod" is Rotate, the value for "Divergence" corresponds to radians of separation.
When "DivergenceMethod" is Translate, the value for "Divergence" corresponds to distance in scaled image coordinates.
To create a convergent stereogram (eyes crossed) instead of divergent, negative values can be given for "Divergence".
The side-by-side images are fully interactive, and any updates made to one will be reflected in the other.

Examples

Basic Examples (5) 

View a divergent stereogram of a cube:

In[1]:=
ResourceFunction["Stereogram3D"][{Opacity[.5], Cuboid[]}]
Out[1]=
Image

Get a convergent stereogram instead:

In[2]:=
ResourceFunction["Stereogram3D"][{Opacity[.5], Cuboid[]}, Divergence -> "Convergent"]
Out[2]=
Image

View more complicated Graphics3D expressions:

In[3]:=
ResourceFunction["Stereogram3D"][\!\(\*
Graphics3DBox[{
{RGBColor[0, 0, 1], CylinderBox[{{0, 0, -1}, {0, 0, 1}}]}, 
{RGBColor[1, 0, 0], SphereBox[{0, 0, 2}]}, 
{GrayLevel[0], Thickness[Large], Dashing[{Small, Small}], Line3DBox[{{-2, 0, 2}, {2, 0, 2}, {0, 0, 4}, {-2, 0, 2}}], 
{RGBColor[1, 1, 0], Polygon3DBox[{{-3, -3, -2}, {-3, 3, -2}, {3, 3, -2}, {
        3, -3, -2}}]}, 
{RGBColor[0, 1, 0], Opacity[0.3], CuboidBox[{-2, -2, -2}, {2, 2, -1}]}}}]\)]
Out[3]=
Image

Get a red-cyan anaglyph image suitable for viewing with 3D glasses:

In[4]:=
ResourceFunction["Stereogram3D"][\!\(\*
Graphics3DBox[{
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{2.4807264161348384`, 2.1590524702379854`, 1.8074890498908829`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{3.6742298875090302`, 0.06855203847897418, 0.2720835851200656}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{2.7327646506045635`, 2.1224069132691223`, 1.069839989620176}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{1.5114478061660712`, 1.2096787268801714`, 0.30529019870158347`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{2.76201831142415, 0.03311599590442249, 0.2675139487578164}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{1.7506795083863524`, 2.050636447282044, 0.9622611147568643}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{2.747201193448877, 1.2897156824755598`, 2.01674119562537}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{1.5437477973980673`, 2.5211398499090087`, 3.1080159248984307`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{0.682267007585108, 1.721228292260598, 3.995325668760537}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{2.423659797991135, 3.9696519498023806`, 1.777338995613074}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{3.9108294494633444`, 3.083401561305145, 2.7657161631731437`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{0.15192297699997148`, 3.3480410395365796`, 1.8631724923023079`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{3.9963707568288296`, 2.369851436983925, 2.875338396238843}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{2.6452215701258392`, 0.30227257234428606`, 3.3929405565093163`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{2.3550459877780794`, 2.619261842918619, 1.8561779339913231`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{2.1920732661678217`, 1.0105834186860232`, 3.274962326493675}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{3.197056001470105, 1.5363149127753335`, 3.063200956738058}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{0.9135992890441544, 2.386776511594088, 2.1172974644924}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{1.5658185943518212`, 1.9571486143898698`, 0.33559124592664524`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{1.9576034958156017`, 3.6197688708699625`, 0.6410620245402141}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{1.7779643328689527`, 2.244077108476139, 1.3586920408189274`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{1.3673834590344782`, 0.07082465961075268, 3.511917467656679}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{0.9856544393030493, 3.39132264436454, 3.3415099066549265`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{0.07105909767055607, 0.2053285599126058, 0.0690769945712999}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{0.6626797421578265, 0.4868020734975502, 2.6594809961342083`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{3.6871435488078763`, 1.9016378331402022`, 0.6098807253031504}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{2.617531213166096, 3.07668240462917, 0.024314054433268062`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{3.09041638404696, 1.5602375249123712`, 0.5653057918427571}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{1.3561371165694274`, 3.2445359687287985`, 3.270872810708422}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{2.1689012209361147`, 1.6011235740866958`, 3.7330217089028466`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{1.071491612227848, 1.410793725663689, 2.489627041056476}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{2.566904087299341, 0.9997091054733813, 0.8576187395047965}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{3.3016650949440542`, 0.8367801954794158, 3.5862363260381365`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{1.1368206379210104`, 3.864372004214106, 1.8085316753283305`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{0.006696012957075226, 0.5784877867656979, 1.3215689309086711`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{3.252221087953684, 1.4394461662881683`, 3.0779447776003117`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{1.7482580735949114`, 3.1158839291044886`, 1.7639173790921099`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{1.1766067605221524`, 3.178737607185604, 1.2458401973416535`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{0.6123291146192624, 0.9328998027654594, 3.4041226634039017`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{0.19077769545490586`, 1.0203313155119744`, 1.384956279124986}]}},
ViewPoint->{1.3, -2.4, 2.},
ViewVertical->{0., 0., 1.}]\), "Anaglyph"]
Out[4]=
Image

Get a stereogram of a plot:

In[5]:=
ResourceFunction["Stereogram3D"][
 Plot3D[Sin[x y], {x, 0, 3}, {y, 0, 3}, ColorFunction -> "Rainbow", Mesh -> None], Axes -> False]
Out[5]=
Image
In[6]:=
ResourceFunction["Stereogram3D"][
 ParametricPlot3D[{Sin[u], Cos[u], u/10}, {u, 0, 20}, PlotStyle -> Directive[Thick, Black]], "Anaglyph"]
Out[6]=
Image

Scope (5) 

View 3D models:

In[7]:=
ResourceFunction["Stereogram3D"][
 ExampleData[{"Geometry3D", "Phobos"}]]
Out[7]=
Image
In[8]:=
ResourceFunction["Stereogram3D"][
 ExampleData[{"Geometry3D", "Beethoven"}], "Anaglyph", ViewPoint -> {0, -2, 0}]
Out[8]=
Image

View a stereogram of a MeshRegion:

In[9]:=
ResourceFunction["Stereogram3D"][
 ResourceData["Stanford Bunny", "MeshRegion"], Boxed -> True]
Out[9]=
Image

Get left and right images separately:

In[10]:=
teapot = ExampleData[{"Geometry3D", "UtahTeapot"}];
In[11]:=
left = ResourceFunction["Stereogram3D"][teapot, "Left", ViewAngle -> 18 Degree]
Out[11]=
Image
In[12]:=
right = ResourceFunction["Stereogram3D"][teapot, "Right", ViewAngle -> 18 Degree]
Out[12]=
Image

Combine into a single stereogram:

In[13]:=
ImageAssemble[Rasterize /@ {left, right}]
Out[13]=
Image

Swap the images to make a convergent stereogram:

In[14]:=
ImageAssemble[Rasterize /@ {right, left}]
Out[14]=
Image

View a 3D graph as a stereogram:

In[15]:=
graph = Graph3D[ResourceFunction["KleinBottleGraph"][{20, 25}]]
Out[15]=
Image
In[16]:=
ResourceFunction["Stereogram3D"][graph, Boxed -> True, ViewAngle -> 20 Degree]
Out[16]=
Image

Look at the Earth:

In[17]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/21de870d-38d8-4739-9b4d-c684bbfc0ee5"]
Out[17]=
Image

Look at the Earth in glorious 3D:

In[18]:=
ResourceFunction["Stereogram3D"][earth, ImageSize -> 200]
Out[18]=
Image

Options (2) 

AnaglyphColors (2) 

By default, Red and Cyan are used for the anaglyph colors:

In[19]:=
ResourceFunction["Stereogram3D"][\!\(\*
Graphics3DBox[{
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{2.4807264161348384`, 2.1590524702379854`, 1.8074890498908829`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{3.6742298875090302`, 0.06855203847897418, 0.2720835851200656}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{2.7327646506045635`, 2.1224069132691223`, 1.069839989620176}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{1.5114478061660712`, 1.2096787268801714`, 0.30529019870158347`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{2.76201831142415, 0.03311599590442249, 0.2675139487578164}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{1.7506795083863524`, 2.050636447282044, 0.9622611147568643}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{2.747201193448877, 1.2897156824755598`, 2.01674119562537}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{1.5437477973980673`, 2.5211398499090087`, 3.1080159248984307`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{0.682267007585108, 1.721228292260598, 3.995325668760537}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{2.423659797991135, 3.9696519498023806`, 1.777338995613074}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{3.9108294494633444`, 3.083401561305145, 2.7657161631731437`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{0.15192297699997148`, 3.3480410395365796`, 1.8631724923023079`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{3.9963707568288296`, 2.369851436983925, 2.875338396238843}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{2.6452215701258392`, 0.30227257234428606`, 3.3929405565093163`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{2.3550459877780794`, 2.619261842918619, 1.8561779339913231`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{2.1920732661678217`, 1.0105834186860232`, 3.274962326493675}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{3.197056001470105, 1.5363149127753335`, 3.063200956738058}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{0.9135992890441544, 2.386776511594088, 2.1172974644924}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{1.5658185943518212`, 1.9571486143898698`, 0.33559124592664524`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{1.9576034958156017`, 3.6197688708699625`, 0.6410620245402141}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{1.7779643328689527`, 2.244077108476139, 1.3586920408189274`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{1.3673834590344782`, 0.07082465961075268, 3.511917467656679}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{0.9856544393030493, 3.39132264436454, 3.3415099066549265`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{0.07105909767055607, 0.2053285599126058, 0.0690769945712999}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{0.6626797421578265, 0.4868020734975502, 2.6594809961342083`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{3.6871435488078763`, 1.9016378331402022`, 0.6098807253031504}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{2.617531213166096, 3.07668240462917, 0.024314054433268062`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{3.09041638404696, 1.5602375249123712`, 0.5653057918427571}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{1.3561371165694274`, 3.2445359687287985`, 3.270872810708422}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{2.1689012209361147`, 1.6011235740866958`, 3.7330217089028466`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{1.071491612227848, 1.410793725663689, 2.489627041056476}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{2.566904087299341, 0.9997091054733813, 0.8576187395047965}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{3.3016650949440542`, 0.8367801954794158, 3.5862363260381365`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{1.1368206379210104`, 3.864372004214106, 1.8085316753283305`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{0.006696012957075226, 0.5784877867656979, 1.3215689309086711`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{3.252221087953684, 1.4394461662881683`, 3.0779447776003117`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{1.7482580735949114`, 3.1158839291044886`, 1.7639173790921099`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{1.1766067605221524`, 3.178737607185604, 1.2458401973416535`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{0.6123291146192624, 0.9328998027654594, 3.4041226634039017`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{0.19077769545490586`, 1.0203313155119744`, 1.384956279124986}]}},
ViewPoint->{1.3, -2.4, 2.},
ViewVertical->{0., 0., 1.}]\), "Anaglyph"]
Out[19]=
Image

Choose different colors to support different types of 3D glasses:

In[20]:=
ResourceFunction["Stereogram3D"][\!\(\*
Graphics3DBox[{
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{2.4807264161348384`, 2.1590524702379854`, 1.8074890498908829`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{3.6742298875090302`, 0.06855203847897418, 0.2720835851200656}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{2.7327646506045635`, 2.1224069132691223`, 1.069839989620176}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{1.5114478061660712`, 1.2096787268801714`, 0.30529019870158347`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{2.76201831142415, 0.03311599590442249, 0.2675139487578164}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{1.7506795083863524`, 2.050636447282044, 0.9622611147568643}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{2.747201193448877, 1.2897156824755598`, 2.01674119562537}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{1.5437477973980673`, 2.5211398499090087`, 3.1080159248984307`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{0.682267007585108, 1.721228292260598, 3.995325668760537}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{2.423659797991135, 3.9696519498023806`, 1.777338995613074}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{3.9108294494633444`, 3.083401561305145, 2.7657161631731437`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{0.15192297699997148`, 3.3480410395365796`, 1.8631724923023079`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{3.9963707568288296`, 2.369851436983925, 2.875338396238843}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{2.6452215701258392`, 0.30227257234428606`, 3.3929405565093163`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{2.3550459877780794`, 2.619261842918619, 1.8561779339913231`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{2.1920732661678217`, 1.0105834186860232`, 3.274962326493675}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{3.197056001470105, 1.5363149127753335`, 3.063200956738058}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{0.9135992890441544, 2.386776511594088, 2.1172974644924}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{1.5658185943518212`, 1.9571486143898698`, 0.33559124592664524`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{1.9576034958156017`, 3.6197688708699625`, 0.6410620245402141}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{1.7779643328689527`, 2.244077108476139, 1.3586920408189274`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{1.3673834590344782`, 0.07082465961075268, 3.511917467656679}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{0.9856544393030493, 3.39132264436454, 3.3415099066549265`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{0.07105909767055607, 0.2053285599126058, 0.0690769945712999}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{0.6626797421578265, 0.4868020734975502, 2.6594809961342083`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{3.6871435488078763`, 1.9016378331402022`, 0.6098807253031504}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{2.617531213166096, 3.07668240462917, 0.024314054433268062`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{3.09041638404696, 1.5602375249123712`, 0.5653057918427571}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{1.3561371165694274`, 3.2445359687287985`, 3.270872810708422}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{2.1689012209361147`, 1.6011235740866958`, 3.7330217089028466`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{1.071491612227848, 1.410793725663689, 2.489627041056476}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{2.566904087299341, 0.9997091054733813, 0.8576187395047965}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{3.3016650949440542`, 0.8367801954794158, 3.5862363260381365`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{1.1368206379210104`, 3.864372004214106, 1.8085316753283305`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{0.006696012957075226, 0.5784877867656979, 1.3215689309086711`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{3.252221087953684, 1.4394461662881683`, 3.0779447776003117`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{1.7482580735949114`, 3.1158839291044886`, 1.7639173790921099`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{1.1766067605221524`, 3.178737607185604, 1.2458401973416535`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{0.6123291146192624, 0.9328998027654594, 3.4041226634039017`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{0.19077769545490586`, 1.0203313155119744`, 1.384956279124986}]}},
ViewPoint->{1.3, -2.4, 2.},
ViewVertical->{0., 0., 1.}]\), "Anaglyph", "AnaglyphColors" -> {Green, Magenta}]
Out[20]=
Image

Interactively tune colors for a specific set of 3D glasses (the left color should be invisible to the left eye, and the right color should be invisible to the right eye):

In[21]:=
Manipulate[
 Column[{Row[{Graphics[{Hue[left], Rectangle[]}], Graphics[{Hue[right], Rectangle[]}]}],
   ResourceFunction["Stereogram3D"][\!\(\*
Graphics3DBox[{
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{2.4807264161348384`, 2.1590524702379854`, 1.8074890498908829`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{3.6742298875090302`, 0.06855203847897418, 0.2720835851200656}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{2.7327646506045635`, 2.1224069132691223`, 1.069839989620176}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{1.5114478061660712`, 1.2096787268801714`, 0.30529019870158347`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{2.76201831142415, 0.03311599590442249, 0.2675139487578164}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{1.7506795083863524`, 2.050636447282044, 0.9622611147568643}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{2.747201193448877, 1.2897156824755598`, 2.01674119562537}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{1.5437477973980673`, 2.5211398499090087`, 3.1080159248984307`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{0.682267007585108, 1.721228292260598, 3.995325668760537}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{2.423659797991135, 3.9696519498023806`, 1.777338995613074}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{3.9108294494633444`, 3.083401561305145, 2.7657161631731437`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{0.15192297699997148`, 3.3480410395365796`, 1.8631724923023079`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{3.9963707568288296`, 2.369851436983925, 2.875338396238843}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{2.6452215701258392`, 0.30227257234428606`, 3.3929405565093163`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{2.3550459877780794`, 2.619261842918619, 1.8561779339913231`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{2.1920732661678217`, 1.0105834186860232`, 3.274962326493675}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{3.197056001470105, 1.5363149127753335`, 3.063200956738058}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{0.9135992890441544, 2.386776511594088, 2.1172974644924}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{1.5658185943518212`, 1.9571486143898698`, 0.33559124592664524`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{1.9576034958156017`, 3.6197688708699625`, 0.6410620245402141}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{1.7779643328689527`, 2.244077108476139, 1.3586920408189274`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{1.3673834590344782`, 0.07082465961075268, 3.511917467656679}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{0.9856544393030493, 3.39132264436454, 3.3415099066549265`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{0.07105909767055607, 0.2053285599126058, 0.0690769945712999}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{0.6626797421578265, 0.4868020734975502, 2.6594809961342083`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{3.6871435488078763`, 1.9016378331402022`, 0.6098807253031504}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{2.617531213166096, 3.07668240462917, 0.024314054433268062`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{3.09041638404696, 1.5602375249123712`, 0.5653057918427571}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{1.3561371165694274`, 3.2445359687287985`, 3.270872810708422}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{2.1689012209361147`, 1.6011235740866958`, 3.7330217089028466`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{1.071491612227848, 1.410793725663689, 2.489627041056476}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{2.566904087299341, 0.9997091054733813, 0.8576187395047965}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{3.3016650949440542`, 0.8367801954794158, 3.5862363260381365`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{1.1368206379210104`, 3.864372004214106, 1.8085316753283305`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{0.006696012957075226, 0.5784877867656979, 1.3215689309086711`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{3.252221087953684, 1.4394461662881683`, 3.0779447776003117`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{1.7482580735949114`, 3.1158839291044886`, 1.7639173790921099`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{1.1766067605221524`, 3.178737607185604, 1.2458401973416535`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{0.6123291146192624, 0.9328998027654594, 3.4041226634039017`}]}, 
{EdgeForm[Thickness[Large]], FaceForm[None, None], CuboidBox[{0.19077769545490586`, 1.0203313155119744`, 1.384956279124986}]}},
ViewPoint->{1.3, -2.4, 2.},
ViewVertical->{0., 0., 1.}]\), "Anaglyph", "AnaglyphColors" -> {Hue[left], Hue[right]}]
   }], {{left, 0.0}, 0, 1}, {{right, 0.5}, 0, 1}]
Out[21]=
Image

Applications (1) 

Use depth perception to infer that the purple ball is closer to the camera than the green ball:

In[22]:=
whichIsCloser = Graphics3D[{Purple, 
Ball[{-1, -3, 0}, 0.5], Green, 
Ball[{1, 4, 0}, 1]}, ViewPoint -> {0, -1.5, 0}, PlotRange -> {{-2.5, 2}, {-4, 6}, {-2, 2}}]
Out[22]=
Image
In[23]:=
ResourceFunction["Stereogram3D"][whichIsCloser]
Out[23]=
Image
In[24]:=
ResourceFunction["Stereogram3D"][whichIsCloser, "Anaglyph"]
Out[24]=
Image

Properties and Relations (2) 

Any function that returns a Graphics3D object can be converted to a stereogram using Stereogram3D:

In[25]:=
ResourceFunction["Stereogram3D"][
 ListSurfacePlot3D[
  ExampleData[{"Geometry3D", "StanfordBunny"}, "VertexData"], MaxPlotPoints -> 50, Mesh -> 30, Axes -> None, MeshFunctions -> (#1 - #2 + #3 &), MeshShading -> {None, Automatic}]]
Out[25]=
Image
In[26]:=
ResourceFunction["Stereogram3D"][
 ResourceFunction["GeoGlobe3D"][GeoBackground -> "Satellite"]]
Out[26]=
Image
In[27]:=
ResourceFunction["Stereogram3D"][
 ResourceFunction[
  "SolarSystemPlot3D"][{Red, Sphere[Entity["Planet", "Neptune"], 1]}]]
Out[27]=
Image

If using the default anaglyph colors (Red and Cyan), the different views can be extracted from the image color channels. Here is an anaglyph with excessive divergence for illustrative purposes:

In[28]:=
img = ResourceFunction["Stereogram3D"][{Opacity[.5], Cuboid[]}, "Anaglyph", Divergence -> .33]
Out[28]=
Image

Observe that the green and blue channels share a common viewpoint while the red channel is distinct:

In[29]:=
{red, green, blue} = ColorSeparate[img]
Out[29]=
Image

Although some color information is lost, recombining channels gives the same pair of perspectives as the side-by-side stereogram:

In[30]:=
ImageAssemble[{red, Blend[{green, blue}]}]
Out[30]=
Image
In[31]:=
ResourceFunction["Stereogram3D"][{Opacity[.5], Cuboid[]}, Divergence -> .33]
Out[31]=
Image

Possible Issues (2) 

Since axes, ticks and labels are displayed dynamically based on the current view, they may not always line up in the two images:

In[32]:=
ResourceFunction["Stereogram3D"][
 ParametricPlot3D[{Cos[u], Sin[u] + Cos[v], Sin[v]}, {u, 0, 2 \[Pi]}, {v, -\[Pi], \[Pi]}], ViewAngle -> 20 Degree]
Out[32]=
Image

Axes can be disabled to avoid inconsistent images:

In[33]:=
ResourceFunction["Stereogram3D"][
 ParametricPlot3D[{Cos[u], Sin[u] + Cos[v], Sin[v]}, {u, 0, 2 \[Pi]}, {v, -\[Pi], \[Pi]}], ViewAngle -> 20 Degree, Axes -> False]
Out[33]=
Image

Neat Examples (3) 

Convert the 3D graphics in a demonstration to stereogram views (a fancier video version can be seen here):

In[34]:=
ResourceData[
  "Demonstrations Project: Rotating the Hopf Fibration"] /. gfx : Graphics3D[___, ImageSize -> size_, ___] :> ResourceFunction["Stereogram3D"][gfx, Divergence -> 0.1, ImageSize -> 0.6 size]
Out[34]=
Image

View the anaglyph instead (updating will be slower):

In[35]:=
ResourceData[
  "Demonstrations Project: 4D Rotations of a Klein Bottle"] /. gfx_Show :> ResourceFunction["Stereogram3D"][gfx, "Anaglyph", Divergence -> .42]
Out[35]=
Image

Make an awesome dinosaur movie:

In[36]:=
dinosaur = ExampleData[{"Geometry3D", "Triceratops"}]
Out[36]=
Image
In[37]:=
frames = ParallelTable[
   ResourceFunction["Stereogram3D"][dinosaur, "Anaglyph", SphericalRegion -> True, ViewAngle -> 18 \[Degree], ViewPoint -> {2.7 Cos[t], 2.7 Sin[t], 2}], {t, 0, 2 Pi, 2 Pi/100}];
In[38]:=
Export["AwesomeDinosaur.mp4", frames]
Out[38]=
Image

Grab some popcorn, put on your 3D glasses and enjoy the movie:

In[39]:=
Video["AwesomeDinosaur.mp4"]
Out[39]=
Image

Version History

  • 1.0.0 – 19 October 2020

Related Resources

License Information