Jump to content

One-parameter shader


Recommended Posts

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

shading_values.thumb.jpg.029e8beb22ec12cd269ce97fa4460eb9.jpg

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;

 

shading.hipnc

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...