This repository has been archived on 2023-10-09. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
blender-archive/intern/cycles/kernel/sample/mis.h
Brecht Van Lommel 9cfc7967dd Cycles: use SPDX license headers
* Replace license text in headers with SPDX identifiers.
* Remove specific license info from outdated readme.txt, instead leave details
  to the source files.
* Add list of SPDX license identifiers used, and corresponding license texts.
* Update copyright dates while we're at it.

Ref D14069, T95597
2022-02-11 17:47:34 +01:00

41 lines
803 B
C++

/* SPDX-License-Identifier: BSD-3-Clause
*
* Adapted from Open Shading Language
* Copyright (c) 2009-2010 Sony Pictures Imageworks Inc., et al.
* All Rights Reserved.
*
* Modifications Copyright 2011-2022 Blender Foundation. */
#pragma once
CCL_NAMESPACE_BEGIN
/* Multiple importance sampling utilities. */
ccl_device float balance_heuristic(float a, float b)
{
return (a) / (a + b);
}
ccl_device float balance_heuristic_3(float a, float b, float c)
{
return (a) / (a + b + c);
}
ccl_device float power_heuristic(float a, float b)
{
return (a * a) / (a * a + b * b);
}
ccl_device float power_heuristic_3(float a, float b, float c)
{
return (a * a) / (a * a + b * b + c * c);
}
ccl_device float max_heuristic(float a, float b)
{
return (a > b) ? 1.0f : 0.0f;
}
CCL_NAMESPACE_END