• 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 zastear · Feb 01, 2020 at 03:43 PM · meshshadersuvvertexdisplacement

Mesh breaks apart when using vertex displacement with shadergraph.

Hello, the problem I'm having is that the face's of my meshes are breaking apart when using my little shader. This doesn't seem happen to the sphere.

So... how can I create a mesh that behaves like the sphere and well... stays intact :).

So here is whats happening: alt text


And thats the shader: alt text

2020-02-01-16-09-50-window.jpg (27.7 kB)
2020-02-01-16-07-14-window.jpg (82.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

2 Replies

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

Answer by Bunny83 · Feb 01, 2020 at 06:36 PM

That's not possible unless you base your displacement only on the original vertex position. That's because different faces where you have a UV seem have seperate vertices at the same corner. So the faces are not "connected" in any way. Since you offset your vertices along the vertex normal you will offset the vertices which actually belong to the same position into different directions. So you're moving them apart.


When you have a shared mesh this is not that of an issue since there are (almost) no duplicate vertices. A Sphere doesn't have any issues at the UV seems since the vertices actually have the same normal at the same point. This is not true for most other (hard edge) shapes. Keep in mind that shaders always work on individual vertices (vertex shader) and on individual triangles which are rasterized independently from each other. So a shader can not take other neighboring faces into account. If you want to apply such an effect you either need to provide more information per vertex, or use a different approach. For example instead of using the vertex normal you might want to use the vector from the object origin (in other words the normalized local space coordinate of that vertex). Of course that would only work properly when the origin is somewhat in the center of your mesh.

Comment
Add comment · Show 2 · 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 zastear · Feb 01, 2020 at 07:22 PM 0
Share

I think I understand :) Now I just need to figure out how to do that with the object origin. Thank you alot, I feel like I became smarter.

avatar image Bunny83 zastear · Feb 02, 2020 at 01:01 AM 0
Share

I haven't really used Unity's shader graph yet. However ins$$anonymous$$d of your "normal" node you should be able to just use the vertex position and normalize it first. This gives you a direction vector from the object's origin to the vertex.


If you want / need to specify a different center position manually, you have to add a property which you can set from C# to specify the center of your object in local space and just subtract that vector from your vertex position before normalizing it .

avatar image
0

Answer by nicholascarrow · Mar 25 at 06:54 AM

you can also try to set your meshes to shade smooth in blender and import them 180 smoothing angle, that might fix it for you

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

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

How to set float or float4 UV in Mesh. 1 Answer

uv sub meshes in cube c# 0 Answers

Understanding verts and triangles in Unity 1 Answer

Calculate UV coordinates of 3D point on plane of mesh's triangle 1 Answer

How to split UV in Mesh 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