Author: Greg Hammett
Views : 171
Description: example of lack of shading in 3D plot in CoCalc
Compute Environment: Ubuntu 18.04 (Deprecated)

I'm trying to figure out how to get shading and light reflection on 3D surfaces working properly, as needed for professional quality 3D images. This works at sagecell.sagemath.org, and appears to work in a sample figure in the documentation, but doesn't work right at CoCalc.com.

This is a plotting example from

http://doc.sagemath.org/html/en/reference/plot3d/sage/plot/plot3d/plot3d.html

You can search for "cylinder" to find the example. That example says that executing these two lines:

    theta,z=var('theta,z')
cylindrical_plot3d(2,(theta,0,3*pi/2),(z,-2,2))


should produce the figure:

![](./Figs/Jmol_orig.png "3D cylindrical surface with shading")

This is a good figure with shading used to help give it a 3D feel. This shading appears to be based on a light source behind and to the left of the viewer. This figure can be reproduced exactly at sagecell.sagemath.org, as you can see at

[SageMathCell 3D plotting example](http://sagecell.sagemath.org/?z=eJwryUgtSdSpsi1LLNJQL4Fw1DV5uZIrczLzUooykxNz4gty8kuMUzSMdDQgCgx0jLUKMvWNNHU0qnR0jXSMNDUBYfkWDQ==&lang=sage)

# Here are the same 2 commands executed in CoCalc.com.  The
# result is an image with no shading (except for slightly darker
# vertical stripes in the middle of the cylinder):
_=var('theta,z')
cylindrical_plot3d(2,(theta,0,3*pi/2),(z,-2,2))

3D rendering not yet implemented
show(cylindrical_plot3d(2,(theta,0,3*pi/2),(z,-2,2)), viewer="tachyon")

# Interesting that the above command works if the viewer option is given to "show",
# but not if it is given directly to "cyclindrical_plot3d", as shown next,
# where the viewer option is ignored and it always reverts to this vanilla default
# viewer without shading (but it does support rotation):
#
cylindrical_plot3d(2,(theta,0,3*pi/2),(z,-2,2),viewer="tachyon")

3D rendering not yet implemented
# other viewers not presently implemnted in CoCalc:
#show(cylindrical_plot3d(2,(theta,0,3*pi/2),(z,-2,2)), viewer="jmol")

#show(cylindrical_plot3d(2,(theta,0,3*pi/2),(z,-2,2)), viewer="canvas3d")

#show(cylindrical_plot3d(2,(theta,0,3*pi/2),(z,-2,2)), viewer="threejs")

show(cylindrical_plot3d(2,(theta,0,3*pi/2),(z,-2,2)), viewer="tachyon")

show(cylindrical_plot3d(2,(theta,0,3*pi/2),(z,-2,2)), viewer="tachyon", light=((10,3,2), 0.2, (1,1,1)))