Blender V5.3
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
10
11#pragma once
12
14
15#ifndef GPU_SHADER
16namespace blender::eevee {
17#endif
18
19static constexpr int FILM_PRECOMP_SAMPLE_MAX = 16;
20static constexpr int FILM_PANORAMIC_SAMPLE_LEN = 4;
21
26
33
43#ifndef GPU_SHADER
45#endif
46
53
140
141static inline float film_filter_weight(float filter_radius, float sample_distance_sqr)
142{
143#if 1 /* Faster */
144 /* Gaussian fitted to Blackman-Harris. */
145 float r = sample_distance_sqr / (filter_radius * filter_radius);
146 const float sigma = 0.284f;
147 const float fac = -0.5f / (sigma * sigma);
148 float weight = expf(fac * r);
149#else
150 /* Blackman-Harris filter. */
151 float r = M_TAU * saturate(0.5 + sqrtf(sample_distance_sqr) / (2.0 * filter_radius));
152 float weight = 0.35875 - 0.48829 * cosf(r) + 0.14128 * cosf(2.0 * r) - 0.01168 * cosf(3.0 * r);
153#endif
154 return weight;
155}
156
157#ifndef GPU_SHADER
158} // namespace blender::eevee
159#endif
#define M_TAU
#define host_shared
int32_t bool32_t
#define expf(x)
ENUM_OPERATORS(Layer::Flags)
static constexpr int FILM_PANORAMIC_SAMPLE_LEN
static float film_filter_weight(float filter_radius, float sample_distance_sqr)
static constexpr int FILM_PRECOMP_SAMPLE_MAX
unsigned int uint32_t
Definition BKE_text.h:81
VecBase< int32_t, 2 > int2
VecBase< float, 2 > float2
#define sqrtf
#define cosf
#define saturate(a)
Definition smaa.cc:319
enum ePassStorageType display_storage_type
struct FilmSample samples[FILM_PRECOMP_SAMPLE_MAX]