Blender V5.0
eevee_film_shared.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#pragma once
10
12
13#ifndef GPU_SHADER
14namespace blender::eevee {
15#endif
16
17#define FILM_PRECOMP_SAMPLE_MAX 16
18
23
29
39
40struct FilmSample {
42 float weight;
45};
47
127
128static inline float film_filter_weight(float filter_radius, float sample_distance_sqr)
129{
130#if 1 /* Faster */
131 /* Gaussian fitted to Blackman-Harris. */
132 float r = sample_distance_sqr / (filter_radius * filter_radius);
133 const float sigma = 0.284;
134 const float fac = -0.5 / (sigma * sigma);
135 float weight = expf(fac * r);
136#else
137 /* Blackman-Harris filter. */
138 float r = M_TAU * saturate(0.5 + sqrtf(sample_distance_sqr) / (2.0 * filter_radius));
139 float weight = 0.35875 - 0.48829 * cosf(r) + 0.14128 * cosf(2.0 * r) - 0.01168 * cosf(3.0 * r);
140#endif
141 return weight;
142}
143
144#ifndef GPU_SHADER
145} // namespace blender::eevee
146#endif
#define BLI_STATIC_ASSERT_ALIGN(st, align)
Definition BLI_assert.h:86
#define M_TAU
#define ENUM_OPERATORS(_type, _max)
int32_t bool32_t
#define expf(x)
#define FILM_PRECOMP_SAMPLE_MAX
static float film_filter_weight(float filter_radius, float sample_distance_sqr)
VecBase< int32_t, 2 > int2
VecBase< float, 2 > float2
#define sqrtf
#define cosf
#define saturate(a)
Definition smaa.cc:315
ePassStorageType display_storage_type
FilmSample samples[FILM_PRECOMP_SAMPLE_MAX]