Search Unity

Is posible to rotate a sprite keeping pixel art look?

Discussion in '2D' started by Andreu-Accensi, Mar 4, 2015.

  1. Andreu-Accensi

    Andreu-Accensi

    Joined:
    Feb 5, 2015
    Posts:
    18
    I'm barely starting with unity but I tried all the 2d tips for pixel art I could found in the forums with satisfactory results when rendering my sprites as they come from the imported image. But I couldn't find anything related to the fact that rotating a sprite in unity is not like rotating the raw image on a graphics software (top-left and bottom-left corners of the attached file).

    The closest result I got was when I checked how the build scene (on windows) will work at the lowest resolution but at that resolution the scene is so blurry I cannot take it as an valid option (bottom-right corner of the attached file).

    At my default screen resolution the rotation effect of the build scene and the unity editor preview look the same (top-right corner of the attached file). So my question is... Is posible to rotate sprites somehow in unity achieving the same kind of pixel displacement as in a graphics software in order to keep the pixel art look?

    rotatepixel.png
     
  2. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,834
    draw the camera to a small render texture, then with a second camera redraw the rendertexture stretched to cover the screen.
     
    theANMATOR2b likes this.
  3. Andreu-Accensi

    Andreu-Accensi

    Joined:
    Feb 5, 2015
    Posts:
    18
    Thank you. You pointed me into the right direction I believe. I have seen that this technique can be achieved either with the Pro only RenderTexture or using ReadPixels.

    Since I don't have Unity Pro I tried the "Texture2D.ReadPixels" option to actually read the camera content into a texture every " OnPostRender()" to later on draw it with "Graphics.DrawTexture" on every "OnGUI()".

    This worked well on play mode and even in the web-player build, but in the pc-standalone build the ReadPixels makes the app to get stuck completely :( So it looks like an option but I cannot get it to work... has anywone faced this issue or something related before that can point me into the right direction?
     
  4. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    ReadPixels won't work well. Anyway just use rendertextures in Unity 5; you don't need Pro.

    --Eric
     
    theANMATOR2b likes this.