Page MenuHome

Simulate bounce light in cavity shading
Needs ReviewPublic

Authored by Sam (Sam200) on Apr 15 2019, 11:43 PM.

Details

Summary

I created a function that converts a scalar cavity factor into RGB, based on surface base color. It simulates the self reflections that happen inside cavities, producing shading that's closer to real life.

This is how cavity shading with simulated reflections looks like (shading options are: studio lighting, object color, “world” cavity valley set to 3.5):

And this is current master build shading:

The proposed shading is most appropriate for single color objects, since it assumes that a shaded point is occluded by surfaces of the same base color. Therefore, for scenes with many different colors, the current master build implementation might be more desirable.

I think it would be good to make this optional. In the shading popover, under cavity, there could be either a checkbox toggle or a slider that fades between the two methods.

Diff Detail

Repository
rB Blender

Event Timeline

Fixed a typo

I find those light bounce sexy. But I'm not sure how would peoples (specially sculptors) would like to see that change as it reduce the overall contrast.
Maybe @Julien Kaspar (JulienKaspar) has an opinion?

As for the implementation, gtao_multibounce() is already doing something similar (and is more grounded, less ad hoc). It would be interesting to see the difference (with colored bounce obviously).

Humm, interesting results but as a sculptor, the stronger the cavity effect, the better, for sculpting, contrast is better than realism, if we could control separately the hue, saturation and brightness of the cavity and ridges it would be perfect.

Sam (Sam200) added a comment.EditedApr 16 2019, 5:48 AM

This reduces contrast excessively mostly when the base color of the surface is set too bright. In the example image, the object base colors are actually set very bright to compensate for the rather dark studio lighting. Studio lights should be brighter so that material base colors can be kept at a more realistic level without making the scene look too dark. Base colors should never be brighter than 85% (linear) or so.

Also, keep in mind that contrast can be further increased by simply upping the cavity settings. So, I wouldn't be comparing contrast here, but more the overall aesthetic.

... if we could control separately the hue, saturation and brightness of the cavity and ridges it would be perfect.

I actually would like to treat cavity (world) and curvature (screen) differently in the shader. Use cavity to darken/lighten the mesh as it is now,but use curvature to tweak the object's base color.

In fact, I'm already playing around with layered matcaps, blended based on curvature. This is great for sculpting, allowing materials such as partially oxidized copper, oiled brass, worn down paint, and waxy clay, and many others. I'll make a post with some examples in a few days. I think you and I are looking for the same things when it comes to sculpting.

As for the implementation, gtao_multibounce() is already doing something similar (and is more grounded, less ad hoc). It would be interesting to see the difference (with colored bounce obviously).

Wow, didn't know that there was a function for that already. I'm curious how the two compare. I'll post a comparison image when I get the time.

Here's a comparison of my function versus the color version of gtao_multibounce(). First one is mine.


The difference is subtle, but mine tends to shift the hue a little more and create a slightly brighter shading.

Personally, I would love either one to be an option in the solid view. I don't mind if my function is not used. I wrote it a long time ago for a personal project.

A slider to fade between colorized and non-colorized cavity would be best.

Humm, interesting results but as a sculptor, the stronger the cavity effect, the better, for sculpting,

I agree. I actually don't care too much about the cavity options most of time time. They tend to make everything a bit more sexy but can give wrong impressions of the mesh.
If the colored Cavity doesn't reduce the contrast then I'm fine :)

Here's how I would organize cavity related settings.

In the solid view viewport shading popover:

  1. Split Cavity into Cavity (using world space) and Curvature (using screen space). That makes the interface simpler and allows adding more options without cluttering the panel.
  2. In both Cavity and Curvature sections:
    1. Add Effect pulldown with following options (more could be added in the future if needed):
      1. Shade: brightens ridges and darkens valleys like it does now, except an additional slider would be added to blend between black and colorized shadows.
      2. Color: replaces base color with the specified ridge color on ridges and the valley color on valleys. (This option could be useful for sculpting).
      3. Blend Matcap: This option would enable matcap layer blending if a layered matcap is selected (A layered matcap basically has more than one "ball" in its image. I will post more about that later, with example images). It would display a Blend Bias slider, ranging from 0 to 1. This setting would bias the blend towards either the first or last matcap layer. It would make sense for Blend Matcap option to still be selectable even for non-layered matcaps to keep the interface stable when switching between matcaps. However, the slider would be disabled for non-layered matcaps.

Here's a different model with bumped up cavity that hopefully shows that contrast is still possible for sculpting purposes.

could we get a soft limit for the sliders, so we can extrapolate if we really wanted?
And yes Please, a curvature blend matcap option would be fantastic for sculpting on a waxy, or oxidation material!

I personalty think sculpting with a translucent material look is sexier than the cavity effect itself

could we get a soft limit for the sliders, so we can extrapolate if we really wanted?

I'm not sure which sliders you are referring to.

And yes Please, a curvature blend matcap option would be fantastic for sculpting on a waxy, or oxidation material!

I personalty think sculpting with a translucent material look is sexier than the cavity effect itself

Layered matcaps are coming along nicely. I will probably post on right-click-select and drop a link here, when it's presentable.

could we get a soft limit for the sliders, so we can extrapolate if we really wanted?

I'm not sure which sliders you are referring to

I mean the settings of the cavity, that control the intensity of the crevices/ridges, would be better if they didn't had a hard limit.

@Jean Da Costa (jeacom256), you are right. For curvature ("local space" cavity), max value is 2.0. And even for ambient occlusion ("world space" cavity), where you can set any number, it will never brighten by more than a factor of 4.

Did you ever need to increase the effect beyond what's already possible? I'm curious, because I never did.

I did mostly for sculpting because as I said more contrast is better.