Question about Texture Atlasing and UV ?

So i been making a voxel world. I got all the cubes procedurally generating but have problem with adding texture to them. I’m using texture atlasing as i can have all the texture in one image. problem is i cant get the uv set up properly as u can see in the image below. it shows the whole image instead of the brown or green colour.


FProceduralMeshVertex v0;
					FProceduralMeshVertex v1;
					FProceduralMeshVertex v2;
					FProceduralMeshVertex v3;
					v0.U = 0.f; v0.V = 0.f;
					v1.U = 0.f; v1.V = 1.f;
					v2.U = 1.f; v2.V = 1.f;
					v3.U = 1.f; v3.V = 0.f;

The UV space goes from 0.0 to 1.0, that’s why you get the whole texture. You can try to divide the size of your colored patches by the texture width or height to get correct UV coordinates.