• 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

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



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

Help with tile palette(Genuine Struggle) 0 Answers

What is the best solution for infinite tile generation in a 2d top down game? 0 Answers

How can I delete a quad (mesh) by code? 1 Answer

Triangles for sphere 0 Answers

Weird positioning of Tiles in the Tile Palette 0 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges