I wanted to map the parametric uvs of each primitive to the actual vertex uvs. Is there any way to do this?
Currently I am running a loop over all primitives in detail mode and hard-code uv values on each vertices of each primitives.
i[]@prims = expandprimgroup(0,""); foreach (int prim; @prims){ i[]@vts = primvertices(0,prim); addvertexattrib(0, "uv", {1,1}); setvertexattrib(0, "uv", @primnum, @vts[0], {0,0},"set"); setvertexattrib(0, "uv", @primnum, @vts[3], {1,0},"set"); setvertexattrib(0, "uv", @primnum, @vts[2], {1,1},"set"); setvertexattrib(0, "uv", @primnum, @vts[1], {0,1},"set"); }
But I want a simple approach to do the same,I expect something like @uv = @parametricuv;
Please let me know if you have any tricks.
Also there is another problem , i tried to run the code in primitive mode but strangely it doesnt work attached an image of that
i[]@vts = primvertices(0,@primnum); setvertexattrib(0, "uv", @primnum, @vts[0], {0,0},"set"); setvertexattrib(0, "uv", @primnum, @vts[3], {1,0},"set"); setvertexattrib(0, "uv", @primnum, @vts[2], {1,1},"set"); setvertexattrib(0, "uv", @primnum, @vts[1], {0,1},"set");
Thanks.