One-parameter shader

calendar_today

04.09.2022

label

Rendering

mouse

Houdini 18.0

1 Description

A minimalist one-parameter shader that smoothly runs from emissive (0.0), over translucent (0.75), to diffuse (1.0) and opaque (1.25) to metallic (2.0).

float shading = chf('shading');
vector color = chv('color');

vector pos_light = {2.6, 1.2, 0.6};
vector dir = normalize(pos_light - v@P);

float lumen = max(1.0 - shading, 0.0);
float angle = max(dot(dir, v@N), lumen);
shading = fit(shading, 1, 2, 1, 20);
float shade = pow(angle, max(shading, 1.0));

v@Cd = color * shade;