首页 > 其他分享 >Unity完美像素Sprite:怎么让图片变得清晰(转载) Unity Pixel Perfect Sprite: How To Achieve Crispy And Sharp Images

Unity完美像素Sprite:怎么让图片变得清晰(转载) Unity Pixel Perfect Sprite: How To Achieve Crispy And Sharp Images

时间:2023-10-11 19:44:31浏览次数:39  
标签:Perfect Sprite my but Unity was pixel sprite

https://gamedevelopertips.com/unity-pixel-perfect-sprite/

So I was making a little prototype for my new game when I just came across a little problem.

The sprite that I was loading into Unity was just looking too pixelated and not sharp at all.

So I spent a few days to understand and address this problem until I found the perfect solution that I’ll share with you in this article.

Let’s start with the beginning.

Create the sprite in photoshop.

In my example, I’ve created a simple semi-circle shape:

The resolution of this circle is 512*512 pixel, but now let’s load it into Unity and let’s see what are the adjustments that we have to do to make the sprite look crispy and sharp.

This is the settings that you should use in your project:

Now here are the things to keep in mind:

  1. In my case “Generate Mip Maps” is turned off but in case you are planning to zoom in / out a lot then you should tour it on.
  2. Pixel per units, This setting is good for my project which was using a screen resolution of 750×1334 pixels, but feel free to just this number until will fit perfectly you screen
  3. Be sure that the max size of the sprite is at least the same resolution of the sprite (in my case was 512 so 2048 is ok), but not lower.
  4. Make sure your sprite import compression is not set too low (try None to see if it has an effect).

Unity pixel perfect sprite: Other tips to improve the look if your sprite in Unity

Now, if all the above suggestions didn’t make you sprites look good, we have some other adjustment that we can do, so follow me:

Let’s start with the antialiasing settings:

Go to Edit->Project Settings->Quality-> Anti Aliasing and set it to 4x or 8x, but be careful, this will drag your resources down so keep it as low as possible. In my case 4x was enough to help me achieve a slightly better look on my sprites.

Anti-aliasing has the following effect:

With an Anti-aliased tour on, the pixels will result in more smooth and blurry which is something that I really like, but if you want to achieve ultra-sharp images, then you can consider to tour it off.

The second setting to check on the same screen is the following: Edit->Project Settings->Quality->Texture Quality should be Full Res.

Moving forward, make sure your sprite gameObject has a scale of 1 on x, y and z.

Change the camera orthographic size

Now this is another relevant part

remember before when we have set out Pixel Per Unit (PPU)?

Now you need to tell the camera how big we want it to be based on that PPU so that one pixel on screen corresponds with one pixel on our game.

To get that size we just need to do a simple formula:

Camera orthographic size = vertical resolution / PPU *0.5

Once you have that size click in the Main Camera object, and put that value in the Size setting:

In my case for example:

I have a resolution of 750×1334 and a PPU 600 = 1334 / 600 * 0.5 = 1,11

Ok with these little tips you should be able to have nice looking images and build amazing games.

Thanks

Share this:

标签:Perfect,Sprite,my,but,Unity,was,pixel,sprite
From: https://www.cnblogs.com/dewxin/p/17758005.html

相关文章

  • 问题记录:Unity部分Sprite跳跃移动
    问题展示这个图片中,可以发现巴郡两个字的移动和其他图片不一致。表面原因是因为这个两个图片资产的filtermode为point导致的,其他图片资产为bilinear。解决方案未知。......
  • Unity 中国版、国际版下载地址
    中国:https://unity.cn/releases国际:https://unity.com/releases/editor/archive......
  • Unity使用https请求握手失败的处理方案
    Unity使用https请求握手失败的处理方案HandshakefailedUNITYTLS_INTERNALS解决方案varhandler=newHttpClientHandler();//需要加这句handler.ClientCertificateOptions=ClientCertificateOption.Manual;//需要加这句using(HttpCli......
  • Unity运用socket传输信息(同步)
    客户端:在UGUI中创建两个Button,一个是连接服务器,一个是发送消息的按钮,分别绑定Connection和SendMessage两个函数并且创建一个InputField和一个Text文本,Text文本用于显示服务器回传的消息,InputField用于输入要发送的消息以下是代码:1usingSystem.Collections;2usingSyst......
  • Unity 通信方案 - 使用 Google Protobuf 序列化数据
    1.下载和编译1.1下载ProtoBuf源文件从github下载最新的protoBuf库,如下图所示 Releases·protocolbuffers/protobuf(github.com)1.2编译dll和导入解压后打开/scharp/src中的sln工程文件 选择Release,Google.Protobuf,之后在生成中生成文件在......
  • 【Unity】 ScriptableObject ——生成多个ScriptableObject作为子对象,可以点击展开并
     官方是这么介绍ScriptabelObject的: “ScriptableObject是一个可独立于类实例来保存大量数据的数据容器。ScriptableObject的一个主要用例是通过避免重复值来减少项目的内存使用量。如果项目有一个预制件在附加的MonoBehaviour脚本中存储不变的数据,这将非常有用。每次实......
  • 从零开始学Unity(一)-主要窗口及功能区域
    声明:本人学习过程跟随NeilianAryan大佬课程从零开始的Unity魔法学堂学习部分思路及案例可能来源于课程内案例做此笔记仅为记录学习过程方面日后整理及回顾如有侵权联系删除谢谢!!unity主要窗口Scene、Game、Hierarchy、Inspector、Project、ConsoleScene场景窗口在默......
  • 【翻译中】骇入Unity游戏(2)-操作与控制
    【翻译中】骇入Unity游戏(2)-操作与控制来源:https://www.hypn.za.net/blog/2020/04/19/hacking-unity-games-part-2-manipulating/......
  • 什么是 VMware Workstation Player 的 Unity 模式
    VMwareWorkstationPlayer的Unity模式是该虚拟化软件的一个令人印象深刻的功能,它允许用户将虚拟机中的应用程序窗口集成到主机操作系统的桌面环境中,使其看起来就像是在主机上运行的本地应用程序。Unity模式提供了出色的用户体验,同时提高了工作效率,特别是对于需要在虚拟机和主机操......
  • Unity性能优化-GPU Instancing
    GPUInstancing是Unity的一种优化技术。使用GPUInstancing可以在一个DrawCall中同时渲染多个相同或类似的物体,从而减少CPU和GPU的开销。官方文档:https://docs.unity3d.com/Manual/GPUInstancing.html要启用GPUInstancing,我们可以选中一个材质,然后在Inspector窗口勾选Enable......