Projecting to subdivision limit surfaces

calendar_today

08.10.2022

label

Modeling, VEX, Subdivision

mouse

Houdini 19.5

1 Introduction

Projecting curves or meshes directly onto other meshes results in faceted looking surfaces (left image). However, when projecting to the the limit surface using OpenSubDiv (OSD), we'll receive a smooth alignment to its Catmull-Clark subdivision surface (right image).

2 Code discussion

The main functions for accessing the limit surface are osd_lookuppatch() and osd_limitsurface(). To get started, we could either use the ray node, the intersect()-, xyzdist() or – like in this case –the uvdist()-function, which all return the closest primitive number and the UV position on that particular polygon face.

Next we feed in a primitive number and the UV position on the primitive into osd_lookuppatch() to receive a patch number and the U and V coordinates on the patch. Both, the patch number and the UVs, are then fed to the osd_limitsurface() which returns the smooth world positions that are located right on the subdivision limit surface.

int prim_hit;
vector uvw;
uvdist(1, 'uv', v@uv, prim_hit, uvw);

int patch;
float patch_u;
float patch_v;
osd_lookuppatch(1, prim_hit, uvw[0], uvw[1], patch, patch_u, patch_v);

osd_limitsurface(1, 'P', patch, patch_u, patch_v, v@P);

3 Examples

In depth technical explanations and more production-ready examples on this subject are available by Yunus 'animatrix' Balciouglu on the SideFX website.

download

Downloads

smart_display

Videos

OpenSubdiv surfaces with VEX - Houdini Tutorial