Do you think you could make a barycentric projection node?
inclusion.blend (1.1 MB)
I would like to use it to get the UV from the closest point on the closest face, and for my own tesselate system (to project geometry out of triangles)
Thanks
Also I was able to export animated mesh to alembic by deleting part of the code where its removes all copies, and used those copies to create animation
I am not familiar with barycentric projection I will have to look into it.
If I understand you wanna do mesh tessellation on triangular mesh instead of quad mesh?
I also need it to sample UV at a point relative to a face
in → v1.co,v2.co,v3.co,target, uv1,uv2,uv3 → out uv of target point
it works for projection of geometry out of triangles like I do with a quad here
in → v1.co,v2.co,v3.co,target, t2_v1.co,t2_v2.co,t2_v3.co → out transformed target point
true_tesselate_fix2.blend (1.1 MB)
I can do it in pure bpy*
parametric_BPR_update.blend (2.3 MB)
Here is example how I do it for tessellating triangles on triangular mesh
tess_triangles.blend (1.5 MB)
You can also use similar technique to project geometry to other mesh, by placing target geometry position to its UV map, and transferring position attribute
uv_project.blend (976.3 KB)
I am not sure if this exactly what are you looking for
in this image everything but ‘uv’ are inputs, and ‘uv’ would be what barycentric spits out
we can get the UV of a ray hitpoint using barycentric transform, or in my case - transfer over UV to a SDF generated by the mesh -
(get closest face) - (get closest point on face(proximity)) - (get UV per point in Generated SDF mesh from volume cube)
we can also use it to project geometry out a triangle
#this is the code to project geometry out a triangle - tapered by the average normal
for polygon in skinned.data.polygons:
#project a item out a triangle
if len(polygon.vertices)==3:
ob = tri_2 # Get the object
bpy.ops.object.select_all(action='DESELECT') # Deselect all objects
bpy.context.view_layer.objects.active = ob # Make the cube the active object
ob.select_set(True)
bpy.ops.object.duplicate()
mesh = bpy.context.selected_objects[0]
meshes.append(mesh)
p1 = skinned.matrix_world @ skinned.data.vertices[polygon.vertices[0]].co
p2 = skinned.matrix_world @ skinned.data.vertices[polygon.vertices[1]].co
p3 = skinned.matrix_world @ skinned.data.vertices[polygon.vertices[2]].co
#duplicate the item we are reprojecting and project it out the skinned object triangle
for vert in mesh.data.vertices:
#data = trimap[vert.index]
co = mesh.matrix_world @ vert.co
copy = co.copy()
copy.z = 0
p1b = p1+ (averaged[polygon.vertices[0]]* (co.z))
p2b = p2+ (averaged[polygon.vertices[1]]* (co.z))
p3b = p3+ (averaged[polygon.vertices[2]]* (co.z))
vert.co = mesh.matrix_world.inverted() @ mathutils.geometry.barycentric_transform(copy, p1a, p2a, p3a, p1b, p2b, p3b)
#vert.normal = mesh.matrix_world.inverted() @ ( skinned.matrix_world @ skinned.data.vertices[polygon.vertices[0]].normal)
I think the math is here*
I think I was able to make it
barycentric transform.blend (1.0 MB)
Regarding transferring UV to SDF mesh, can’t you just use Attribute transfer (Nearest Face Interpolated)? Isn’t it does the similar thing, finds closest point on triangle and does barycentric interpolation?
Hi! I’m exploring your Curve Deform nodegroup, and it works great on one mesh and one spline. But in my example i’m trying to deform instanced cubes along multiple splines (also deformed). It’s easy to translate instances along curves with just rotation alignment - you can see in my video example. But it’s not working when i’m trying to send instanced splines and cubes (realized) to your nodegroup, only able to choose one spline with index. Reference pic is attached. Thanks!
I think you just need to create Index value for each cube and plug it to “Curve Index”.
If cubes are instanced, capture instance index before realizing instances and plug it onto Curve Index
tesselate_tri_quad_1.blend (1.4 MB)
we can upgrade the tesselate node now to have input for what to put on each triangle /quad ?
(maybe rewrite helper too?)
edit - still needs Z axis ‘projected out normal’
Hey I’m out of the loop, how does this compare to the tesselate patch that floated around in wip state for some time? how did you get the barycentric coordinates?
@higgsas did it!!
Yes its using barycentric transform,
We can use it to get UV from points relative to a face also,