You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+24-12Lines changed: 24 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,11 @@ A resolution independent pixel perfect camera for Unity.
4
4
5
5
This package simplifies making a Unity camera render to exact pixel units, for use with pixel art or similar art styles where blockiness is part of the aesthetic.
@@ -14,25 +19,28 @@ This package simplifies making a Unity camera render to exact pixel units, for u
14
19
15
20
## Basic Usage ##
16
21
17
-
1. Attach the Pixel Camera script to an orthographic camera.
18
-
2. Set the Pixels Per Unit to an appropriate value, usually matching the settings used for your assets.
19
-
3. Set the Zoom Level for the camera.
22
+
1. Attach the `Pixel Camera` script to an existing camera.
23
+
2. Set `Pixels Per Unit` to an appropriate value, usually matching the settings used for your assets.
24
+
3. Set the `Zoom Level` for the camera.
20
25
21
-
## Advanced Usage ##
26
+
## Advanced Settings ##
22
27
23
-
* Camera Material - allows a shader to be applied on the camera output. The script sets the camera output as the `_MainTex` of the material.
24
-
* Aspect Stretch - apply a custom stretch to the output, allowing your assets to be displayed in non square pixels.
28
+
*__Camera Material__ - A material applied to the camera output, allows shaders to modify the image. The camera output is set as the `_MainTex` of the material.
29
+
*__Aspect Stretch__ - Apply a stretch to the output, allowing the display to be non square pixels.
30
+
*__Perspective Z__ - Only for perspective cameras. The Z distance from the camera that is rendered as pixel perfect.
25
31
26
32
## Caveats ##
27
33
28
-
* If a camera or sprite is out of alignment with the pixel grid, unwanted artifacts may occur
29
-
* Pixel Camera will not automatically zoom in or out according to the window/viewport size
34
+
* If a camera or sprite is out of alignment with the pixel grid, unwanted artifacts may occur.
35
+
* Pixel Camera will not automatically zoom in or out according to the window/viewport size.
36
+
* Camera `Viewport Rect` settings are not taken into account.
37
+
* With a perspective camera, zoom levels below 1 will render a black border.
30
38
31
39
## Technical Details ##
32
40
33
-
Pixel camera takes the size of the screen and finds the pixel size required to cover the entire screen at the given settings.
41
+
Pixel camera takes the size of the screen and finds the render size required to cover the screen in a pixel perfect manner, at the given settings.
34
42
35
-
The camera orthographic size is modified so that the render fits the calculated size, and the output is sent to a RenderTexture.
43
+
A `RenderTexture` of the calculated render size is created, and if needed the camera settings are modified so the render fits the calculated size. The camera output is sent to the `RenderTexture`.
36
44
37
45
A dummy camera that renders nothing is created, and the `OnPostRender()` function is used to draw the output of the attached camera onto the screen using GL commands.
38
46
@@ -56,11 +64,15 @@ __AspectStretch__ : Vector2
56
64
57
65
An additional stretch applied to the camera, allows camera to render as non square pixels.
58
66
59
-
__RenderTexture__ : RenderTexture
67
+
__PerspectiveZ__ : float
68
+
69
+
With a perspective camera, the distance from the camera that is rendered as pixel perfect.
70
+
71
+
__RenderTexture__ : RenderTexture, read only
60
72
61
73
Access to the RenderTexture used as the camera output.
62
74
63
-
__CameraSize__ : int[]
75
+
__CameraSize__ : int[], read only
64
76
65
77
Actual pixel size of the camera, as an integer array.
0 commit comments