- Home /
Pixels inbetwen non conected polygons.
Hi. I have chunks(separate game objects) of polygons and i see pixels (of the skybox) in between them even if they are perfectly aligned. Pixels flashes when i move the camera. How to make them stop? If I have one pixel visible and don't move the camera but change the Anti Aliasing the pixel seams to move around or sometimes disappear.
I made a video showing the problem. http://www.youtube.com/watch?v=7wnR4xQ1Y6c
Every block in the chunk is 1 unity unit.
The shader don't affect the problem. When I have a pixel fixed on the screen and don't "look around"(fixed rotation and position of camera) and change the shader(have tried 10 different) the pixel stays the same.
The only thing affecting the shader is anti aliasing(the fix pixel disappear but as i move the screen new ones reapers a little bit darker) and changing the sky box(the pixel is clearly corresponding to the skybox color at that spot).
SOLUTION I did add 0.00005f on all sides. The faces got from being 1x1 to 1.00005x1.00005. I did initially add 0.00001f but eventually did find one pixel and did increas to 0.00005f.
/Johan
Snapshot please. Always post snapshots for questions describing visual artifacts.
One normally shaded, and one in wireframe.
Also, what are the dimensions of your model within Unity? (for example, create a Unity cube next to your model. Is it about the same size? way smaller? way bigger?)
Which shader(s) are you using?
Answer by Wolfram · Feb 14, 2013 at 02:29 AM
The workaround you found is probably the only way to go. The pixels result from floating point imprecisions in the vertex calculations. These imprecisions are not a problem/not existent if it's a single mesh GameObject, but as every GameObject has its (float) transformation matrix, floating point errors are unavoidable.
With anti-aliasing on you just re-distribute these pixels to several different pixels, averaging (=dimming) them.
There are two other workarounds I can think of, but both have serious drawbacks - one will reduce your performance, the other will take some programming work and makes your scene static, so you can no longer move cubes around:
Draw another plane/object behind your actual objects, or close up your objects (=make them fill cubes, or add separationg planes inbetween), in the same/similar color as your foreground object. This will at least prevent skybox pixels and make them the same/similar color. This will increase your polygon count and probably kill your fillrate.
Write a script that merges vertices from different GameObjects together if they are close together (=smaller some eps). There is the CombineChildren script, which might already do that. However, this will essentially merge meshes of different GO's together, so they can no longer be transformed individually.
Answer by DaveA · Feb 11, 2013 at 12:04 AM
Make sure the textures' settings are 'clamped' and not 'repeat'
Hm, assu$$anonymous$$g his description is accurate, I don't see how this is gonna help.
But your advice is still good advice for the Skybox textures, as 'Repeat' would create artifacts along the seams of the Skybox.
I did try to change it to clamped on the chunks. It and it did not fix the problem. Thanks for the tip any way!