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]
]
]
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 theDynamic
and use it for the option. And that it will be updated whenever aDynamic
dependency updates.
Since:
Graphic3D
expression is transformed into aGraphics3DBox
(as may be viewed with menu command Cell > Show Expression)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 thanGraphics3D
is returned to not choke things. That's why the outerDynamic
isa-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
]]