Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by mlepage · Jun 21, 2014 at 07:18 AM · gridcubepixelartifacts

Why pixel artifacts on aligned cubes?

There seem to be lots of posts on this but without satisfactory answers. I know quite a bit about 3D rendering (primarily OpenGL) and something does seem to be going on. See this screenshot marked up with the artifacts:

Unity cube artifacts

The project is attached.

Now this is a project freshly created in Unity 4.5 on OS X (Mavericks) running on MacBook Air (2011 version). Should be an easily supported platform.

The first row of cubes (closest to screen with z=0) are just 8 unit cubes, positioned at 1, 2, 3 etc. with no parents. You can verify the transforms in the (forced text) scene file, they look like:

m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1}

m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 1, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1}

Next row (z=1) is same, but moved 0.5 to the right.

m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 1.5, y: 0, z: 1} m_LocalScale: {x: 1, y: 1, z: 1} etc.

Next row also offset by 0.5 in the x direction, and is at z=2 in an empty parent at z=2 (otherwise all at origin).

The last row is a copy of the third parent, moved to z=3, and the cubes are shrunk to 0.5 in the y direction and moved to y=0.25.

All these should be perfectly aligned (floating point can be "approximate" but not in the case of 1, 0.5, and 0.25) given their coordinates and parents. In OpenGL, vertices with the same floats are guaranteed to rasterize lines between them perfectly the same no matter which primitive they are from, to avoid precisely this problem. So it's not a problem I'd expect in Unity, given the scene setup.

However, all rows exhibit pixel artifacts at the seams, in both the scene view, the game view (small), and the game view (full screen). Depending on the exact camera position/orientation, the pixel artifacts scintillate along the seams.

The material is a simple blue diffuse, with a single directional light. The camera is orthographic.

So what's going on? I'd like an explanation beyond "vertices are fuzzy" or "try expanding your cubes" because something is definitely amiss. Thanks.

unity-cube-artifacts.png (34.7 kB)
testunity.zip (110.7 kB)
Comment
Add comment · Show 3
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Q-nn · Jun 21, 2014 at 08:12 AM 0
Share

Don't have an answer for you but just had a play around and here are my findings:

Reproduced on Unity 4.3.4f1 on Windows 8

Supplied project behaved the same as you reported. Clean project replication behaved the same

Testing at 1024x768 primarily

At fixed camera and resolution, artifacts appear regardless of directional light rotation (provided target is lit).

With no lights at all, I cannot reproduce the artifacts. I have tried manipulating the ambient colour to no effect. Using an unlit material gives the same result.

Point lights do not seem to produce the artifacts.

The artifacts appear in builds as well.

Seems to be something to do with directional lights? Point light seems to not give these same issues.


I noticed similar, but white artifacts with a combination of two directional lights and a single point light. These seem more random/"picky" than the black ones and I'm not convinced they're related, except from see$$anonymous$$gly having something to do with aliasing.

avatar image picobots · Mar 26, 2015 at 07:55 PM 0
Share

I'm struggling with the same problem. I can confirm that this is also definitely related to Directional Lights. @mlepage Did you ever figure out a solution for this?

avatar image mlepage · Mar 30, 2015 at 10:13 PM 0
Share

I did not find a fix unfortunately.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Lythox · Nov 29, 2016 at 07:00 AM

I HAVE FOUND A SOLUTION THOUGH FOR THIS AWFUL PROBLEM: Fiddle around with the "Clipping Planes" of your main camera. I have changed my clipping plane (near) of my main camera from .01 to 1, and suddenly all grid artifacts are gone!

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Grid matching issue 0 Answers

Adding Imperfections? 1 Answer

What is wrong with my code? 1 Answer

Round position 1 Answer

How to display a picture with his own pixel size on a cube? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges