Dynamic ClipPlanes calculated from current ViewPoint

I think this may be the behavior you desire. I am borrowing Kuba's modified ClipPanes specification. One should not need RawBoxes here I think but it does serve the purpose to get our Dynamic expression into the Front End box form.

DynamicModule[{vp},
  {vp} = Options[Graphics3D, ViewPoint][[All, 2]];
  Graphics3D[{FaceForm[Red, Blue], Sphere[]},
    Axes -> True,
    ViewPoint -> Dynamic[vp],
    ClipPlanes -> RawBoxes @ Dynamic @ {{Sequence @@ Cross[vp, {0, 0, 1}], 1}}, 
    ClipPlanesStyle -> Directive[Opacity[.2], Blue]
  ]
]

enter image description here

In Evaluation leak from Dynamic in Button's action John Fultz writes with fair authority:

Front end options, which includes all box options, can take Dynamic heads. That basically means that the FE will compute the value of the Dynamic and use it for the option. And that it will be updated whenever a Dynamic dependency updates.

Since:

  1. Graphic3D expression is transformed into a Graphics3DBox (as may be viewed with menu command Cell > Show Expression)
  2. ClipPlanes remains as an option therein

it stands to reason that this must work if we can keep our Dynamic option value unmolested, and RawBoxes serves to do that.


Skip that and go upvote Mr.Wizard's answer :-)


I don't know much about rendering of Graphics3D by FrontEnd, but I'd expect ClipPlanes to accept Dynamic setting. GraphicsBox3D stays the same after changing it so it seems it is a FrontEnd which handles it anyway.

It is not the case but we can deal with that problem.

  • we need Dynamic @ Graphics3d
  • we need to send info about ViewPoint changes different way than Graphics3D is returned to not choke things. That's why the outer Dynamic is a-Synchronous

Not perfect but don't know how to make it better

(changed ClipPlanes to make them more visible)

DynamicModule[{vp}, 
 {vp} = Options[Graphics3D, ViewPoint][[All, 2]];
 Dynamic[
  Graphics3D[{FaceForm[Red, Blue], Sphere[]}, Axes -> True, 
   ViewPoint -> Dynamic[vp], 
   ClipPlanes -> {{Sequence @@ Cross[vp, {0, 0, 1}], 1}}, 
   ClipPlanesStyle -> Directive[Opacity[.2], Blue],
   SphericalRegion -> True],
  SynchronousUpdating -> False
  ]]

enter image description here