Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Convert an ordinary Graphics3D object to a sketch-styled raster image
ResourceFunction["Graphics3DSketch"][expr] converts expr to a sketch-styled raster image. | |
ResourceFunction["Graphics3DSketch"][expr,f] converts expr to a sketch-styled raster image, applying f to lines that are obscured. |
"DashStyle" | {Dashing[0.01], AbsoluteThickness[2]} | style to use for obscured lines |
Create a Graphics3D expression with various primitives (supported types include Polygon, Cuboid, Cone, Cylinder, Sphere, etc.):
In[1]:= | ![]() |
Out[1]= | ![]() |
Graphics3DSketch will convert all obscured lines to dashed lines:
In[2]:= | ![]() |
Out[2]= | ![]() |
An additional image effect function can be used on lines in "shadow region":
In[3]:= | ![]() |
Out[3]= | ![]() |
Graphics3D expressions generated by various 3D-plotting functions can be fed into Graphics3DSketch directly:
In[4]:= | ![]() |
Out[4]= | ![]() |
In[5]:= | ![]() |
Out[5]= | ![]() |
Any image effect can be used on the "shadow region". It will only affect the style of lines:
In[6]:= | ![]() |
Out[6]= | ![]() |
In[7]:= | ![]() |
Out[7]= | ![]() |
In[8]:= | ![]() |
Out[8]= | ![]() |
In[9]:= | ![]() |
Out[9]= | ![]() |
Create a base graphic:
In[10]:= | ![]() |
The option "DashStyle"→{style1,style2,…} can be given to alter the style of the lines in the "shadow region":
In[11]:= | ![]() |
Out[11]= | ![]() |
In[12]:= | ![]() |
Out[12]= | ![]() |
The option Lighting can be given to alter the simulated lighting used for coloring the 3D surfaces:
In[13]:= | ![]() |
Out[13]= | ![]() |
In[14]:= | ![]() |
Out[14]= | ![]() |
The result of Graphics3DSketch is a raster image rather than an interactive 3D object:
In[15]:= | ![]() |
Out[15]= | ![]() |
Due to the image-processing-based working principle of Graphics3DSketch, lines in the "shadow region" are not necessarily hidden in the 3D rendering sense:
In[16]:= | ![]() |
Out[16]= | ![]() |
This work is licensed under a Creative Commons Attribution 4.0 International License