In Unity 2018.3.8f1, I'm using a standard line renderer and noticed that when not horizontal or vertical, the edges become jagged. They appear this way in play mode and a build at Ultra quality.
I've tried enabling/maxing anti-aliasing in the quality settings but it has zero effect here. I've tried playing with width, vertex counts, adding points, etc.
Even when adding curves for a cubic bezier, the edges are still jagged.
I'm just not sure what else to do. The lines look awful.
Related
I am trying to create grid with small squares, my square sprite has a black outline but the outline looks thicker at some areas and thinner in some other areas. How can i fix it?
Here is the look i got by snapping them without leaving any place inbetween.
https://imgur.com/a/J5U2nVk
I have done some testing to reproduce your screenshot, and at the end I think this is a very simple problem: Unity does that when it tries to render high definition sprites with a low scale ( think of it as multiple pixels of a sprite fighting each other for one pixel of your screen ), so for you I think the solution would be to use less detailled sprites.
I want to make a 3d graph in unity and on that graph draw curves and surfaces etc. on surfaces I may have the grid texture applied on them, all of this is achievable. but there is one thing effect which I do not know how to achieve.
Many components in this app will be lines, Like the x-axis, y-axis, z-axis, & some grid on the surface, now I want these lines to have constant thickness, I may zoom into or zoom out of stuff but these lines should always be of constant thickness on the screen, a 1px line
should always be 1 pixel no matter I zoom close to it or I zoom away from it.
How can we do it? Is it an Image effect or a Shader or some other trick, I need to know what is the right approach for something like this.
If you need that for editor usage you can use UnityEditor.Handles but you would need Renderers (feg. LineRenderer) to draw it in build
I've been searching around for this one for a bit, and unfortunately I can't seem to find any good, consistent results. So, in the Unity UI system, buttons can stretch without becoming pixelated or distorted. This is because the texture is split up into 9 parts - the corners, middle, and sides.
This works because the button's middle and sides are stretched, but not the corners. Then, the button appears not pixelated, at any dimension.
So, the question is as follows: How can I do the same thing for a transparent, unlit texture in 3D space? I have a speech bubble texture on a flat plane that I know how to re-scale to fit the text in the speech bubble.
I've set the texture type to Multiple Sprite, and divided it up into 9 parts. However, I cannot seem to find where I can set the texture to act like the UI button does, and I'm not sure that this is even possible in this way in 3D space.
Is there a way, or should I just make the different parts of the texture different objects, and move them together? That would seem very inefficient and ugly compared to this.
To accomplish what you are asking, you would need to create tiles for this speech bubble and then write a script that procedurally builds a speech bubble based on the plane's scale value. You could also try just changing the texture's Filter Mode to Point.
However I really don't think you should be using textures for this anyway. Why not just use a Unity Canvas and set the Render Mode to World Space? Then you can just set your text box to be a sprite, not a texture, and set its filter mode to Point (See below). This would also make it a lot easier for when you want there to be text in the speech bubble later on.
Here is the cookie texture I'm using for my projector: http://imgur.com/AsEQErW
And here is the result in game: http://imgur.com/eyhekRj
It's hard to see, but there's a slight glow protruding from the four cardinal directions of the projection. It's hard to see while standing still, but glaringly apparent when the character is in motion.
I suspect that this is because the texture is being altered internally, and the edges are being blurred with nothing, producing a slight non-black value for those edge pixels. I haven't been successful in removing them.
Any thoughts?
The problem was the cookie image. The pixels along the border weren't all pure-black, specifically where the circle is closest to the edges. In Unity Projectors, I guess this results in the edge pixels being projected indefinitely, which created "rays" from my circle. Making sure that the edge pixels in the cookie PNG were all pure-black fixed this problem.
The problem is mipmaps, change the texture to advanced and disable mip maps.
In my iPhone application, many lines are drawn. Alas, some of them are neither vertical nor horizontal, meaning that they have jagged edges.
Enabling GL_LINE_SMOOTH seems to have no effect. Multisample antialiasing as described in Apple's documentation works, but I can't imagine that it's impossible to make nicer looking lines. With the antialiasing the line becomes smooth but the color is distorted along sections of the line.
Using OpenGL, how can you draw a line that looks like a line drawn by Quartz-2D, with a smooth border, consistent color, and variable width?
(To be clear, GL_LINE_WIDTH works perfectly, so variable width is not currently an issue.)
This is a common problem in 3D graphics. Most graphics cards are usually more concerned about fill rate and speed than visual quality in their basic geometry rendering. They use the Bresenham algorithm to draw lines and polygons, which does not support anti aliasing.
Opting for speed rather than visual quality is actually quite reasonable for a 3D API, since most of the visual detail eventually arises from the use of textures (which are interpolated) rather than from the geometry.
My suggestion would be to activate multi-sampling, or doing FSAA by hand using the accumulation buffer (if that's available under OpenGL ES). Or you could try to draw multiple lines with some transparency jittered around the intended coordinates.
In addition to what Fabian said, it may be that you just have to enable alpha blending for line smooth to show an effect, by calling
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);