Blender V5.0
volume_rayleigh.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2011-2024 Blender Foundation
2 *
3 * SPDX-License-Identifier: Apache-2.0 */
4
5#pragma once
6
7#include "kernel/types.h"
8
10
12
13/* RAYLEIGH CLOSURE */
14
18static_assert(sizeof(ShaderVolumeClosure) >= sizeof(RayleighVolume),
19 "RayleighVolume is too large!");
20
26
28 const float3 wo,
29 ccl_private float *pdf)
30{
31 /* note that wi points towards the viewer */
32 const float cos_theta = dot(-sd->wi, wo);
34
35 return make_spectrum(*pdf);
36}
37
39 const float2 rand,
42 ccl_private float *pdf)
43{
44 /* note that wi points towards the viewer and so is used negated */
45 *wo = phase_rayleigh_sample(-sd->wi, rand, pdf);
46 *eval = make_spectrum(*pdf); /* perfect importance sampling */
47
49}
50
ccl_device_inline float cos_theta(const float3 w)
dot(value.rgb, luminance_coefficients)") DEFINE_VALUE("REDUCE(lhs
#define make_spectrum(f)
#define ccl_private
#define CCL_NAMESPACE_END
@ CLOSURE_VOLUME_RAYLEIGH_ID
@ SD_SCATTER
@ LABEL_VOLUME_SCATTER
#define ccl_device
float3 Spectrum
ccl_device Spectrum volume_rayleigh_eval(const ccl_private ShaderData *sd, const float3 wo, ccl_private float *pdf)
ccl_device int volume_rayleigh_setup(ccl_private RayleighVolume *volume)
ccl_device int volume_rayleigh_sample(const ccl_private ShaderData *sd, const float2 rand, ccl_private Spectrum *eval, ccl_private float3 *wo, ccl_private float *pdf)
ccl_device float3 phase_rayleigh_sample(const float3 D, const float2 rand, ccl_private float *pdf)
Definition volume_util.h:60
ccl_device float phase_rayleigh(const float cos_theta)
Definition volume_util.h:55