Smoothing in VOPs?

   1691   2   2
User Avatar
Member
34 posts
Joined: Nov. 2018
Offline
I'm wondering if there's a way to do smoothing or blurring in VOPs. I'd like to get results similar to the Smooth SOP node, but apply the smoothing to noises at the VOP level.

Ex. I have a plane with some Worley noise and I want to soften the hard edges.


The Smooth VOP node [www.sidefx.com] doesn't seem to handle smoothing as I'd expect. I can't seem to get the results I'm going for. Perhaps someone could shed some light on this node. Or perhaps there's another VOP that would be better suited for smoothing.

Another idea...

Writing a noise algorithm similar to Worley noise with softer peaks and valleys could be an option. I imagine it could be possible to take HLSL (say something on Shadertoy [www.shadertoy.com]) and convert it to something Houdini can handle. Would this be done using VEX and an Attribute Wrangle?
Edited by davidbk - Aug. 3, 2023 07:57:17
User Avatar
Member
34 posts
Joined: Nov. 2018
Offline
Thanks so much for this @vik_lc! That's great! I'm surprised you had to write your own smoothstep function because I assumed Houdini would already have it built in, but I guess not!
User Avatar
Member
5104 posts
Joined: Feb. 2012
Offline
You implement a basic smoothing at the VEX level using multisampling:



int seed = chi("seed");
float f1 = 0;
float f2 = 0;
vector p1 = 0;
vector p2 = 0;

int samples = chi("samples");
float sampleradius = ch("sample_radius");

vector pos [ ] = array ( );
for ( int i = 0; i < samples; ++ i )
{
    vector r = rand ( 8.12 * i + ( @ptnum + ( i + 453.2143 ) ) * 78.12235 );
    vector p = sample_sphere_uniform ( r ) * sampleradius;
    vector pnew = @P + p;
    append ( pos, pnew );
}

float f1sum = 0;
foreach ( vector p; pos )
{
    vnoise ( p, 1, seed, f1, f2, p1, p2 );
    f1sum += f1;[quote][/quote]
}

@P += @N * ( f1sum / samples );

But for more advanced smoothing with a lot more control, it's better to use SOPs.
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com] https://lnk.bio/animatrix [lnk.bio]
  • Quick Links