![]() ![]() Vector2 scale = new Vector2(_size/ _resolution.x, _size / _resolution.y) public Mesh GenerateGrid(Vector2Int _resolution, float _size = 1) Here is the full code made mostly from this tutorial for the mesh grid generation if that helps. ![]() Feel free to recommend another approach to this if you think of something off the top of your head. With this data I could draw each triangle with the color of the uv coordinate of its center with a shader, then use another shader to sample that as with screen coordinates to get triangulate pixels, which is my eventual goal. I've seen a lot of questions on this site and other places asking for the opposite of uv position from face data, but unfortunately their conversions do not work the other way. I looked everywhere for somebody else who tried to get face data from uv data but found nothing. I have a square mesh of triangles, 100 by 100 vertices, which has uv coordinates generated automatically from the x and y position of the verticies divided by the "resolution" of 100x100 where x and y are values from 0 to resolution.x and from 0 to resolution.y respectively. But, I'm trying to get the face data from uv data. Either the index for mesh.vertices from which I can get the vertices of a triangle with index, index + 1, and index + 2, or any other data that would be unique to any given face would do. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |