BLACKISH DEV BLOG Support
 

 

Smoothing Across Meshes

I don’t want much. I just want to split a mesh into multiple pieces and still have it look smooth. Took me a while to fix this, but here’s what’s required:

To make an object that consists of multiple meshes and materials look smooth you need to make sure that all vertices in identical positions also have identical normals and tangents. Here’s why: if you split the mesh there will be vertices in identical positions (one belonging to one mesh, one to the other) and they might not have their normals pointing in exactly the same direction. But only if identical vertices have identical normals and identical tangents will the shader be able to display a smooth transition.

Have a look at this image to understand why there will be multiple vertices in the same position:

Make sure you have smoothing on when exporting/importing the mesh, or else you’ll have lots and lots of identical vertices (since those are required to create the faceted look in the first place)…

And you also need to make sure that the different materials are set up correctly – if the specular color, shininess or height aren’t the same values, it won’t match even if everything else is spot-on.

Now to the Unity part: Fix the normals (remember my post about blowing up a mesh – that’s a good starting-point for finding identical normals), then use this script to recalculate the tangents and you’ll be fine (this will work because the tangents are calculated from the normals)

PS: Why split it anyhow? Well, a lot of older systems can only support textures up to 1024×1024, so if I want to have a lot of detail on one object (in my case a globe that you can zoom in on), I need to split it and use multiple textures. In my case I have one 8192×4096 texture that I split into 32 1024×1024 pieces.

Bookmark the permalink. Follow any comments here with the RSS feed for this post. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>