• Stars
    star
    142
  • Rank 256,461 (Top 6 %)
  • Language
    C#
  • License
    MIT License
  • Created about 5 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Capture a screenshot with effect and display it. Light-weight, non-realtime, no-camera (and no-PostProcessingStack), but be effective enough. The captured snapshot can be used as a background for a UI panel.

UIEffect Snapshot

Capture a screenshot with effect and display it.
Light-weight, non-realtime, no-camera (and no-PostProcessingStack), but be effective enough.
The captured snapshot can be used as a background for a UI panel.

PRs Welcome

<< Description | Demo | Installation | Usage | Change log >>





Description

Do you like blurred backgrounds, like iOS home screen? Blurring effect is easy to implement in Unity.

Alternatively, you can use PostProcessingStack package.

However, this method requires some caution to be used as a UI.

  • You'll need a camera and canvas for the blur effect
  • Screen Space - Overlay is not supported.
  • (Especially in mobile,) GrabPass is expensive

This package uses static screen content of one frame instead of real-time screen content to provide a very light screen blur.

The movement will disappear from the background, but it will be enough to use it as a background for panels, dialog windows and menus.

Objects that are further back than the background are (consequently) invisible.
Disabling their animations or hiding them would improve performance and power consumption.

Features

  • Easy to use: the package is out-of-the-box!
  • Light weight design:
    • Non realtime capturing.
    • Support for mobile.
    • No extra camera and PostProcessingStack are needed.
  • Support render mode: Screen Space - Overlay and Screen Space - Camera
  • Effect Mode: Grayscale, Sepia, Nega, Pixelation
  • Color Mode: Multiply, Fill, Additive, Subtract
  • Blur Mode: Fast Blur, Medium Blur, Detail Blur
  • Global Mode: Capture a screenshot in cases where there is no UIEffectSnapshot instance.
  • Capture On Enable: When the component is enable, capture screen automatically.
  • Fit to screen: Fit the RectTransform to the screen.
  • Menus to create object
  • Support custom effect materials.
    • Built-in custom effects: Vignette, Distortion, Noise, Scanning line, RGB Shift
    • Apply any image effect as you like.
  • Support Universal Render Pipeline

Future Plans

  • Support render mode: World Space - Camera
  • Support pre-generated RenderTexture as result





Demo





Installation

Requirement

  • Unity 2018.3 or later

Using OpenUPM

This package is available on OpenUPM.
You can install it via openupm-cli.

openupm add com.coffee.ui-effect-snapshot

Using Git

Find the manifest.json file in the Packages folder of your project and edit it to look like this:

{
  "dependencies": {
    "com.coffee.ui-effect-snapshot": "https://github.com/mob-sakai/UIEffectSnapshot.git",
    ...
  },
}

To update the package, change suffix #{version} to the target version.

  • e.g. "com.coffee.ui-effect-snapshot": "https://github.com/mob-sakai/UIEffectSnapshot.git#1.0.0",

Or, use UpmGitExtension to install and update the package.





Usage

UIEffectSnapshot

  • This is a component to capture a screenshot with effects and display it.
  • Select Game Object/UI/Effect Snapshot to create.
  • Adjust the capture effect and press the Capture or Release button in the inspector to preview the snapshot.
Properties Screenshot
Effect Mode: Grayscale, Sepia, Nega, Pixelation
Color Mode: Multiply, Fill, Additive, Subtract
Blur Mode: Fast, Medium, Detail

Custom Materials: Additional image effect material. The built-ins include Vignette, Distortion, Noise, Scanning line, RGB Shift.
Global Mode: Use a global image instead of an instance image.
Capture On Enable: When the component is enable, capture screen automatically.
Fit To Screen: Fit transform to the root canvas on enable/captured.

Reduction Rate: Reduce the size of the intermediate buffer used to render effects.
Down Sampling Rate: Reduce the size of the result RenderTexture.

Script usage

// Add UIEffectSnapshot instance at runtime.
uiEffectSnapshot = gameObject.AddComponent<UIEffectSnapshot>();

// Capture a screenshot for instance.
uiEffectSnapshot.Capture(callback: request => { Debug.Log("Captured"); });

// Capture a screenshot for global.
// You can capture screen in cases where there is no UIEffectSnapshot instance.
// The captured image will be used with 'Global Mode' instance.
// Or, you can use 'UIEffectSnapshot.globalCapturedTexture' property to get it.
UIEffectSnapshot.CaptureForGlobal(callback: request => { Debug.Log("Captured"); });

Built-in custom material usage

  1. Click New button in inspector and save the material into the project.
  2. The generated material is automatically set as a property. Adjust the functions and values of the material.
  3. Press Capture button to preview the custom effect.



UIEffectSnapshotPanel

  • This is a component for easy control of a panel with snapshot background/panel.
  • Select Game Object/UI/UI Effect Snapshot Panel/*** to create a panel with snapshot preset.
  • Press the Show or Hide button in the inspector to preview the snapshot.
Properties Screenshot
Snapshots: UIEffectSnapshot instances to control. Press Refresh button to set children snapshots.
Transition Duration: Duration of show/hide transition.
Show On Enable: When the component is enable, show the panel automatically.
Deactivate On Hidden: When the component is hidden, deactivate the gameObject automatically.

Script usage

// Show/Hide the panel with snapshot.
// Before capturing, CanvasGroup.alpha will be set to 0 and capture the screen except for the panel.
panel.Show(callback: request => { Debug.Log("Shown"); });
panel.Hide(callback: request => { Debug.Log("Hidden"); });





How to play demo

For Unity 2019.1 or later

  1. Open Package Manager window
  2. Select UI Effect Snapshot package in package list
  3. Click Import Sample button
  4. The demo project is imported into Assets/Samples/UI Effect Snapshot/{version}/Demo
  5. Open UIEffectSnapshot_Demo scene and play it

For Unity 2018.4 or earlier

  1. Select Assets/Samples/UI Effect Snapshot Demo from menu
  2. The demo project is imported into Assets/Samples/UI Effect Snapshot/{version}/Demo
  3. Open UIEffectSnapshot_Demo scene and play it

For Universal Render Pipeline environment

  1. Find RotationCube.mat in Assets and select all sub-assets.
  2. Change the shader of materials to Universal Render Pipeline/Lit.





Contributing

Issues

Issues are very valuable to this project.

  • Ideas are a valuable source of contributions others can make
  • Problems show where this project is lacking
  • With a question you show where contributors can improve the user experience

Pull Requests

Pull requests are, a great way to get your ideas into this repository.
See CONTRIBUTING.md.

Support

This is an open source project that I am developing in my spare time.
If you like it, please support me.
With your support, I can spend more time on development. :)






License

  • MIT

Author

mob-sakai

See Also

More Repositories

1

UIEffect

UIEffect is an effect component for uGUI element in Unity. Let's decorate your UI with effects!
C#
5,584
star
2

ParticleEffectForUGUI

Render particle effect in UnityUI(uGUI). Maskable, sortable, and no extra Camera/RenderTexture/Canvas.
C#
4,182
star
3

SoftMaskForUGUI

Enhance Unity UI (uGUI) with advanced soft-masking features to create more visually appealing effects!
C#
1,973
star
4

UnmaskForUGUI

A reverse masking solution for uGUI element in Unity.
C#
811
star
5

UpmGitExtension

This package extends the UI of Unity Package Manager (UPM) for the packages installed from git repository.
C#
764
star
6

ShinyEffectForUGUI

Shiny effect of uGUI, which does not need mask or normal map.
C#
380
star
7

CSharpCompilerSettingsForUnity

Change the C# compiler (csc) used on your Unity project, as you like!
C#
287
star
8

GitDependencyResolverForUnity

This plugin resolves git url dependencies in the package for Unity Package Manager. You can use a git url as a package dependency!
C#
249
star
9

StaticBluredScreen

Non-realtime (=static) screen blur for Unity. Easy to use background for dialogs.
C#
189
star
10

MeshEffectForTextMeshPro

Mesh effect components for TextMeshPro in Unity.
C#
153
star
11

CompositeCanvasRenderer

CompositeCanvasRenderer bakes multiple source graphics into a bake-buffer (RenderTexture) and renders it. Additional material modification, mesh modification, and baking effects are supported! Let's enjoy the effects that were difficult to implement with UI shaders, such as blur, soft outline, and soft shadow!
C#
136
star
12

AtlasImage

AtlasImage is a graphic component use SpriteAtlas for uGUI. In addition, add useful sprite selector and border editor to the inspector.
C#
130
star
13

MirrorReflectionEffectForUGUI

A simple mirror reflection effect for a uGUI without reflection probes or shaders.
C#
118
star
14

DissolveEffectForTMPro

DissolveEffectForTMPro provide dissolve effect component for TextMeshPro in Unity.
C#
109
star
15

SubAssetEditor

Editor for SubAsset in unity project.
C#
106
star
16

OpenSesameCompilerForUnity

A Roslyn compiler to access internals/privates for Unity. In other words, you can access to any internals/privates in other assemblies, without reflection. Let's say, "Open sesame!"
C#
102
star
17

ProjectBuilder

A tool for easy automating and customizing build process for Unity.
C#
97
star
18

UnityEventDrawerEx

This plugin extends the UnityEventDrawer to display runtime calls in the inspector.
C#
94
star
19

ShinyEffectForTMPro

ShinyEffectForTMPro provide shiny effect component for TextMeshPro in Unity.
C#
93
star
20

UIMaterialPropertyInjector

This package provides a component that allows easy modification/animation of material properties for Unity UI (uGUI) without the need for shader-specific custom components.
C#
91
star
21

unity-activate

A tool to activate Unity license.
TypeScript
84
star
22

DissolveEffectForUGUI

A dissolve effect for uGUI, without material instancing. Please star and watch this project :)
C#
79
star
23

UITransition

C#
56
star
24

CompositeToggle

Composite toggle system for unity
C#
46
star
25

ButtonEx

C#
44
star
26

BlurringAtlasForUGUI

A blur effect for uGUI in Unity, that is effective even for atlas images including dynamic fonts.
C#
42
star
27

docker-unity

New series of CI-specialised docker images for Unity. Superseding the famous gableroux/unity3d images.
Dockerfile
34
star
28

SymbolCatalog

A tool for edit script symbol define for Unity.
C#
34
star
29

MainWindowTitleModifierForUnity

A demo to change the text displayed in UnityEditor's title bar
C#
32
star
30

unity-changeset

Get/List Unity editor changeset
TypeScript
31
star
31

OpenSesame

A custom Roslyn compiler that allows access to internals/privates in other assemblies. Say "Open, Sesame!"
C#
30
star
32

SimpleBuildInterface

A simple build interface for Unity CLI. Support all platforms without executeMethod option.
C#
25
star
33

RotateMe

Rotate the object. (This repo is a tutorial for "How to develop a package for UnityPackageManager")
Shell
24
star
34

unity.package-manager.metadata

Contains metadata used by the com.unity.package-manager package to fulfill client requests
Shell
24
star
35

InternalAccessibleCompilerForUnity

Compile a c# project to a internal accessible dll (for Unity)
C#
22
star
36

UISystem

C#
20
star
37

ScrollEx

C#
16
star
38

AssetSystem

C#
15
star
39

UnityBuiltinShaders

Unity's built-in shaders.
15
star
40

VertexTextureFetchForUGUI

C#
11
star
41

InternalAccessibleCompiler

Compile a c# project to a internal accessible dll
C#
8
star
42

UniIx

Interactive Extensions for Unity for Unity
C#
7
star
43

JobcanExtensionForChrome

JavaScript
7
star
44

Demos

6
star
45

git-snapshot

git-snapshot is a command-line tool to take a snapshot of the directory and creates/updates another branch, like git subtree split --squash.
JavaScript
5
star
46

Coffee.Internal

Tools and snippets for package development
C#
5
star
47

unity-changeset-action

[GitHub Action] Get Unity editor change set for specific version
JavaScript
5
star
48

AtlasSystem

Atlas system for Unity
C#
4
star
49

UnityAdventCalendar2021

https://qiita.com/items/37978a030d6a6e262065
C#
3
star
50

ApiSystem

C#
3
star
51

mob-sakai.github.io

3
star
52

mob-sakai

2
star
53

unity-list-action

[GitHub Action] Get Unity editor versions for next jobs
JavaScript
2
star
54

actionsflow-workflow-test

2
star
55

UnityGitDependencyTest

A test repo for GitDependencyResolverForUnity
C#
1
star