Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 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
1
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

3 Replies

· Add your reply
  • Sort: 
avatar image
3
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 1
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
1

Answer by FinXzuOP · Nov 29, 2021 at 07:07 AM

nicholascarrow is right. The problem lays in your normals. If your object/edges are shaded flat, the vertex at the edges do have splitted normals pointing in the direction of both faces they are connecting. If they are shaded smooth however there is only one normal pointing inbetween the two normals of the splitted normals.

Having only one normal istead of two means that your vertex only get displaced along one normal and there wont arise a gap inbetween your object do not have any faces for.,nicholascarrow is right. Just shade smooth your object. The problem is, that there are two normals for your vertex at the edges pointing 90 degree in the direction at the surface of your faces. If the edge is shaded smooth however you only have one normal instead of thwo, pointing at the degree midway inbetween your other two normals at the vertex. So your vertex only gets displaced along that one normal istead of two normals.

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 nicholascarrow · Mar 25, 2021 at 06:54 AM

you can also try to set your meshes to shade smooth in blender and to import them with a 180 degrees 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.

Follow this Question

Answers Answers and Comments

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

Related Questions

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

Understanding verts and triangles in Unity 1 Answer

uv sub meshes in cube c# 0 Answers

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