Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 Txguug · Nov 26, 2017 at 01:08 PM · terrainshadersmaterialsmeshes

Material for mesh based terrain

I'm tiling together a terrain using basic meshes that I construct in a script. This works well, but applying a material just doesn't look right. The corners don't blend smoothly with the sides

I've tried tweaking the material, the lighting, the mesh itself but can't find a awy to fix it. The corner triangles are too dark on the one side, and too bright on the other.

I don't mind experimenting with writing a shader but the Standard surface shader already has the same problem. alt text

Is there a way to fix the shading so it looks smooth?

meshterrain.png (357.0 kB)
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 Cherno · Nov 26, 2017 at 09:49 PM 0
Share

You need to assign the normals of the mesh. Check the Scripting API and User $$anonymous$$anual for Unity's mesh class.

avatar image Txguug · Nov 27, 2017 at 08:15 AM 0
Share

I already run $$anonymous$$esh.RecalculateNormals after the mesh is created, does that not assign them automatically? The texture is actually applied well (just a simple grid texture).

2 Replies

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

Answer by Remy_Unity · Nov 27, 2017 at 12:34 PM

It clearly seem to be related to the mesh normals. When you use Mesh.RecalculateNormals, Unity simply creates the normals by looking at the shared vertices between triangles. Looking at your mesh, I guess that each quad is a separate mesh element (not separate mesh renderer, they just don't share vertices). If you want to have a hard edge at your corner, you need to separate the triangles that lay there : 2 triangles, 6 vertices (not 4), by doubling the vertices shared by the "hypotenuse".

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 Txguug · Nov 27, 2017 at 01:10 PM

  you need to separate the triangles that lay there : 2 triangles, 6 vertices (not 4), by doubling the vertices shared by the "hypotenuse". 


I think I understand,

so (using quads) instead of

(a)(b)

(c)(d)

with triangles (a,b,c) and (c,b,d)

iI'll try

(a)(b,c)

(d,e)(f)

with triangles (a,b,d) and (e,c,f)

Comment
Add comment · Show 1 · 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 Remy_Unity · Nov 27, 2017 at 01:19 PM 0
Share

Yep, should do the trick !

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

97 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

Related Questions

Fresnel shader and mixed textures 0 Answers

Adding custom materials that are made using shadergraph to terrains 1 Answer

Laying a texture over an entire terrain 1 Answer

Highlighting an object just like in Editor Scene View 0 Answers

String name for particles / additive soft particles factor 1 Answer


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