DASD Posted March 25, 2016 Share Posted March 25, 2016 1.How do you get UV density and UV distortion as a vertex attributes?2.How would you get UV overlap as a vertex attribute?3.How would you get UV direction (flipped UVs) as a vertex attribute? (I can think of ways to build this stuff, but I am looking for solutions that already exist. Packages like Maya give you this kind of information by default. I would imagine Houdini does too. ) Quote Link to comment Share on other sites More sharing options...
michael Posted March 25, 2016 Share Posted March 25, 2016 I can't think of anything out of the box that will provide these attributes... but it's a pretty good RFE Quote Link to comment Share on other sites More sharing options...
Atom Posted March 26, 2016 Share Posted March 26, 2016 What is UV density use for? I thought they were just coordinates for mapping. Quote Link to comment Share on other sites More sharing options...
acey195 Posted March 26, 2016 Share Posted March 26, 2016 The UV density would be the ratio of UV space to object space I suppose, which is also related to how you would compute the distortion. The larger the difference is between the shape (not size) of the UV polygon compared polygon shape, the more distortion you have, which is always >0 for organic models, unless you cut out every uv polygon separately (which is a lot worse for texturing purposes) Quote Link to comment Share on other sites More sharing options...
DASD Posted March 30, 2016 Author Share Posted March 30, 2016 (edited) With distortion I mean how far the UV triangle shapes deviate from their 3D polygon shape. And with density I mean how small or large UV triangles are relative to each other (compensated for the original 3D polygon size). For an optimal unwrap distortion would be low and density variation would be low too. Edited March 30, 2016 by DASD Quote Link to comment Share on other sites More sharing options...
acey195 Posted February 16, 2018 Share Posted February 16, 2018 (edited) Sometimes when you are searching for something and you find a topic you visited a long time ago, but no new posts were made in the meantime.. I guess that is a call to action The following code outputs 2 vertex attributes related to distortion; one is the angle difference between uv and world, vertex corners the other gives the edgeLength ratio difference between the in and outgoing edge of every vertex. Afterwards you can of course use an attribute promote to get the average primitive or point distortions of course or you can merge the distortion into a single attribute by taking the maximum value for example //run over vertices: //get neighbouring verts int locVert = vertexprimindex(0, @vtxnum); int prNumVerts = primvertexcount(0, @primnum); int vtx0 = primvertex(0, @primnum, (locVert - 1) % prNumVerts); int vtx1 = primvertex(0, @primnum, (locVert + 1) % prNumVerts); //printf("%d - %d - %d\n", vtx0, @vtxnum, vtx1); //get world posData vector p0 = vertex(0, "P", vtx0); vector p1 = vertex(0, "P", vtx1); p0 = v@P - p0; //get position edges p1 = p1 - v@P; float posEdgeL0 = length(p0); //get position edge lens float posEdgeL1 = length(p1); p0 /= posEdgeL0; //normalize pos edges p1 /= posEdgeL1; //get uv posData vector uv0 = vertex(0, "uv", vtx0); vector uv1 = vertex(0, "uv", vtx1); uv0 = v@uv - uv0; //get uv edges uv1 = uv1 - v@uv; float uvEdgeL0 = length(uv0); //get uv edge lens float uvEdgeL1 = length(uv1); uv0 /= uvEdgeL0; //normalize uv edges uv1 /= uvEdgeL1; //get edgeRatios posEdgeL0 /= posEdgeL1; uvEdgeL0 /= uvEdgeL1; //compare world and uv data float worldDot = dot(p0, p1); float uvDot = dot(uv0, uv1); f@uvDistortAng = abs(worldDot - uvDot); //this value should be between 0 and 2 f@uvDistortLen = abs(posEdgeL0 - uvEdgeL0); //you may want to normalize this value in a different node later Edited February 16, 2018 by acey195 3 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.