8
$\begingroup$

I would like to add a black outline (silhouette) all around a closed surface. Here's a MWE code to work with :

Manipulate[
    SphericalPlot3D[1, {theta, 0, Pi}, {phi, t, 2Pi + t},
        Mesh -> {7, 7},
        MaxRecursion -> ControlActive[2, 5],
        PlotRange -> All,
        Boxed -> False,
        Axes -> None,
        SphericalRegion -> True,
        Method -> {"RotationControl" -> "Globe"},
        ImageSize -> {500, 500}
    ],
    {{t, 0, Style["t", 10]}, 0, 2Pi, 0.01}
]

So is it possible to draw a thin line all around that sphere, to make it standing out of the white background ?

EDIT : By "outline" (or "silhouette", or "profile"), I mean some curve like the circle around the ball shown below (the outline should be made for any surface, not just for the sphere defined in the code above !)

a sphere with an outline

The outline should be drawn around the whole surface's exterior, and don't apply to parts inside the surface (except if it has holes).

$\endgroup$
14
  • $\begingroup$ An incredibly stupid and impractical hack that works in this case (of a perfect sphere) would be adding a Prolog -> Inset[Graphics[Disk[], ImageSize -> 300]]] as an option. Some sort of Inset solution might actually be of use even on the final solution. $\endgroup$
    – kirma
    Mar 8, 2016 at 17:17
  • 1
    $\begingroup$ If you draw a black outline around the whole surface of the sphere, you will not be able to see the sphere. $\endgroup$
    – bill s
    Mar 8, 2016 at 18:06
  • 3
    $\begingroup$ It will be hard to make responsive general solution, here's something closely related: Sketch-type graphics with transparency and dashed hidden lines? $\endgroup$
    – Kuba
    Mar 8, 2016 at 19:58
  • 1
    $\begingroup$ About the drop shadow idea : mathematica.stackexchange.com/questions/938/… $\endgroup$
    – Cham
    Mar 8, 2016 at 20:59
  • 1
    $\begingroup$ @MarcoB, I'm giving up the outline idea because it will certainly not work with my old version 7, or it will have a very high impact on performances under a Manipulate box. The shadow codes don't work for me. $\endgroup$
    – Cham
    Mar 9, 2016 at 13:20

1 Answer 1

3
$\begingroup$

Although, this may not be the best answer. I thought I post it for fun.

Input:

core = {Red, Sphere[{0, 0, 0}, 1.9]};
outline = {Yellow, Opacity[0.5], Sphere[{0, 0, 0}, 2]};

Graphics3D @ {core, outline}

Output:

output example

EDIT:

Alternatively, you could probably mess around with lighting property. Here is an example:

sphere1 = Graphics3D[core, Lighting -> {{"Ambient", White}}];
sphere2 = Graphics3D[outline];

Show[sphere1, sphere2]

And the output of this would be something like:

output2

EDIT:

Some additional way how to modify edges:

Graphics3D[{EdgeForm[{Thick, Black}], 
    FaceForm[White], #}] & /@ {Cuboid[], 
  Polygon[{{1, 0, 0}, {1, 1, 1}, {0, 0, 1}}]}

With the associated output:

output 3

Reference:

Sphere
Graphics3D
Opacity

$\endgroup$
14
  • $\begingroup$ What would you do if you want a black outline ? The transparency trick will not work in this case. You may have to duplicate the surface, one in full black, behind the normal surface, but then there will be a problem of intersection and depth sorting... $\endgroup$
    – Cham
    Mar 11, 2016 at 20:01
  • $\begingroup$ I am afraid my WPL skills aren't at that level to deliver what you've requested in your original post. The only reason why I've added this solution is to share my ideas in relation to your question. $\endgroup$ Mar 11, 2016 at 20:48
  • $\begingroup$ Just for curiosity, what is WPL ? $\endgroup$
    – Cham
    Mar 11, 2016 at 20:54
  • $\begingroup$ Wolfram programming language $\endgroup$ Mar 11, 2016 at 21:10
  • $\begingroup$ The last edit appears to be highly interesting. I don't have access to Mathematica right now, and I can't wait to try this code (EdgeForm and FaceForm). $\endgroup$
    – Cham
    Mar 11, 2016 at 21:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.