Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 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 davvilla · Jul 02, 2012 at 10:53 PM · tilemaptilelines

Small line appears on tilebased terrain

We are creating our maps using tiles and everything works fine, however sometimes when moving some lines will appear where the tiles meet.

alt text


This happens because the edge tile on the top is a little bit higher (0.005) than the grass tile below it. For reference, below are the tiles in this scene:


alt text

Is there any way to fix this? Hopefully some other way other than combining meshes, i'd prefer to keep everything in it's own mesh.

Thanks a lot! I appreciate your time

screen shot 2012-07-02 at 3.36.14 pm.png (144.0 kB)
ex.png (20.0 kB)
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
Best Answer

Answer by Wolfram · Jul 02, 2012 at 11:13 PM

Although I don't really understand the connection between your first and second image, this looks like a simple wraparound problem. Unless you need the textures to be repeatable, have you tried setting the WrapMode of your textures to "Clamp"?

Also, it is not clear what you mean by "is a little bit higher (0.005) than the grass tile below it". You mean physical/terrain height and there are actually several tile layers on top of each other? Why do you need it to be higher? Or do you mean width/height dimension and your tile is strechted a bit?

EDIT:

One solution would be of course to place the sand-tile also 0.005 higher. But this "solution" only fixes the symptom you have. It would be better to fix the actual problem, which is the 0.005 shift, and the z-fighting if there is no shift.

A better solution would be a custom shader for your alpha-channeled sand rim. First, don't do the 0.005 shift. Use a shader with "Offset 0,-1" or "Offset -1,-1" set (maybe experiment a bit which will give you the best results). You can also try to increase the render queue of the shader (could also be done by script via renderer.material.renderQueue+=1;). If you are certain that these rims will only cover other co-planar layers below (such as the grass), you can also experiment with "ZTest Always", but note that in this case if you want to place any objects above that rim, they'll probably need an even higher renderQueue, so this will get more complicated.

See also here: http://docs.unity3d.com/Documentation/Components/SL-CullAndDepth.html

Comment
Add comment · Show 6 · 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 davvilla · Jul 02, 2012 at 11:49 PM 0
Share

Sorry if I wasn't clear. Where you see the edge of the dirt (above the green line) there are two planes ontop of each other, seperated by .005 (this is because if I don't do this the two planes render in weird ways).

The second image represents three different "planes". A combination of these are what you see in the first image. I hope this makes things clearer. Thanks for the response

avatar image Wolfram · Jul 03, 2012 at 12:13 AM 0
Share

O$$anonymous$$, in that case, switching between repeat/clamp won't help you. I edited my answer with another alternative.

avatar image davvilla · Jul 03, 2012 at 01:02 AM 1
Share

I'm still looking into shader coding but I'm pretty sure this is what I'm looking for!

I found this video very helpful. https://www.youtube.com/watch?v=f7zD$$anonymous$$lsyu6s

Thanks so much Wolfram

avatar image Wolfram · Jul 03, 2012 at 01:22 AM 0
Share

Nice tutorial, didn't know somebody made this. And it perfectly fits your problem (and the suggestions in my answer - although he explains it better ;-) ). Thanks for the link.

avatar image Wolfram · Jul 03, 2012 at 01:26 AM 0
Share

Note you don't have to (re-)write any shaders from scratch. For the builtin shaders, you can download their source from the Unity page (Support->Resources->Assets), then find your shader, copy it into your project, and rename it in the shader source (the filenmae is irrelevant). For example, the file containing the "Transparent/Diffuse" shader is called "Alpha-Diffuse.shader".

Show more comments

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Store data for tile based system 1 Answer

Color tile from tilemap 0 Answers

How to check if a grid unit position has a tile from the Tile Palette placed on it? 1 Answer

TileMap.GetTile not working as expected 0 Answers

Need help with size of Tiles! 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