IC Python API:Camera Auto-Focus
Auto-Focus can be used to automatically calculate the Focus Distance and Focus Range for the current camera according to the viewing distance of a selected object. This script operates and updates in near real-time.
You should be familiarize yourself with the following fundamental articles before you proceed:
- Calculate single axis distance between two object (useful for finding Z-depth).
- Create and setting DOF keys on cameras.
- Create timer and handling timer callbacks.
- Auto-focus Python script
- iClone scene with select-able props or characters.
- Clone or download the Reallusion/iClone GitHub.
- Copy Auto-Focus folder into the iClone install directory > ...\Bin64\OpenPlugin.
- Load the script into the project from the menu: Plugins > Python Samples > Auto-Focus.
- Follow the instructions in the subsequent dialog window.
- The current viewing camera is the currently driven camera.
- The current selection is the DOF target, the first item in multiple selection is designated as the target.
- Adjust the parameters such as Auto-Distance and Auto-Range toggle and multiplier.
- The z-distance between the target prop from the current viewing camera is calculated.
- DOF key is created taking into account the depth distance value and the parameter settings.
- The created DOF key is set on the current viewing camera in near real-time.