Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sky / sun plugins #49

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft

Conversation

mjaillot
Copy link

No description provided.

m_state[i], (double)theta, (double)gamma, i) / 106.856980); // (sum of Spectrum::CIE_Y)
else {
Float step_size = (MTS_WAVELENGTH_MIN - MTS_WAVELENGTH_MIN) / (Float) Spectrum::Size;
Float wavelength0 = MTS_WAVELENGTH_MIN + step_size * i;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(When the time comes to use spectral mode), the wavelengths to evaluate are already specified in si.wavelength.

}

for (size_t i = 0; i < Spectrum::Size; i++)
result[i] = max(result[i], 0.0f);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

result = max(result, 0.f) should work (courtesy of Enoki).

m_turbidity = props.float_("turbidity", 3.0f);
m_stretch = props.float_("stretch", 1.0f);
m_resolution = props.int_("resolution", 512);
m_albedo = props.texture<Texture>("albedo", 0.2f);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm surprised this works: m_albedo has a Spectrum type, but here the properties you query has type ref<Texture>.
If you try to print the value of albedo here, are you getting what you expect?

I think the correct usage would be to change the type of m_albedo to ref<Texture>, and then query it like so in your eval method:

UnpolarizedSpectrum value = m_reflectance->eval(si, active);


for (size_t i = 0; i < Spectrum::Size; i++) {
if constexpr (Spectrum::Size == 3)
m_state[i] = arhosek_rgb_skymodelstate_alloc_init(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the model states are allocated here, they should also be freed in the destructor (arhosekskymodelstate_free, and corresponding in the spectral case).

Float wavelength0 = MTS_WAVELENGTH_MIN + step_size * i;
Float wavelength1 = MTS_WAVELENGTH_MIN + step_size * (i+1);
result[i] = (Float) arhosekskymodel_radiance(
m_state[i], (double)theta, (double)gamma, 0.5f * (wavelength0 + wavelength1));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You've probably already checked, but of course there's always the question of whether angles are expected in degrees or radians.

@merlinND merlinND marked this pull request as draft April 15, 2020 12:29
@merlinND merlinND changed the title WIP rgb sky plugin Sky / sun plugins Apr 15, 2020
@Speierers
Copy link
Member

@merlinND can we close this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants