- Home /
Problem is resolved, and question doesn't actually apply to the problem
How to generate UVs on a mesh that isn't flat on any axis?
I have a procedurally-generated mesh that I need to generate UVs for. The problem is that all of the triangles are at angles on all of the axis, since the y-values are changed based on Perlin noise and the x- and z- are what forms the top-down square shape of the mesh. Since UVs are a Vector2, I'm not sure how to translate that to the curved shape of the mesh.
Edit: My issue is that there is what looks like a black plane going through the mesh. Here's some pictures of it. I was thinking this was caused by the UVs being wrong, but it may not be. The first is a picture of the side view of the mesh in the scene, showing the black part. And the second is something I just noticed - the bottom of the mesh in the inspector view (like when you click on the asset from the folders in the project tab) looks different than the top - bigger triangles. I think that may be related to my issue, but I have no idea why that is.
this mostly depends on how you want this setup. usually you just assign the front left vertex a Vector2.zero and the rear right a Vector2.one. The question is how you interpolate the rest in between. will it be flat mapped, like when looking from the top giving values based on their xz position, or does it depend on how big the faces are?... you have to decide that first.
@hexagonius If I map it on the x-y, where do the z-values fall in? Do I account for them at all? The mesh is going to be walked on by the player, so I need it to look alright when they look down or straight across from their position on top of it. Figuring out how to make that work is what I'm struggling with.
Oh, okay. Do I need to adjust for the y then (going along the x-z)? I have tried just going across the xz, but then there's a plane through the mesh that is black on the bottom. I'm pretty sure this is because of the lack of adjustment of UVs on the y -axis - maybe not though?