-
Notifications
You must be signed in to change notification settings - Fork 266
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
base: master
Are you sure you want to change the base?
Conversation
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; |
There was a problem hiding this comment.
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
.
src/emitters/sky.cpp
Outdated
} | ||
|
||
for (size_t i = 0; i < Spectrum::Size; i++) | ||
result[i] = max(result[i], 0.0f); |
There was a problem hiding this comment.
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).
src/emitters/sky.cpp
Outdated
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); |
There was a problem hiding this comment.
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:
mitsuba2/src/bsdfs/diffuse.cpp
Line 99 in f30bd5c
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( |
There was a problem hiding this comment.
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)); |
There was a problem hiding this comment.
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 can we close this PR? |
No description provided.