Blender V4.3
emissive.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2009-2010 Sony Pictures Imageworks Inc., et al. All Rights Reserved.
2 * SPDX-FileCopyrightText: 2011-2022 Blender Foundation
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 *
6 * Adapted code from Open Shading Language. */
7
8#pragma once
9
11
12/* BACKGROUND CLOSURE */
13
15{
16 if (sd->flag & SD_EMISSION) {
17 sd->closure_emission_background += weight;
18 }
19 else {
20 sd->flag |= SD_EMISSION;
21 sd->closure_emission_background = weight;
22 }
23}
24
25/* EMISSION CLOSURE */
26
28{
29 if (sd->flag & SD_EMISSION) {
30 sd->closure_emission_background += weight;
31 }
32 else {
33 sd->flag |= SD_EMISSION;
34 sd->closure_emission_background = weight;
35 }
36}
37
38/* return the probability distribution function in the direction wi,
39 * given the parameters and the light's surface normal. This MUST match
40 * the PDF computed by sample(). */
41ccl_device float emissive_pdf(const float3 Ng, const float3 wi)
42{
43 float cosNI = fabsf(dot(Ng, wi));
44 return (cosNI > 0.0f) ? 1.0f : 0.0f;
45}
46
48 const float3 Ng, float randu, float randv, ccl_private float3 *wi, ccl_private float *pdf)
49{
50 /* todo: not implemented and used yet */
51}
52
54{
55 float res = emissive_pdf(Ng, wi);
56
57 return make_spectrum(res);
58}
59
additional_info("compositor_sum_squared_difference_float_shared") .push_constant(Type output_img float dot(value.rgb, luminance_coefficients)") .define("LOAD(value)"
#define ccl_device
#define ccl_private
#define CCL_NAMESPACE_END
#define fabsf(x)
ccl_device Spectrum emissive_simple_eval(const float3 Ng, const float3 wi)
Definition emissive.h:53
ccl_device void emission_setup(ccl_private ShaderData *sd, const Spectrum weight)
Definition emissive.h:27
CCL_NAMESPACE_BEGIN ccl_device void background_setup(ccl_private ShaderData *sd, const Spectrum weight)
Definition emissive.h:14
ccl_device float emissive_pdf(const float3 Ng, const float3 wi)
Definition emissive.h:41
ccl_device void emissive_sample(const float3 Ng, float randu, float randv, ccl_private float3 *wi, ccl_private float *pdf)
Definition emissive.h:47
@ SD_EMISSION
ShaderData
#define make_spectrum(f)
SPECTRUM_DATA_TYPE Spectrum