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
LightSampler refactored into Backward and ForwardLightSampler, use of EMTs with the LightTree #1544
Conversation
CMakeLists.txt
Outdated
@@ -109,7 +109,7 @@ option (WITH_TOOLS "Build appleseed tools" | |||
option (WITH_PYTHON "Build Python bindings" ON) | |||
option (WITH_DISNEY_MATERIAL "Build Disney material" OFF) | |||
|
|||
option (USE_STATIC_BOOST "Use static Boost libraries" ON) | |||
option (USE_STATIC_BOOST "Use static Boost libraries" OFF) |
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.
Revert.
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.
whoops :)
@@ -42,7 +42,7 @@ | |||
|
|||
// Forward declarations. | |||
namespace renderer { class Frame; } | |||
namespace renderer { class LightSampler; } | |||
namespace renderer { class ForwardLightSampler; } |
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.
Order alphabetically.
@@ -4899,7 +4899,52 @@ | |||
</output> | |||
<configurations> | |||
<configuration name="final" base="base_final"> | |||
<parameter name="lighting_engine" value="pt" /> |
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.
It would be nice if these files were left exactly as they were generated by the Python scripts. In other words, if you would like to change rendering settings, I'd suggest changing them in the Python scripts instead.
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.
to be honest, I am not sure where did this come from as i didn't go directly into the file. Maybe I saved it by accident from the studio.
mat = orientation * asr.Matrix4d.make_translation(asr.Vector3d(0.0, 0.0, 0.0)) | ||
instance = asr.ObjectInstance( | ||
instance_name, | ||
{"visibility": |
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.
Full visibility is the default, you don't need to specify anything in this case.
// | ||
// Copyright (c) 2010-2013 Francois Beaune, Jupiter Jazz Limited | ||
// Copyright (c) 2014-2017 Francois Beaune, The appleseedhq Organization | ||
// Copyright (c) 2017 Petra Gospodnetic, The appleseedhq Organization |
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.
Maybe one day we'll simplify the copyright rules... But for now you need to either remove the original copyright notices, or remove the last one.
@@ -46,7 +46,7 @@ | |||
|
|||
// Forward declarations. | |||
namespace renderer { class LightSample; } | |||
namespace renderer { class LightSampler; } | |||
namespace renderer { class BackwardLightSampler; } |
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.
Order alphabetically.
@@ -292,6 +292,9 @@ IRendererController::Status MasterRenderer::render_frame_sequence( | |||
return IRendererController::AbortRendering; | |||
} | |||
|
|||
if (components.is_backward_light_sampler_used()) |
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.
Instead of is_backward_light_sampler_used()
, couldn't we simply check if get_backward_light_sampler()
returns nullptr
or not?
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.
lol that's right. :D
, m_shading_engine(get_child_and_inherit_globals(params, "shading_engine")) | ||
, m_texture_store(texture_store) | ||
, m_texture_system(texture_system) | ||
, m_shading_system(shading_system) | ||
, m_forward_light_sampler(0) |
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.
Use nullptr
.
private: | ||
const Project& m_project; | ||
const ParamArray& m_params; | ||
ITileCallbackFactory* m_tile_callback_factory; | ||
const Scene& m_scene; | ||
const Frame& m_frame; | ||
const TraceContext& m_trace_context; | ||
LightSampler m_light_sampler; | ||
ForwardLightSampler* m_forward_light_sampler; |
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.
If you must store pointers, use std::unique_ptr<>
instead.
@@ -84,14 +85,19 @@ class RendererComponents | |||
|
|||
IFrameRenderer& get_frame_renderer(); | |||
|
|||
BackwardLightSampler* get_backward_light_sampler(); | |||
|
|||
bool is_backward_light_sampler_used(); |
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 suggest removing this.
@@ -84,14 +85,19 @@ class RendererComponents | |||
|
|||
IFrameRenderer& get_frame_renderer(); | |||
|
|||
BackwardLightSampler* get_backward_light_sampler(); |
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.
This method should be made const.
@@ -565,11 +567,13 @@ float BackwardLightSampler::evaluate_pdf(const ShadingPoint& shading_point) cons | |||
const EmittingTriangle* triangle = m_emitting_triangle_hash_table.get(triangle_key); | |||
|
|||
// Traverse the tree and update triangle_prob | |||
const float prob = m_light_tree.light_probability( | |||
float triangle_probability; | |||
m_light_tree.light_probability( |
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 suggest to rename this method to compute_probability()
.
@@ -344,18 +335,9 @@ void BackwardLightSampler::collect_emitting_triangles( | |||
if (material == 0 || material->has_emission() == false) | |||
continue; | |||
|
|||
// Retrieve the EDF and get the importance multiplier. |
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.
We mut ensure that importance multipliers are still taken into account.
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.
fixed
@@ -39,14 +40,16 @@ | |||
using namespace foundation; | |||
using namespace renderer; | |||
|
|||
TEST_SUITE(Renderer_Kernel_Lighting_LightSampler) | |||
TEST_SUITE(Renderer_Kernel_Lighting_LightSamplers) |
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.
Ideally we would have two test suites (and thus two source files), one per sampler type.
"subsurface": "true", | ||
"transparency": "true" | ||
}}, | ||
{"visibility": {}}, |
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 can even remove visibility
and just keep {}
.
@@ -68,7 +61,8 @@ namespace renderer | |||
{ | |||
|
|||
// | |||
// The light sampler collects all the light-emitting entities (non-physical lights, mesh lights) | |||
// The backward light sampler is intended to be used with backward tracing methods. |
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.
Copy-paste error :)
6912096
to
647496a
Compare
// Store the probability density of this light. | ||
light_sample.m_probability = light_prob; | ||
} | ||
else if (light_type == LightSource::EmittingTriangleType) |
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.
Can it be anything else?
If not, I suggest removing the if
and replacing it by an assertion:
else
{
assert(light_type == LightSource::EmittingTriangleType);
...
}
c8e7739
to
4df7e59
Compare
… from LightSampler
…a specific tree node
…hed_edf to use the right intensity value
16194c6
to
979af79
Compare
LightSampler is no longer used so I suggest removing it and adapting the tests to Backward and ForwarLightSamplers