This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
# Formula from: http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html | |
def rgb_to_xyz(r, g, b, w): | |
xyz_r = np.array([r[0] / r[1], 1, (1 - r[0] - r[1]) / r[1]]) | |
xyz_g = np.array([g[0] / g[1], 1, (1 - g[0] - g[1]) / g[1]]) | |
xyz_b = np.array([b[0] / b[1], 1, (1 - b[0] - b[1]) / b[1]]) | |
xyz_w = np.array([w[0] / w[1], 1, (1 - w[0] - w[1]) / w[1]]) | |
s = xyz_w * np.linalg.inv(np.matrix([xyz_r, xyz_g, xyz_b])) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void decomposition_tracking(const Ray& ray, const Material& material, float& t_out, float3& transmittance) { | |
auto const cm = material.control_medium(); | |
float const rc = rng_.random_float(); | |
float const t_c = ray.min_t - std::log(1.f - rc) / cm.minorant_mu_t; | |
if (t_c > ray.max_t) { | |
t_out = ray.max_t; | |
transmittance = float3(1.f); | |
return; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
float3 direct_light(const Ray& ray, const float3& p) { | |
// return lighting at this point... | |
} | |
float3 spectral_tracking(const Ray& ray, const Material& material, float3& transmittance) { | |
const float d = ray.max_t - ray.min_t; | |
float3 w(1.f); | |
float t = 0.f; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
float3 direct_light(const float3& position) { | |
// direct light inside volume including phase function and beam transmittance | |
} | |
float3 homogeneous2(const Ray& ray, float3& transmittance) { | |
float3 radiance(0.f); | |
if (Algorithm::Tracking == algorithm) { | |
const float3 sigma_a = material.absorption(float3::identity()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
float3 direct_light(const float3& position) { | |
// direct light inside volume including phase function and beam transmittance | |
} | |
float3 homogeneous(const Ray& ray, float3& transmittance) { | |
float3 radiance(0.f); | |
const float3 extinction = sigma_a + sigma_s; | |
const float3 scattering_albedo = sigma_s / extinction; |