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 Cains · Nov 03, 2013 at 07:27 AM · textureproceduraltexture-atlas

Textures on procedurally generated mesh have lines in between

I just started on procedurally generated meshes and was going along great until I noticed this nagging problem that I really hope someone can shed some light on. I have a giant quad mesh made up of many little quads, and when I UV map some textures to these quads from a big tilesheet texture lines appear in between each of the little quads. The amount and intensity of the lines change when I change the Wrap Mode and Filter Mode of the tilesheet, though none of the options gets rid of them all, which is what I really want.

The tilesheet is here (only using the bottom left tile) and the UV mapping code is below:

 for(i = 0;i < p.quadCount;i++) {
     uv[0 + (i*4)] = new Vector2(0, 0);
     uv[1 + (i*4)] = new Vector2(1.0/p.tileSheetX, 0);
     uv[2 + (i*4)] = new Vector2(1.0/p.tileSheetX, 1.0/p.tileSheetY);
     uv[3 + (i*4)] = new Vector2(0, 1.0/p.tileSheetY);
 }

This for loop loops through every quad on the mesh and UV maps a section of the tilesheet to the four corners of every quad, with p.tileSheetX and p.tileSheetY being how many tiles are on the tilesheet (in this case p.tileSheetX = 8 and p.tileSheetY = 7). If I change this to the below:

 for(i = 0;i < p.quadCount;i++) {
     uv[0 + (i*4)] = new Vector2(0.01, 0.01);
     uv[1 + (i*4)] = new Vector2(1.0/p.tileSheetX - 0.01, 0.01);
     uv[2 + (i*4)] = new Vector2(1.0/p.tileSheetX - 0.01, 1.0/p.tileSheetY - 0.01);
     uv[3 + (i*4)] = new Vector2(0.01, 1.0/p.tileSheetY - 0.01);
 }

then there are no more lines unless you zoom very far out from the mesh, though if you go to 0.001 instead of 0.01 the lines reappear. This seems messy and doesn't appear very scalable for large tilesheets so I'd like a better fix.

Wrap - Clamp, Filter - Point

alt text

Wrap - Repeat, Filter - Point

alt text

Wrap - Clamp, Filter - Bilinear

alt text

Wrap - Repeat, Filter - Bilinear

alt text

Comment
Add comment · Show 2
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 Worrom · Nov 27, 2013 at 05:18 AM 0
Share

I'm having the exact same problem with the same situation (giant mesh made of quads I UV from a tile sheet). If anyone has a clue please let us know!

It seems as if, at certain distances, the tile is shifting one pixel up/down and/or taking the color from a bordering tile.

Surround the tile with a bright color just outside the area the game should pickup, at least in my case that color is appearing at certain camera distances at the edge of the tile.

Update: $$anonymous$$y camera is set to zoom in and out with the mouse wheel, at orthographic sizes of 10 and 5 I get this issue. At 6,7,8,9 I see no lines at all!

avatar image crush83 · Dec 30, 2013 at 09:35 PM 0
Share

Did anyone ever solve this issue?

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by sparkzbarca · Dec 30, 2013 at 10:09 PM

this has to do with mipmapping and antialiasing and stuff, basically there are times the graphics engine will sample the textures border (the white part) to determine an "average" value for texture scaling and antialaising and stuff and you end up with white getting thrown in which screws up the texture color value. The solution is well known.

all textures need whats called padding. Around the edge of the texture you take the texture edge color and yuo just drop it in.

you'd put a nice black border around that blue thing with a black edge and a generally brown texture around that water thing. You dont mark this part as part of the texture.

what you do is you make this padding border on a seperate layer and alpha it out. That way its not seen and is only sampled from.

The other alternative is to "extrude" the edge of the texture.

http://wiki.polycount.com/EdgePadding

this link will help you better understand if needed.

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

18 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

Related Questions

Texture atlas's, how to make them 2 Answers

Terrain Procedural Texturing based on height? 4 Answers

Same material, different meshes, different tiling 2 Answers

Realtime mesh deformation or texturing 0 Answers

Writing fragment shader data to RenderTexture 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