• 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 /
  • Help Room /
avatar image
0
Question by Seedersj · Apr 21, 2016 at 03:16 AM · 2dmeshproceduraltilestexturing

2D Tilemap using UV Coordinates with nice transition between different tiles?

I am making a top down 2D game that has procedural terrain, and am trying to make the transition between tiles look nice.

I had this working by generating an object for every tile. I would then add a child sprite for the base tile type. I would then add another set of child sprites depending on the neighbors. If a dirt tile was next to a grass tile, the dirt tile would have the base dirt sprite, and a transitional grass sprite that was basically halfway transparent. This system was really nice because I just had a to create a 6x4 texture atlas per terrain type. (https://github.com/seveibar/liberated-pixel-cup/blob/master/resources/assets/lpc_full_assets/base_assets/water.png)

However I recently switched to using a single mesh, and altering the UV coordinates to show the generated terrain. This reallllly improved my performance, but seemingly harmed my flexibility.

I've been searching for a way to "map multiple sprites at a single location on a mesh" but haven't found anything concrete. I've attempted using uv2, uv3 but that doesn't seem to work either (came up all yellow, no sprites).

I don't want to create some giant spritesheet that has every possible permutation of tile types being next to eachother.

The other idea i had was to create multiple stacked meshes, and paint the transitions on a mesh above the base terrain mesh. That's going to really increase the vertices i am looping through though :/

Is there a standard way to handle this?

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Seedersj · Apr 21, 2016 at 04:14 AM

Well I figured out i can use mesh.uv2 if i set the Secondary Maps -> Detail Albedo x2 texture to the same atlas, and then set UV Set dropdown to UV1.

UV1 = mesh.uv2

However, that's still only 1 extra texture. Maybe I need to learn to write a custom shader for this?

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

80 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

Related Questions

Can't Figure Out How To Make A Line Tracking System 0 Answers

Generating Mesh using Points 1 Answer

Help with clouds -- Is it possible to procedurally generate them in a 2d game? 1 Answer

Weird Tilemap gap bug, what can I do to hide it? 1 Answer

Dynamically texturing mesh like a 2d tile map 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