- Take screenshots with your desired size and position.
- Count down and flash light effect animation. (DOTween required)
- Chroma keying and basic brightness, contrast, and saturation adjustment with the help of ProcAmp by Keijiro, HSV Color Picker by judah4, and PlayerPrefsX by Eric Haines.
There are 3 sample scenes in this project:
- Test_PhotoTool takes a screenshot and display it on a GUI Raw Image.
- Test_PhotoAnim demonstrates how to set up simple count down and flash light animation.
- Test_Keying applies chroma keying and color adjustment onto textures.
π While the above scenes demonstrate how I use the scripts individually, UnityPhotoBooth is a complete photo booth game using all these scripts together. Please check it out if you need it.
- Set
startX
,startY
,width
, andheight
for the region you want to take screenshots with. You can view the region you've set by checkingDebug On GUI
.
Init()
initializes a Texture2D for screenshots with startX, startY, width, and height. There's also an overload functionInit(int _startX, int _startY, int _width, int _height)
for overriding the settings.TakePhoto()
takes a screenshot and apply it totex2d_photo
.OnPhotoTaken(tex2d_photo)
is called after the screenshot is taken.
- Drag some Transform components into the
countDownElements
array. These GameObjects will be used in the countdown animation, which is driven by a DOTween Sequence. - Type in
duration_countDown
(in seconds). It's the duration of eachcountDownElements
's scaling animation. - Assign a UI Image to
Img_shot
. It'll be used in a "flash" animation driven by DOTween, too.duration_shot
is the duration of the animation. - (Optional) You can also assign an AudioSource to
audio_shot
and it will be played with the flash animation.
Init()
MUST be called to initialize the DOTween tweeners/sequences.PlayCountDownAnim()
plays the countdown animation.OnCountDownFinish()
is called when the animation finishes.PlayShotAnim()
plays the flash light animation (along with theaudio_shot
sound effect if it's assigned).OnShotFinish()
is called when the animation finishes.
These scripts are used to control values on materials using ProcAmp shader.
- Assign a material using Klak/Video/ProcAmp shader to
keyingMaterial
- Type in
propertyName
eg. _KEYING, _Brightness. They are internally used by some functions such as Material.SetFloat and PlayerPref.SetFloat. - (Optional) If
btn_resetDefault
is assigned, value of the color picker, sliders, and toggle will be set to default whenbtn_resetDefault
is pressed. - (Optional) There is a Panel-Keying Prefab inside gm_PhotoTool/Prefab/Panel-Keying. It's a UI Panel which already contains a color picker, a toggle, and sliders. You can put it onto a UI Canvas and then set up values followng steps above.
This project uses Git submodule gm_PhotoTool. If you want to clone this reposiory, you need to call
git clone --recurse-submodules <URL>
MIT
This project uses ProcAmp by Keijiro and HSV Color Picker by judah4 to achieve chroma keying. Also uses PlayerPrefsX by Eric Haines to save colors with PlayerPrefs! πββοΈ