Array
(
    [data] => Array
        (
        )

    [url] => https://analytics.dw-herrmann.de?module=API&method=Actions.getPageUrl&pageUrl=pressing-meshes-against-a-plane&idSite=1&period=year&date=today&format=JSON&expanded=1
    [nb_visits] => 0
    [message] => Fehler bei der Verbindung zur Matomo API: 
)
dump content
Array
(
    [data] => Array
        (
        )

    [url] => https://analytics.dw-herrmann.de?module=API&method=Actions.getPageUrl&pageUrl=pressing-meshes-against-a-plane&idSite=1&period=year&date=today&format=JSON&expanded=1
    [nb_visits] => 0
    [message] => Fehler bei der Verbindung zur Matomo API: 
)
Pressing Meshes against a Plane | procegen

Pressing Meshes against a Plane

calendar_today

03.11.2023

label

Modeling

mouse

Houdini 19.5

Description

Projecting parts of a mesh onto a plane using the planepointdistance-function combined with a dot product to determine sides.

1 Code

The planepointdistance function returns the closest position p on the plane for the mesh to press against. The signed dot product compares the direction towards the plane dir versus the planes normal nml to later only deform the part of the mesh that lies behind the plane. in and out parameters inside a smooth function make the pressing fade out over distance, stored in bias. Similarly, a mask is defined to later drive a blur node which smoothes out the deformation area.

C
        // PARAMETERS
float in = chf('in');
float out = chf('out');
float off = chf('offset');
float soft = chf('soften');

// PLANE
vector p;
vector pos_pt = point(1, 'P', 0);
vector nml = prim_normal(1, 0, vector(0.0));
float d = planepointdistance(pos_pt, nml, v@P, p);
vector plane = p + normalize(nml) * off;

// MASK
vector dir = normalize(pos_pt - v@P);
float angle = dot(dir, nml);
float sdist = sign(angle) * d;
float bias = smooth(-out, in, sdist);
float mask = smooth(-soft, soft, sdist);
vector pos = lerp(v@P, plane, bias);

// OUTPUT
f@mask = mask;
v@P = pos;
    
download

Downloads

link

Related articles

favorite

150

edit_calendar

visibility

0

label

Modeling

Adaptive Resampling of Curves

favorite

301

edit_calendar

visibility

0

label

Modeling

Applying Scales to Mesh Surfaces

favorite

247

edit_calendar

visibility

0

label

Modeling

Approximating subdivision surfaces

favorite

199

edit_calendar

visibility

0

label

Modeling

Blending COPs SDFs into 3D Volume

favorite

291

edit_calendar

visibility

0

label

Modeling

Branching Subdivision Curves

favorite

143

edit_calendar

visibility

label

Modeling

Circuit Networks