I have a number of images and text mesh pro assets on a screen space camera canvas (not overlay, so this question is not a dup) with a 45 deg FOV perspective camera and I'm getting jaggies on every asset that is rotated on an axis other than 0, 90, 180, 270 deg.
Images and text mesh pro are equally affected.
The plane distance from camera makes no difference, nor does the
scale or size of the assets.
I have a canvas scaler but no settings change the aliasing.
I'm using post processing stack 3.2.2. I've tried all 3 AA methods,
each has a slightly different effect but the aliasing is always quite
noticeable.
I've disabled the post processing in case it's another effect but no
change.
Changing Anti Aliasing in quality settings to affect the cameras MSAA
has no effect at all.
Because images and text are affected equally - including the default
image sprite in the above picture - I don't think mip map settings
etc are the issue.
I've increased atlas resolution to max for the TMPro assets to no
effect.
Anything else I can try?
Cross posted on GameDev and UnityAnswers
Related
I am trying to set-up my game's HUD so that it scales properly at any resolution, and I ran into a problem I haven't been able to solve yet.
My game uses a dynamic crosshair which consists of 4 images (no sprites, just an Image element with a color) of 2x8/8x2 size, depending on the orientation.
Depending on if you're moving or not, the crosshair gap increases by increasing the X/Y positions of the 4 pieces of the crosshair to show that the accuracy of the weapon is being reduced.
This works and scales perfectly at almost any resolution, but in very low resolutions such as 640x480, the crosshair disappears completely. My guess is that the crosshair images are being shrinked to scale for this resolution, and this causes the width or height of the images to become 0, making the crosshair invisible. If I increase the width or height to 3 pixels, then the crosshair doesn't dissapear at this resolution, but that's not a viable solution. I want the width/height to be 2 pixels.
This is my canvas scaler setup:
https://imgur.com/a/bzPSHRu
And this is the crosshair setup:
https://imgur.com/a/7KDMsgc
https://imgur.com/a/qml6UWB
https://imgur.com/a/970Q4im
https://imgur.com/a/Stvhy6J
This is what happens at different resolutions:
1920x1080 (looks fine): https://imgur.com/a/vV1fuJj
1024x768 (looks fine): https://imgur.com/a/iMUi7oM
640x480 (crosshair becomes invisible): https://imgur.com/a/3v66tkr
Any ideas on how to solve this issue? Thanks a lot in advance!
This is my scene
Right now if I use resolutions that aren't 16:9 the Pixel Perfect Camera zooms out quite a lot showing parts that shouldn't be shown.
How do I get it to scale like the Normal Camera which just cuts out parts outside the borders?
The Reference Resolution is currently set to 320x180, I tried changing the Reference Resolution to other resolutions (640x360, etc) but that changed nothing.
Tried Pixel Snapping on/off.
Cropping the X and Y does a good job at hiding the outside borders places but makes the screen too small for non 16:9 resolutions.
I have a physical camera in the scene which renders a 3D Scene. The 3D Scene is rendered between the Top UI Bar and the Bottom UI Bar and has been set properly for reference resolution 720 x 1280.
So, the problem is when the resolution changes, the UI is set properly for that particular resolution. But the 3D scene that is rendered between the 2 UI parts, doesn't sit properly between them. I am attaching 2 reference images for easier understanding.
The below-given image is based on the reference resolution and the 3D Scene is properly fit between the 2 UI parts.
The below-given image is for another resolution where the UI adjusts itself accordingly. But the 3D scene doesn't, i.e the camera should move to fit the 3D Scene between the UI.
So, is there any way I can move the camera according to the resolution so that it fits properly between the UI for different aspect ratios.
Thank you.
First of all, try looking at the ViewportRect property of the camera - it enables you to crop the viewport to an area which should enable the effect you seek.
This however has the limitation of keeping the 'center scren' axis of perspective, which in some cases is uncalled for.
An 'should always work' solution is rendering to a RednerTexture - camera adapts its screen aspect to the aspect of the RenderTexture, and if you display your texture on RawImage, you should get dececnt results. This however has some performance cost (memory readout is not the fastest on mobile).
In case the cost woul be unnaceptable, its possible to construct custom camera projection matrix, that would respect your desired viewport rect, and also allow arbitrary perspective, but its not trivial unfrotunately. Here is some more information
https://docs.unity3d.com/ScriptReference/Camera-projectionMatrix.html
My pixel art assets all have a ppu of 32 and i have applied that to them all.
On 1920x1080, the resolution is fine, but most other resolutions the sprites pixels are squashed and stretched. I also have set the correct camera size using vertical resolution / PPU / 2). I have also used other formulas and they all give me the same camera size so i'm sure that's not the issue.
I have two moniters, one at 1920x1080, and one at 1360x768, and that moniter is where it scales wrong. Is there a way i can keep the pixels scaling the same across all resolutions? I have tried the pixel perfect camera and this doesn't fix my issue either.
https://imgur.com/gallery/Uf8YqNi Here is a sample of both resolutions, if you open them in a new tab and zoom in on the sprite you can see how tey get distorted in the 1360x768 screen.
Filter mode should be Point and compression None. If this doesn't fix it, then you should use Pixel Perfect camera. It will help you with the animations to be pixel perfect as well.
Window -> Package Manager -> Advanced -> Show preview packages -> 2D Pixel Perfect -> Instlal. Then you just add Pixel Perfect Camera component to your Camera.
I am currently making a mobile match-3 like game in unity. I have made all the graphics for the gems(the objects with which you make the matches) in Inkscape at 256x256 and exported them(PNG Files) with 90 dpi(also tried with 360 but nothing changed). My problem is that when I run the game in the editor the graphics seem to be "pixelated" and blurry. In my sprite settings I've set Pixels per Unit to 256, checked Generate Mip Maps, I am using Bilinear Filter Mode and the aniso level is 0. I have also set the max size to 256 and compression to high quality(My Main Camera's size is 10 but I tried to change that and nothing changed as far as the quality of the sprites). What can I do to "perfectly" display my sprites? Do I have to export them in some other way from Inkscape or do I have to change some Unity's settings?
Thank you.
NOTE: My sprites are not "pixel art"!
Edit(Added photos of the purple gem as file and how it is shown in editor):
Because scaling
You're display resolution on the images isn't a 256x256 region where those images are displayed, which means that they must be scaled in some manner in order to display in the desired region. Camera rendering is notoriously bad at scaling. As your images aren't Vector (and Unity doesn't support vector graphic formats anyway), scaling will always result in a loss of detail. Detail like hard edges.
Your options are:
smaller images where you have complete control over how the image is scaled down
bilinear filtering (which is fundamentally blurry)
mipmaps (which are automatically scaled down versions of your image in powers of two)
If the later two aren't giving satisfactory results, your only option is the first.