30 cavities = edges = 0.0f;
39 const WorldData &world_data = world.world_data;
62 for (
int i = sample_start; i < sample_end && i < 512; i++) {
65 float3 sample_coord = cavity.cavity_samples[i].xyz;
68 dir_jittered.xy *= sample_coord.
z +
noise.b;
70 float2 uvcoords = screenco + dir_jittered * offset;
76 float s_depth =
texture(depth_tx, uvcoords).r;
78 bool is_background = (s_depth == 1.0f);
80 s_depth = (is_background) ?
depth : s_depth;
89 float f_cavities =
dot(dir, normal);
90 float f_edge = -f_cavities;
91 float f_bias = 0.05f *
len + 0.0001f;
96 if (f_cavities > -f_bias) {
97 cavities += f_cavities * attenuation;
100 if (f_edge > f_bias) {
101 edges += f_edge * attenuation;
bool any(VecOp< bool, D >) RET
VecBase< bool, D > greaterThan(VecOp< T, D >, VecOp< T, D >) RET
float dot(VecOp< float, D >, VecOp< float, D >) RET
constexpr T clamp(T, U, U) RET
float length(VecOp< float, D >) RET
TEX_TEMPLATE DataVec texture(T, FltCoord, float=0.0f) RET
SamplerBase< float, 2, false, false, false, true > sampler2DDepth
SamplerBase< float, 2 > sampler2D
ccl_device_inline dual1 len(const ccl_private dual< T > &a)
float3 normal_decode(float4 enc)
void cavity_compute(const workbench::Cavity &cavity, const workbench::World &world, ViewMatrices view, sampler2DDepth depth_tx, sampler2D normal_tx, float2 screenco, float &cavities, float &edges)
float3 point_screen_to_view(float3 ssP) const
float cavity_sample_count_inv
float cavity_valley_factor
float cavity_jitter_scale
float cavity_ridge_factor
const float4(& cavity_samples)[512]