0
$\begingroup$

I'm trying to show a .obj model in Mathematica, with its bounding box and a couple of spheres representing the bounding box center and the model center.

This is the imported model (tank was previously imported with Import command on a .obj file):

tankPlot = 
 Graphics3D[{Gray, EdgeForm[None], tank}, Boxed -> True, 
  BoxStyle -> Directive[Dashed, Orange, Thickness[0.01]], 
  Lighting -> "Neutral", 
  ViewPoint -> {2.0293656000931466`, 2.2128267128703496`, 
    1.5604721080384572`}]

enter image description here

Now I want to add two black spheres and make the model transparent, so I can show the two centers. This is my code:

tankPlot2 = Graphics3D[
  {
   {
    Black,
    PointSize[Large],
    Sphere[{0.0, 0.0, 0.0}, 0.2],
    Sphere[{0.0, 0.0, 2.0}, 0.2]
    },
   {
    Gray,
    EdgeForm[None],
    Opacity[0.03],
    tank
    }
   },
  Boxed -> True,
  BoxStyle -> Directive[Dashed, Orange, Thickness[0.01]],
  Lighting -> "Neutral",
  ViewPoint -> {2.0293656000931466`, 2.2128267128703496`, 
    1.5604721080384572`},
  PlotRange -> Full
  ]

This is the result:

enter image description here

As you can see, the bottom sphere is not shown properly: some of its parts are hidden by the tank model even if it's transparent.

Is there a way to fix this opacity issue and show the sphere properly?

I'm using Mathematica 12.

$\endgroup$
  • 1
    $\begingroup$ On Windows, I had some opacity problems with graphics primitives due to a reported bug (CASE:4260146) as mentioned here. I was able to workaround in my case by replacing the primitives with ContourPlot3D. The problem appeared to be Windows specific. $\endgroup$ – Tim Laska Nov 7 '19 at 13:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.