Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 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
0
Question by EvanTune · Aug 15, 2018 at 10:09 AM · texturetilesuv mappingleaktexture atlas

UV mapping tiles on mesh bleeds texture when camera is at certain angle

Hi there!

So I generate meshes with tiles on them and I want to make each tile have a texture. Each tile has 4 unique verticies and each mesh / chunk is 100x100 tiles. I read that it is best to use UV mapping with a texture atlas when using tiles like this, rather than using SetPixels() to create a unique texture for every mesh. So in the images below I set the UV mapping for each tile to the grass part of the texture shown in the first image. (0.4, 0.4) (0.6, 0.4) (0.4, 0.6) (0.6, 0.6). So I was just wondering why the entire texture shows when I tilt the camera in the distance? It starts at a certain distance from camera and has a half-circle shape. It would work fine if it was a 2D game, but it is a top down 3D. The only "solution" I found is to set the padding to 3x the tile width, so if the tile takes a 32x32 texture, then I need 96px of padding around it in each direction with a similar color to make it not look ugly. Also this limits the amount of texture tiles I can use.

Tilted camera view: alt text

Tilted camera view with "generate mip maps" set on": alt text

Top down view: alt text

Comment
Add comment
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

2 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by EvanTune · Aug 17, 2018 at 10:45 AM

So I turned off anti aliasing in quality settings and this fixed the issue with the magenta color showing up in the distance as shown in the first image. I am now using the free Post Processing Stack asset to add it back to the camera and it doesn't have the weird effects as before.

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 Bunny83 · Aug 15, 2018 at 11:34 AM

Because you use mipmaps. Mipmaps are down sampled versions of the same texture which are used when the sampled area on the screen is very small.

Your options are

Either disable mipmapping or if you really need mipmapping you might need to generate the mipmap levels manually and make sure the tiles are aligned to power-of-two position and scale.

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 Bunny83 · Aug 15, 2018 at 11:40 AM 0
Share

When you generate mipmaps your self it wouldn't make any sense to go further down when you reach the tile size. So one tile is one pixel in the highest mipmap level. Apart from that to avoid bleeding each tile should have a one pixel border if possible. That means you would shift your UV coordinates inwards by one pixel. Though this depends on your texture filtering method

avatar image EvanTune · Aug 15, 2018 at 02:08 PM 0
Share

Thanks for the reply! So when I disable "generate mip maps" in the texture, the pink part of the texture still shows as in the first image in my post far in the distance. So turning it off still gives me trouble.

This is with mip maps off alt text

For your second option, do you know how to apply them to a texture? If I have a 1024x1024 px texture atlas with 32x32 px tiles, then I assume I would need 512x 256x 128x 64x and 32x mip map textures. So I would then need to apply 5 mip map textures to the texture atlas? I also noticed that the bigger I make the texture atlas the more mip map "levels" unity generates for it.

avatar image Bunny83 EvanTune · Aug 15, 2018 at 04:30 PM 0
Share

Hmm, that really looks strange. Usually when you turn off mipmaps this shouldn't happen. $$anonymous$$eep in $$anonymous$$d that if coordinates are normalized coordinates. However the actual pixels used depends on the filtering mode. You should generally avoid sampling positions between two pixels(texels). You image is a non power-of-two image so it is stretched to the nearest power-of-two size.

To create the mipmaps levels manually you would just use the SetPixels overload that takes the mipmap index as additional parameter. Level0 is the whole image. Though if disabling doesn't work, setting the mipmaps manually will not help either. Also this will only make sense if the tiles are properly aligned inside the image.

Are you sure your UVs are correct? Without mipmapping you may see some bleeding of the cyan area but the magenta region shouldn't be visible at all

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

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

Related Questions

More materials smaller texture size vs less materials bigger texture size 0 Answers

Why would my texture split across the triangle at runtime? 0 Answers

'.' is not a valid texture file name on asset warning/error 1 Answer

Blender to unity, importing UV mapped image textures 1 Answer

Export UV Map from Cinema 4d to Unity3D 2 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