# How to vary line thickness to add a sense of perspective?

Is there a simple way to vary the line thickness relative to the viewpoint so as to add a sense of perspective? Take for example the following:

Manipulate[
lines = Table[{RandomInteger[{-1, 1}] a, RandomInteger[{-1, 1}] a,
RandomInteger[{-1, 1}] a}, {2^a}];
Graphics3D[Line[lines], Boxed -> False], {a, 1, 12, 1}] which generates some lines projected in a 3-dimensional fashion with a clearly visible perspective i.e. the lines of similar length appears longer when closer to the viewer.

Since the information regarding apparent distance to the viewpoint is known to the system, it should be possible to retrieve this and modify the thickness of lines accordingly.

Is this possible in a simple manner? The sketch above illustrates my point, although somewhat clumsy.

• How about Tube instead of Line? – Michael E2 Aug 21 '14 at 18:37
• I have never heard of tubes. I will check them out. – MathLind Aug 21 '14 at 18:47
• Concerning "Since the information regarding apparent distance to the viewpoint is known to the system...": that is generally true of Mathematica but less so in the case of Graphics because the actual rendering is being done in the front end and not the kernel. – mfvonh Aug 21 '14 at 19:17
• Not exactly what you asked for, but since you want to make the 3D arrangement of lines easier to see, this previous question may be useful. – user484 Aug 21 '14 at 21:32

I agree with @MichaelE2, 3D rendered tube will improve 3D notion by light reflection via Specularity and plus some Opacity.

Manipulate[
lines = Table[{RandomInteger[{-1, 1}] a, RandomInteger[{-1, 1}] a,
RandomInteger[{-1, 1}] a}, {2^a}];
Graphics3D[{Orange, Opacity[.3], Specularity[White, 20],
Tube[lines, .05]}, Boxed -> False, Background -> Black], {{a, 7},
1, 12, 1}] 3D graphs are naturally rendered like that - note how coloring of edges changes during rotation:

Graph3D[RandomGraph[{39, 65}]] • Nice examples Vitaliy. However the first one does increase the calculation time about 100-fold, which makes turning the object almost impossible. At least on my computer. – MathLind Aug 22 '14 at 6:59
• @MathLind Try it without Opacity[0.3]. – Michael E2 Aug 22 '14 at 10:49
• @MichaelE2 Yes that made a huge difference. – MathLind Aug 22 '14 at 11:06