Skip to content

Commit

Permalink
Keep sun irradiance constant when changing distance and size�
Browse files Browse the repository at this point in the history
  • Loading branch information
mororo250 committed Jul 10, 2020
1 parent 1a427e2 commit 5035b89
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
9 changes: 3 additions & 6 deletions sandbox/settings/appleseed.studio.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,11 @@
<parameters name="file_dialog">
<parameters name="frames">
<parameter name="last_directory" value="D:\appleseed-scenes" />
<parameter name="selected_filter" value="JPEG Files (*.jpg *.jpe *.jpeg *.jif *.jfif *.jfi)" />
</parameters>
<parameters name="light_paths">
<parameter name="selected_filter" value="" />
<parameter name="selected_filter" value="Bitmap Files (*.bmp *.cin *.dds *.dpx *.fits *.hdr *.rgbe *.ico *.iff *.z *.jpg *.jpe *.jpeg *.jif *.jfif *.jfi *.null *.nul *.exr *.sxr *.mxr *.png *.ppm *.pgm *.pbm *.pnm *.pfm *.psd *.pdd *.psb *.rla *.sgi *.rgb *.rgba *.bw *.int *.inta *.socket *.pic *.tif *.tiff *.tx *.env *.sm *.vsm *.tga *.tpic *.zfile)" />
</parameters>
<parameters name="projects">
<parameter name="last_directory" value="D:\appleseed\sandbox\tests\test scenes\light importance multipliers" />
<parameter name="selected_filter" value="Project Files (*.appleseed *.appleseedz)" />
<parameter name="last_directory" value="D:\appleseed-scenes" />
<parameter name="selected_filter" value="Plain Project Files (*.appleseed)" />
</parameters>
</parameters>
<parameters name="render_region">
Expand Down
5 changes: 3 additions & 2 deletions src/appleseed/renderer/modeling/light/sunlight.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ void SunLight::evaluate(
square(static_cast<float>(distance_to_center)));

value.set(radiance, g_std_lighting_conditions, Spectrum::Illuminance);
value *= m_sun_solid_angle;
}

void SunLight::compute_sun_radiance(
Expand Down Expand Up @@ -566,7 +567,7 @@ void SunLight::sample_sun_surface(

outgoing = normalize(target_point - position);
Vector2d test = static_cast<double>(SunRadius * m_values.m_size_multiplier) * p;
float squared_distance_to_center = test[0] * test[0] + test[1] * test[1];
double squared_distance_to_center = test[0] * test[0] + test[1] * test[1];


RegularSpectrum31f radiance;
Expand All @@ -575,7 +576,7 @@ void SunLight::sample_sun_surface(
m_values.m_turbidity,
m_values.m_radiance_multiplier,
radiance,
squared_distance_to_center);
static_cast<float>(squared_distance_to_center));

value.set(radiance, g_std_lighting_conditions, Spectrum::Illuminance);

Expand Down

0 comments on commit 5035b89

Please sign in to comment.