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 Yakov_Ginko · Aug 01, 2013 at 11:35 AM · 2dorthographic

2d artefact gap between tiles

alt text

alt text

I have issue which u can see on left image when orthographic size of my camera is an integer. If orthographic size is integer+0.5 than its ok: right image.

Size of my camera changes automatically by formula

camera.orthographicSize = camera.pixelHeight / 2.0f;

Width and height of tiles meshes and textures is 16.

1 generate 1 mesh, and for every tile i make quad of 4 new verticles:

 for (int i = 0; i < _w; ++i)
         {
             for (int j = 0; j < _h; ++j)
             {
                 if (data[i,j] != null)
                 {
                     SetTile(new XY(i, j), data[i,j].GetId());
                 }
             }
         }
 
 public void SetTile(XY pos, int tileId)
     {
         //    ->
         //  1    2
         //  *----*
         //  | \  |
         //  |   \|
         //  *____*
         //  3    4
         int index = (pos.x * _w + pos.y) * 4;
 
         _vertices[index] = new Vector3(pos.x * _tileSize, _depth, pos.y * _tileSize);
         _vertices[index + 1] = new Vector3(pos.x * _tileSize + _tileSize, _depth, pos.y * _tileSize);
         _vertices[index + 2] = new Vector3(pos.x * _tileSize, _depth, pos.y * _tileSize + _tileSize);
         _vertices[index + 3] = new Vector3(pos.x * _tileSize + _tileSize, _depth, pos.y * _tileSize + _tileSize);
 
         _normals[index] = Vector3.up;
         _normals[index + 1] = Vector3.up;
         _normals[index + 2] = Vector3.up;
         _normals[index + 3] = Vector3.up;
 
 
         Rect uv = _atlas.spriteDefinitions[tileId].uv;
         _uvs[index] = new Vector2(uv.xMin, uv.yMin);
         _uvs[index + 1] = new Vector2(uv.xMax, uv.yMin);
         _uvs[index + 2] = new Vector2(uv.xMin, uv.yMax);
         _uvs[index + 3] = new Vector2(uv.xMax, uv.yMax);
 
         int triangleIndex = (pos.x * _w + pos.y) * 6;
         _triangles[triangleIndex] = index;
         _triangles[triangleIndex + 1] = index + 3;
         _triangles[triangleIndex + 2] = index + 1;
 
         _triangles[triangleIndex + 3] = index;
         _triangles[triangleIndex + 4] = index + 2;
         _triangles[triangleIndex + 5] = index + 3;
     }

What am i doing wrong? Help me please.

Comment
Add comment · Show 1
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 Yakov_Ginko · Aug 01, 2013 at 03:24 PM 0
Share

alt text

here is another sample (this time i also have empty squares, its not a bug - just intentional)

4 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by Taza494 · Oct 11, 2015 at 11:43 AM

Edit>Project Settings>Quality, disable antisotopic filtering and anti aliasing is what worked for me.

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
avatar image
0

Answer by Yakov_Ginko · Aug 01, 2013 at 02:45 PM

Well, i tempoprarily fixed it with hack - made orhograthic size be always with .5 floating part. But i'm still looking for my mistake/solution of this problem

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
avatar image
0

Answer by MachindoApps · Aug 01, 2013 at 02:57 PM

Is camera.pixelHeight an even number?

The artifact might be caused by the height being odd, and the division by 2 discarding the remainder.

Comment
Add comment · Show 1 · 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
avatar image Yakov_Ginko · Aug 01, 2013 at 03:09 PM 0
Share

I think no, for example, when i do have problem: Orthographic size = 455, pixel height = 910, screen height = 910 and i divide by 2.0f, i wrote wrong above

avatar image
0

Answer by phocker · Aug 01, 2013 at 07:33 PM

also check your texture to see if you are using POINT versus BILINEAR -- that can cause those gaps as well.

Comment
Add comment · Show 3 · 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
avatar image Yakov_Ginko · Aug 01, 2013 at 07:38 PM 0
Share

i am using point filter mode.

avatar image phocker · Aug 01, 2013 at 08:00 PM 0
Share

try settnig to bilnear

avatar image Yakov_Ginko · Aug 01, 2013 at 08:08 PM 0
Share

bilinear adds vertical gaps

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

19 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Resizing orthographic camera to fit 2d sprite on screen 1 Answer

Sprite relative position/scale problem with orthographic camera 0 Answers

Set Orthographic Camera To Always Have Y Coordinate Start At Set Position 0 Answers

Assets/Scripts/PlayerController.cs(32,49): error CS0126: An object of a type convertible to `float' is required for the return statement 1 Answer

How to use a non-screen-sized RenderTexture? 1 Answer


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