0
\$\begingroup\$

I'm trying to get the camera pixel perfect in my game. I have tried the solution described in this video: https://www.youtube.com/watch?v=eN1zV0hlkso&t=7s

I use the resolution 128 by 72.

  1. Set the main camera to orthographic and the size to half of the screen height, 36
  2. Duplicate the camera and make it a child of the main camera, set the value near to 0 and rename the camera to Virtual Camera.
  3. Create a new layer called Virtual Screen and set the culling mask of the virtual camera to virtual screen.
  4. Create a quad and make it a child object of Virtual Camera. Remove the Mesh Collider and turn ligt and reflection probes off. Rename the quad to virtual screen and set the layer to virtual screen. Set the size of the quad to the desired resolution, 128 by 72
  5. Create a render texture, set the size to the desired resolution and the filter mode to point.
  6. Create a material, set it to unlit/texture and the texture to the render texture created in step 5.
  7. Set the target texture of the main camera to the render texture and the material of the virtual screen to the material created in step 6.

With these steps 1 pixel is 1 unit. Is it possible to get a pixel perfect camera with for example 16 pixels per unit?

\$\endgroup\$
  • 2
    \$\begingroup\$ Noone wants to look through that video to answer this question, please explain it yourself \$\endgroup\$ – Bálint Mar 13 '17 at 21:21
  • 1
    \$\begingroup\$ Added an explanation of the steps in the video \$\endgroup\$ – erudan Mar 13 '17 at 22:22
1
\$\begingroup\$

The orthographic projection (and the size of the quad) are giving you the number of units that appear in your screen.

If you set the size of the texture to match that size, then you get one pixel per unit. If you want more pixels per unit, make the texture bigger.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.