Overview
Overview
If you happen to follow the Grammys, you may know of the Glambot. The Glambot makes a fast-moving crane shot that quickly zooms in on the celebrity on the stand to make a fabulous slow-motion video; here is a YouTube video with a collection of these shots. In order to let 3D graphics feel as fabulous as Ariana Grande, I set out on a quest to recreate this camera motion around any 3D graphics of choice. However, getting to know the ins and outs of video animations and getting the perfect graphic can be confusing. In addition to recreating the Glambot, I will clarify key view options and their applications.
Graphics3D View Options
Graphics3D View Options
If you look for the options for Graphics3D in the documentation, you may notice that there are eight view options: ViewAngle, ViewCenter, ViewMatrix, ViewPoint, ViewProjection, ViewRange, ViewVector, and ViewVertical. For my purposes, ViewVector, ViewPoint, ViewAngle, and ViewCenter are particularly useful.
For those not familiar with these four options, here are the definitions from the documentation:
◼
ViewVector: “Specifies the position and direction of a simulated camera used to view three-dimensional objects.”
◼
ViewPoint: “Views the point in space from which three-dimensional objects are to be viewed.”
◼
ViewCenter: “Gives the scaled coordinates of the point which should appear at the center of the final image.”
◼
ViewAngle: “Gives the opening angle for a simulated camera used to view the three-dimensional scene.”
After reading these definitions, you may wonder why ViewVector exists when you can just specify ViewCenter and ViewPoint, or vice versa. To answer this question, I’m going to use a sample “room”:
walls=ParametricPlot3D[{{a,b,-20},{a/2,b,-19.9},{a,b,20},{a,-20,b},{a,20,b},{-20,a,b},{20,a,b}},{a,-20,20},{b,-20,20},PlotStyle->Flatten[{Black,RGBColor[0.6,0.02,0.],Table[Directive[White,Opacity[0.3]],5]}],Mesh->False];b=Graphics3D[{EdgeForm[None],Directive[LightGray,Specularity[White,10]],ExampleData[{"Geometry3D","Beethoven"},"GraphicsComplex"],Directive[RGBColor[0.6,0.02,0.],Specularity[White,5]],Cylinder[{{0,0,-20},{0,0,-6}},5]}];wall=ExampleData[{"Geometry3D","CastleWall"}][[1,2]];w=Graphics3D[{Directive[Black,Specularity[White,10]],EdgeForm[None],GeometricTransformation[GeometricTransformation[wall,ScalingTransform[{0.02,0.02,0.02}]],TranslationTransform[{0,15,-20}]]}];cubeRoom=Show[walls,b,w,Ticks->None,PlotRange->All]
Out[]=
We would be sore out of luck if we wanted to go inside the room and look at Beethoven with only ViewPoint; the view frustum in ViewPoint will always contain the whole object. For those not familiar with that term, it is a pyramidal adaptation of the cone of vision. Here is what the frustum would be if the camera was at {0, 0, 40}:
r=25;h=40;Row@{Show[cubeRoom,Graphics3D[{FaceForm[Opacity[0.5]],Pyramid[{{r,r,20},{-r,r,20},{-r,-r,20},{r,-r,20},{0,0,h+20}}]}],PlotRange->All],Show[cubeRoom,ViewPoint->{0,0,h+20}]}
Out[]=
This means that no matter how close we are to Beethoven, we are going to see all the walls since that is technically part of the object:
Animate[Show[cubeRoom,ViewPoint->15{Sin[t],Cos[t],0}],{t,0,2Pi},SaveDefinitions->True,AnimationRunning->False]
Out[]=
However, with ViewVector this works just fine:
Animate[Show[cubeRoom,ViewVector->{15{Sin[t],Cos[t],0},{0,0,0}}],{t,0,2Pi},AnimationRunning->False,SaveDefinitions->True]
Out[]=
The other two view options that I listed above are ViewCenter and ViewAngle. By using ViewCenter with ViewPoint, you can get results pretty similar to ViewVector. But, again, ViewVector doesn’t always include the whole object so the perspective will be a bit different:
Finally, here is a quick animation to help visualize what ViewAngle does. This option can be used in conjunction with both ViewVector and ViewPoint/ViewCenter.
Overall, I have found that ViewPoint works best when I want a quick visualization; it works in most cases. However, in more detailed cases ViewVector provides a lot more control (with the plus side that you don’t need to separately specify ViewCenter).
Rotations
Rotations
Now, these can be applied in some simple visualizations! The first one will be a rotation around an object. Here is our camera path:
I’m going to use ViewVector here, but you could change the ViewPoint too (as long as your object isn’t trapped in a room). As you can see, we have a clean rotation!
But... what if you wanted to rotate around Skelvin on any axis? For that, we can use RotationTransform on a vector which is perpendicular to the axis of rotation. Here it is step-by-step:
First, we need to find our center of rotation. Because Skelvin is an anatomy object, a small workaround needs to be done to find its center:
I’m going to now use {1, 1, 1} as our sample axis of rotation. Our camera path is going to be the following:
Now that we have the path, we can do the (easier) step of making it into a video!
Finally, everything can go into one function! You may notice a variable called “test” being defined - that is so that you can see the camera path in case something doesn’t look right with the video.
“Glambot”
“Glambot”
Finally, time to make the Glambot. After some trial and error I made the camera path:
From there, I made the function:
Using any function
Using any function
As much as I love giving Beethoven the celebrity treatment he deserves, the Glambot won’t be useful for anything other than... being a Glambot. So, it can be generalized a bit to make it a bit more applicable for other purposes. Here is the function:
Now to try it out. Here is a cellular automaton that I took off of the documentation:
Now I will specify key points that I want the path to go through:
For our purposes, this is good enough. Now to make a quick function:
Which can easily be plugged into the first function:
Final Notes
Final Notes
Touring complex structures can be simplified with a few manipulations of functions and view options. Here is a summary of the key takeaways:
◼
Videos
◼
VideoGenerator actually makes a file in your computer, you can go into the folder where it is saved and look at/ use it
◼
Use functions for the ViewPoint/ViewVector to create interesting visualizations
◼
View Options
◼
ViewVector: a vector where {position, direction}, frustum does not need to include whole object
◼
ViewPoint: a point where the camera is looking at the object, frustum does include the whole object
◼
ViewCenter: where the camera is pointing at
◼
ViewAngle: the opening angle of the camera
◼
Either use ViewVector or ViewPoint/ViewCenter, do not use all at the same time
CITE THIS NOTEBOOK
CITE THIS NOTEBOOK
Glam-ifying 3D graphics: simple video animations and techniques
by Anika Patel
Wolfram Community, STAFF PICKS, June 7, 2023
https://community.wolfram.com/groups/-/m/t/2932299
by Anika Patel
Wolfram Community, STAFF PICKS, June 7, 2023
https://community.wolfram.com/groups/-/m/t/2932299