attribute convolve/kernel node in SOPS?

   666   2   1
User Avatar
Member
355 posts
Joined: 11月 2015
Offline
Is there a node inside houdini where we can input custom convolve values on attributes? say a 3x3 convolve filter or something like that? or the only options are to write your own in vex/opencl? the attrib blur is great but would want a bit more control.
hou.f*ckatdskmaya().forever()
User Avatar
Member
4516 posts
Joined: 2月 2012
Offline
There is Volume Convolution SOP for volumes but no Attribute Convolution SOP for arbitrary geometry.

In Houdini, applying a uniform stencil like a 3x3 filter to attributes of arbitrary point-based geometry can be quite challenging. This is because in a geometric context, points can have an arbitrary number of neighbors, depending on their spatial distribution and the search radius used to define 'neighbors'.

This is different from volumetric data, which is grid-based and has a uniform, structured layout. In a volume, each voxel has a fixed number of neighbors (assuming we're working within the volume boundaries), which makes it straightforward to apply a uniform filter or stencil like a 3x3 convolution filter.

In point-based geometry, the concept of a '3x3' filter doesn't map as cleanly because of the unstructured nature of the data. If we use a function like pcfind or neighbours to find the neighbors of a point, we can end up with a variable number of neighboring points, which would require a dynamic filter size, rather than a fixed '3x3' filter.

That's not to say you can't do some sort of convolution-like operation with point attributes, but it would require a more complex approach that takes into account the varying number of neighbors for each point and their relative positions. For example using functions like pcfind or neighbours to define a neighborhood around each point, and then apply custom weights to these points.

It won't be a strict '3x3' grid like in volume data, but it will allow for a convolution-like operation that takes into account the unique structure of point-based geometry.

pcfilter [www.sidefx.com] function is actually one example of such an approach.

float pcfilter(int handle; string channel)
{
    float    sum, w, d;
    float    value, result = 0;
    while (pciterate(handle))
    {
        pcimport(handle, "point.distance", d);
        pcimport(handle, channel, value);
        w = 1 - smooth(0, radius, d);
        sum += w;
        result += w * value;
    }
    result /= sum;
    return result;
}

To add to this discussion, for anyone seeking a more comprehensive understanding of these topics, Pragmatic VEX: Volume 1 [www.pragmatic-vfx.com] covers them in great depth. This course delves into several related concepts such as Convolution Kernels, Connectivity & k-Depth Point Neighbours Using Edges and Primitives, Border Handling, Blurring, Sharpening, smoothstep, and more. It provides a practical guide for anyone wishing to understand these principles more thoroughly.
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]

youtube.com/@pragmaticvfx | patreon.com/animatrix | animatrix2k7.gumroad.com
User Avatar
Member
355 posts
Joined: 11月 2015
Offline
animatrix_
There is Volume Convolution SOP for volumes but no Attribute Convolution SOP for arbitrary geometry.

In Houdini, applying a uniform stencil like a 3x3 filter to attributes of arbitrary point-based geometry can be quite challenging. This is because in a geometric context, points can have an arbitrary number of neighbors, depending on their spatial distribution and the search radius used to define 'neighbors'.

This is different from volumetric data, which is grid-based and has a uniform, structured layout. In a volume, each voxel has a fixed number of neighbors (assuming we're working within the volume boundaries), which makes it straightforward to apply a uniform filter or stencil like a 3x3 convolution filter.

In point-based geometry, the concept of a '3x3' filter doesn't map as cleanly because of the unstructured nature of the data. If we use a function like pcfind or neighbours to find the neighbors of a point, we can end up with a variable number of neighboring points, which would require a dynamic filter size, rather than a fixed '3x3' filter.

That's not to say you can't do some sort of convolution-like operation with point attributes, but it would require a more complex approach that takes into account the varying number of neighbors for each point and their relative positions. For example using functions like pcfind or neighbours to define a neighborhood around each point, and then apply custom weights to these points.

It won't be a strict '3x3' grid like in volume data, but it will allow for a convolution-like operation that takes into account the unique structure of point-based geometry.

pcfilter [www.sidefx.com] function is actually one example of such an approach.

float pcfilter(int handle; string channel)
{
    float    sum, w, d;
    float    value, result = 0;
    while (pciterate(handle))
    {
        pcimport(handle, "point.distance", d);
        pcimport(handle, channel, value);
        w = 1 - smooth(0, radius, d);
        sum += w;
        result += w * value;
    }
    result /= sum;
    return result;
}

To add to this discussion, for anyone seeking a more comprehensive understanding of these topics, Pragmatic VEX: Volume 1 [www.pragmatic-vfx.com] covers them in great depth. This course delves into several related concepts such as Convolution Kernels, Connectivity & k-Depth Point Neighbours Using Edges and Primitives, Border Handling, Blurring, Sharpening, smoothstep, and more. It provides a practical guide for anyone wishing to understand these principles more thoroughly.

Ahh, I totally get this, lol, I realized that it wasn't easy, I started thinking about using things like pccone and tangent fields to find neighbors lol. But using volumes is much more practical. Thanks for such an in-depth response.
hou.f*ckatdskmaya().forever()
  • Quick Links