3
\$\begingroup\$

I made a "Wall" from basic Unity3D cubes. They are placed tightly so the wall looks like one big rectangular prism.

If I look at it from close distance, it looks as it should be: one big rectangular prism.

But if I start moving backwards, away from the wall, the cubes' edges become visible:

enter image description here

And this whole thing happens in a circular way.

  • If I just start moving backwards from the wall,
  • first I start to see the cubes' edges just at the further parts of the object, and then the pure white circle starts shrinking, the edges become visible at bigger and bigger parts of the object.
  • then the blurrier edges appear at the further places and the previously appeared sharper edges circle starts shrinking as well. (this phase is shown on the image above)

This should be some kind of shading optimization, like mipmap, right?

How can I fix this? I want the wall to be seamless from all distances.

Update:

  • Changing the shader to Unlit > Color, fixes the issue.

  • This thing only occurs on the lit side of the wall. The shadowy side of the wall, (which isn't lit directly by the directional light of the scene) is rendered normally.

\$\endgroup\$
14
  • 1
    \$\begingroup\$ So when you are close to the objects it just likes like a big cube that is all white, right? Could you try to change the material's shader to something like Unlit -> Color and see if this makes the lines disappear? It's not a "proper" solution, but at least you'd know its the shader's fault. \$\endgroup\$ – TomTsagk Oct 12 '18 at 12:41
  • \$\begingroup\$ @TomTsagk It didn't help. \$\endgroup\$ – Tudvari Oct 12 '18 at 12:55
  • 1
    \$\begingroup\$ Am I correct in assuming that scaling the wall to your desired dimensions will not suffice, and you need it in the multi-cube form? (Interesting problem btw, +1) \$\endgroup\$ – Evorlor Oct 23 '18 at 22:25
  • 1
    \$\begingroup\$ Yes, they need to be separated, so big structures' voxels can be invidually damaged and destroyed. @MuhammadFaizanKhan can you elaborate please? \$\endgroup\$ – Tudvari Oct 24 '18 at 7:29
  • 2
    \$\begingroup\$ "big structures' voxels can be invidually damaged and destroyed" does not imply "they need to be separated" - most voxel games that look like they're built out of individual cube objects are actually rendering combined meshes that span many logical cubes. When you damage an individual voxel (you can determine which logical voxel got hit using its grid position, even when it doesn't have its own separate collider/object), the mesh for that group is updated. \$\endgroup\$ – DMGregory Oct 24 '18 at 14:19
2
\$\begingroup\$

Finally I managed to fix it, with the help of the official Unity Forums. (20 minutes after posting, there was already an answer)

I just had to increase the (Shadow) Bias of my light source.

(Increasing it from 0.05 to 0.3 fully removed all the edges.)

enter image description here

\$\endgroup\$
1
  • 2
    \$\begingroup\$ Keep an eye out for Peter Panning when increasing this setting - this is where a narrow object in contact with the ground has its shadow come "unglued" from.its base, so it appears to be hovering slightly. \$\endgroup\$ – DMGregory Oct 27 '18 at 8:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.