My screenshot describes my question clearly (better than words I think)
So, is it possible to have more control with the UV mapping and decide which portion of the texture to map on the Mesh (in a tiling style).
My screenshot describes my question clearly (better than words I think)
So, is it possible to have more control with the UV mapping and decide which portion of the texture to map on the Mesh (in a tiling style).
At this point are you familiar with the uv array? Unity - Scripting API: Mesh.uv
which is just part of Mesh Unity - Scripting API: Mesh
Based on what you have described: Just play with uv values of 0.0, 0.5 and 1.0.
You’ll soon get the idea! Your image just goes from 0 to 1 in each direction, it’s that simple. Your quadrants are just the obvious. DRAW A DIAGRAM of your eight triangles and start setting the uvs. Enjoy!
if you get big into vertices consider this fount of interesting information and downloads, etc etc Lower-level way to find NEARBY TRIANGLES on the mesh? (Answered.) - Questions & Answers - Unity Discussions
Now here’s a diagram:
large image: CLICK HERE TO SEE DIAGRAM PROPERLY
So, say you want your ELEPHANT to appear in area D. The elephant obviously enough exists at the coords I have written here…
Your area D is two triangles (7 and 8). So … there are six verts (two triangles … 2x3 = 6 !!) Just set the six verts to those values!! 0,5 etc. It’s that simple !!!
OF COURSE as Owen points out, this “hello mesh” exercise only works if everything is completely regularly-spaced and so on. Enjoy!
#Helpful notes
If you’re learning to make procedural mesh … why bother? There’s always an easier way!
When you’re making procedural mesh, DO NOT BOTHER trying to make “shared” vertices in the vertices array.
When making procedural mesh, it is (typically) poor practice to bother trying to share the verts in the vert array.
Don’t forget to play with the normals too! Try adding a torque to the normals and precessing them!!
If, ignoring point 1, you decide to get in to making mesh. It is utterly critical to remember. When it comes to doing the actual weave, YOU MUST DRAW A DIAGRAM. Please do not ignore this point for your own sanity!
Read point 5 over and over.
Don’t forget thee tris are CLOCKWISE in unity. I think.
It is critical that one fully internalises the following…
Detecting mesh orientation - Questions & Answers - Unity Discussions (thank God for Whydoidoit)
it is critical one understands the common misunderstanding even sophisticated people make, which is explained in extravagant length here
Triple-check - have you addressed point 6?
Also address point 5 !!
The hitchhiker’s guide suggests that anyone who weaves mesh prefers a Canson “Croquis” 90g/m2 sketch block (the one with the orange cover) for drawing diagrams - I have one of the rare A3s just now, it’s great. Of course, you could use any sketchpad, but you know what Einstein said. Enjoy!
It would probably be easier to just use 4 planes, then 4 materials (one for each numeral,) which you swap in and out. Other approaches might squeeze out a little more speed, but I not much and you probably won’t need it.
Moving around UVs can easily stretch your texture, flip it, repeat … . But to have a “non-continuous” texture, like the four 1’s, all of the interior verts would need to have been previously split in the modelling program. That’s just a basic concept in unwrapping.
If you did that then you could code using mesh
to hand-set all 16 UV coords, but a giant pain looking up that the middle-right vert is stored in slot #7, etc… .
You could also write a custom shader, which would work for a 4-vert plane. For example, if(uv.x>0.5 && uv.y<0.5) uv.x-=0.5;
would shift the 3 into the 4 slot(?). But there are 256 combinations, and might take several very mathy shades to cover them all.
So, I decided to make the mesh of my plane a bit simpler and made it only one cell rather than four cells.
It seems to work great, only the numeral ‘2’ tile of my image appears on my plane when I play-test Unity.
So, if I come back to my previous four-cells plane example, it would be impossible to have the same results without adding more vertices (splitting) as Owen instructed?