Custom Normals transfer editing from mesh in world position

   794   2   2
User Avatar
Member
4 posts
Joined: April 2022
Offline
Hello,

I’m trying to reproduce in Houdini the normal transfer rendering from Blender using the Data Transfer modifier from face corner data "custom normals" from mapping mode "Nearest and best matching fce normal". The goal is to transfer normals from a simple cube to a custom mesh.

I’m struggling to get it right—I mean like inside Blender, which is perfect for my purpose.

I’ve promoted my normals, points, and other attributes from the cube, use attrib transfer/copy but the results still differ between the two software.

For example, following the attrib data transfer I got the low poly/facet aspect but there aren’t any sharp edges on specific zones like inside Blender.
Any ideas? Thanks in advance .

Attachments:
1.PNG (698.7 KB)

User Avatar
Member
406 posts
Joined: April 2017
Offline
I'm not entirely sure I got this right, but based on the description from Blender's docs I might have a solution.

I'm using VEX to get the nearest point of the cube to each primitive, find all vertices associated with that point, then get the primitive normal associated with each vertex and find the one that's most similar to the current primitive of the geometry we're transferring to:

// get nearest point on cube surface.
int nearpt = nearpoint(1, @P);
// get all vertices from this point.
int verts[] = pointvertices(1, nearpt);
// get all prims sharing this vertex, and get the normal of each prim.
// use the best matching normal to bind to N.
float dot = -1;
vector N;
for(int i=0; i<len(verts); i++) {
int prim = vertexprim(1, verts[i]);
// get normal of this prim
vector primn = prim_normal(1, prim, 0.5, 0.5);
// compare to current normal.
float test = dot(primn, @N);
// if this is a better match, save it.
if(test > dot) {
dot = test;
N = primn;
}
}
// bind the best match to N.
@N = normalize(N);

Attaching the hip file.

Attachments:
nearest_and_best_match_toadstorm.hip (286.8 KB)
test.png (2.7 MB)

MOPs (Motion Operators for Houdini): http://www.motionoperators.com [www.motionoperators.com]
User Avatar
Member
4 posts
Joined: April 2022
Offline
Thanks a lot for the help! We're definitely getting close to the look of Blender's modifier. Now I just need to isolate the mesh into its outer and inner parts in order to reduce the light leaking that's occurring.A measure sop would make the job.
Thanks again !
Edited by TDy - May 21, 2025 11:04:36
  • Quick Links