Difference between revisions of "IC Python API:Camera Dolly Zoom"
From Reallusion Wiki!
Chuck (RL) (Talk | contribs) m (→Usage Instructions) |
Chuck (RL) (Talk | contribs) m (→Required Files) |
||
(10 intermediate revisions by the same user not shown) | |||
Line 4: | Line 4: | ||
== Demo Video == | == Demo Video == | ||
+ | {{#evt: | ||
+ | service=youtube | ||
+ | |id=https://www.youtube.com/watch?v=CkUimGI1hLc | ||
+ | }} | ||
== Description == | == Description == | ||
− | + | [[File:Ic_python_api_camera_dolly_zoom_01.gif|frame|left]] | |
− | {{clear}} | + | Dolly Zoom is an in-camera effect that utilizes perspective distortion to make the background appear as if it’s changing its size relative to the subject. The visual appearance for the viewer is that either the background suddenly grows in size and detail to overwhelm the foreground, or the foreground becomes immense and dominates the previous setting, depending on which way the dolly zoom is executed. This script simulates the Dolly Zoom effect by animating the camera's Focal Length and positioning according to the current camera settings and the desired Focal Length. Automatic Depth of Field on the target object is an optional setting.{{clear}} |
== Course Prerequisites == | == Course Prerequisites == | ||
Line 15: | Line 19: | ||
You should familiarize yourself with the following fundamental articles before you proceed: | You should familiarize yourself with the following fundamental articles before you proceed: | ||
− | + | {|class="wikitable | |
− | + | !Link | |
− | + | !Purpose | |
− | + | |- | |
− | + | |[[ iC_Python_API:Object_Type | Object Type ]] | |
+ | |Return the object type for the first selected object. | ||
+ | |- | ||
+ | |[[ iC_Python_API:Message_Box | Message Box ]] | ||
+ | |Create notifications and warning messages in iClone. | ||
+ | |- | ||
+ | |[[ iC_Python_API:Item_Lister | Item Lister ]] | ||
+ | |Learn how to validate objects for listing and removal. | ||
+ | |- | ||
+ | |[[ iC_Python_API:Dialog_Callbacks | Dialog Callbacks ]] | ||
+ | |Understand dialog callbacks at a deeper level. | ||
+ | |- | ||
+ | |[[ iC_Python_API:Local_Move | Local Move ]] | ||
+ | |Use matrix math to locally translate an object. | ||
+ | |} | ||
== Takeaway Lessons == | == Takeaway Lessons == | ||
− | *Calculate the dolly zoom effect with a | + | *Calculate the dolly zoom effect with a formula. |
− | * | + | *Translate an object in local-space. |
− | + | ||
== Required Files == | == Required Files == | ||
*Camera Dolly Zoom Python script | *Camera Dolly Zoom Python script | ||
− | *iClone scene with | + | *iClone scene with select-able props or characters, preferably in a setting filled with background objects. |
+ | You can download this plugin from the [https://marketplace.reallusion.com/camera-dolly-zoom Reallusion Marketplace]. | ||
+ | To acquire and view the source code, please visit [https://github.com/reallusion/iClone/tree/master/Camera_Dolly_Zoom Reallusion GitHub]. | ||
== Usage Instructions == | == Usage Instructions == | ||
Line 43: | Line 62: | ||
== Code Flow == | == Code Flow == | ||
− | #The current viewing camera is the currently driven camera. | + | #The current viewing camera is the currently driven camera. This camera can not be the '''default''' camera, therefore must be made from scratch. |
− | #The current | + | #The current object selected is the Focal Length target and the first item in multiple selection is designated as the target. Only props and characters are allowed. |
− | #Adjust the parameters such as | + | #Adjust the parameters such as the '''Frame Duration''', '''Target Focal Length''', and '''Set DOF Key''' (optional). |
− | # | + | #Once the user pressed the '''Key Dolly Zoom''' button, the final distance and Focal Length values will be calculated. |
− | # | + | #Focal Length keys are created taking into account the starting Focal Length value, viewing distance, and the parameter settings. |
− | + | ||
− | [[File: | + | [[File:Ic_python_api_camera_dolly_zoom_02.png]] |
=== APIs Used === | === APIs Used === |
Latest revision as of 19:38, 19 February 2020
- Main article: RL Python Samples.
Demo Video
Description
Dolly Zoom is an in-camera effect that utilizes perspective distortion to make the background appear as if it’s changing its size relative to the subject. The visual appearance for the viewer is that either the background suddenly grows in size and detail to overwhelm the foreground, or the foreground becomes immense and dominates the previous setting, depending on which way the dolly zoom is executed. This script simulates the Dolly Zoom effect by animating the camera's Focal Length and positioning according to the current camera settings and the desired Focal Length. Automatic Depth of Field on the target object is an optional setting.Course Prerequisites
You should familiarize yourself with the following fundamental articles before you proceed:
Link | Purpose |
---|---|
Object Type | Return the object type for the first selected object. |
Message Box | Create notifications and warning messages in iClone. |
Item Lister | Learn how to validate objects for listing and removal. |
Dialog Callbacks | Understand dialog callbacks at a deeper level. |
Local Move | Use matrix math to locally translate an object. |
Takeaway Lessons
- Calculate the dolly zoom effect with a formula.
- Translate an object in local-space.
Required Files
- Camera Dolly Zoom Python script
- iClone scene with select-able props or characters, preferably in a setting filled with background objects.
You can download this plugin from the Reallusion Marketplace. To acquire and view the source code, please visit Reallusion GitHub.
Usage Instructions
- Clone or download the Reallusion/iClone GitHub.
- Copy Camera_Dolly_Zoom folder into the iClone install directory > ...\Bin64\OpenPlugin.
- Load the script into the project from the menu: Plugins > Python Samples > Camera Dolly Zoom.
- Create a new camera and pick an item in the scene.
- Adjust the settings and press the Key Dolly Zoom button.
Code Flow
- The current viewing camera is the currently driven camera. This camera can not be the default camera, therefore must be made from scratch.
- The current object selected is the Focal Length target and the first item in multiple selection is designated as the target. Only props and characters are allowed.
- Adjust the parameters such as the Frame Duration, Target Focal Length, and Set DOF Key (optional).
- Once the user pressed the Key Dolly Zoom button, the final distance and Focal Length values will be calculated.
- Focal Length keys are created taking into account the starting Focal Length value, viewing distance, and the parameter settings.
APIs Used
You can research the following references for the APIs deployed in this code.
- RLPy.RMatrix4()
- RLPy.RPyTimerCallback.__init__()
- RLPy.RDialogCallback.__init__()
- RLPy.RScene.GetCurrentCamera()
- RLPy.RGlobal.GetTime()
- RLPy.RScene.GetSelectedObjects()
- RLPy.RGlobal.SetTime()
- RLPy.RTime()
- RLPy.RUi.ShowMessageBox()
- RLPy.RGlobal.GetFps()
- RLPy.RTime.GetFrameIndex()
- RLPy.RVector3()
- RLPy.RVariant()
- RLPy.RKey()
- RLPy.RGlobal.Play()
- RLPy.RUi.CreateRDialog()
- RLPy.RPyTimer()
- RLPy.RUi.GetMainWindow()
- RLPy.RUi.AddMenu()