Subsurface Vex Function

   3215   6   3
User Avatar
Member
40 posts
Joined: Oct. 2012
Offline
Is there a subsurface vex function like rsl has? Judging by both renderers, both use point clouds and behave quite similar.
If not is there a work around ? I am using vex code.
User Avatar
Member
1002 posts
Joined: July 2005
Offline
There is no subsurface() function in VEX. To see how to call SSS code from VEX your best bet would be to look at the implementation of the “Physical SSS” VOP - of if you can use VOPs, this node would be used directly or through the surface model VOP. To see the VEX code, look in the “Type Properties” code tab.
User Avatar
Member
40 posts
Joined: Oct. 2012
Offline
Thanks for the reply andrew. I was wondering if there is any documentation on the vop_sss_multi() and vop_sss_single() vex functions. I can understand some of the inputs but there is still a lot of confusion on all the inputs required for the function. I can't seem to find it anywhere in the houdini documentation.

I was wondering whether the artistic mental ray fast skin shader compares to multiple single scatters or multiscatter functions.
I am basically trying to create a mental ray like subsurface scattering function so artists who are maya users can easily jump in. I got most of it working, its just the models I am a little confused about. In rsl I would use three multiscatter subsurface() functions for each epidermal, subdermal and backscatter layers but as you can tell its different in houdini.
Edited by - May 23, 2013 16:51:13
User Avatar
Staff
2540 posts
Joined: July 2005
Offline
The functions are defined in $HFS/houdini/vex/include/voplib.h.

There you can find the vex function along with some inline help.

Nothing stopping you from including this and voptype.h and use those functions in your vex code.
There's at least one school like the old school!
User Avatar
Member
40 posts
Joined: Oct. 2012
Offline
Sweet Sweet Sweet!! Thank you!!
User Avatar
Member
40 posts
Joined: Oct. 2012
Offline
Ok I am encountering a weird problem. I get an extreme of values. At certain point of the scatter density I get extremely deep blown out subsurface encompassing the entire model and a few values lower I get no subsurface at all. The points in between give either of the two extremes. The point cloud file is generated by the mantra surface shader. This is not behaving the way I want it to. I want it to behave more like the mental ray fast skin.
Here is the snippet of the code

if(filenamePTC != “”)
{
printf(“Point Cloud File: ”+filenamePTC + “ Loaded”);
if(frontSSS_weight != 0.0)
{
float front_sd = frontSSS_sd * unitlength;
frontSSS = vop_multiSSS(P,N,frontSSS_albedo,frontSSS_sd, frontSSS_bounceAtten ,filenamePTC,frontSSS_nfp, frontSSS_tRGB);
}

if(frontSSS_useRim != 0 )
{
dot = 1 - dot(Nf,V);
edge = smooth(1.0 - frontSSS_rim_width, 1.0, dot);
frontSSS_Final = frontSSS * edge * frontSSS_weight;
}
else
frontSSS_Final = frontSSS * frontSSS_weight;

if(midSSS_weight != 0.0)
{
float mid_sd = midSSS_sd * unitlength;
midSSS = vop_multiSSS(P,N,midSSS_albedo,midSSS_sd, midSSS_bounceAtten ,filenamePTC,midSSS_nfp, midSSS_tRGB);
}

if(midSSS_useRim != 0 )
{
dot = 1 - dot(Nf,V);
edge = smooth(1.0 - midSSS_rim_width, 1.0, dot);
midSSS_Final = midSSS * edge * midSSS_weight;
}
else
midSSS_Final = midSSS * midSSS_weight;

if(backSSS_weight != 0.0)
{
float back_sd = backSSS_sd * unitlength;
backSSS = vop_multiSSS(P,N,backSSS_albedo,backSSS_sd, backSSS_bounceAtten ,filenamePTC,backSSS_nfp, backSSS_tRGB);
}

if(backSSS_useRim != 0 )
{
dot = 1 - dot(Nf,V);
edge = smooth(1.0 - backSSS_rim_width, 1.0, dot);
backSSS_Final = backSSS * edge * backSSS_weight;
}
else
backSSS_Final = backSSS * backSSS_weight;
}
sssFinal = frontSSS_Final + midSSS_Final+ backSSS_Final;
Cf = Of*(amb+diff+sssFinal)*Cf + (spec + blinn_specularity + reflectionColor);

Is it a shortcoming of the multiSSS model or am I doing something terribly wrong.
I am attaching the otl and helper files as well
This only works with micropolygon and raytracing at the moment.

Attachments:
Blinn_H.h (1.7 KB)
OPcustom.otl (90.7 KB)

User Avatar
Member
40 posts
Joined: Oct. 2012
Offline
Nvm figured it out. Had to lerp it with the diffuse component
  • Quick Links