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

LightSampler refactored into Backward and ForwardLightSampler, use of EMTs with the LightTree #1544

Merged
merged 9 commits into from Jul 20, 2017

Conversation

gospodnetic
Copy link
Member

LightSampler is no longer used so I suggest removing it and adapting the tests to Backward and ForwarLightSamplers

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)
Copy link
Member

Choose a reason for hiding this comment

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

Revert.

Copy link
Member Author

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; }
Copy link
Member

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" />
Copy link
Member

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.

Copy link
Member Author

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":
Copy link
Member

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
Copy link
Member

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; }
Copy link
Member

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())
Copy link
Member

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?

Copy link
Member Author

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)
Copy link
Member

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;
Copy link
Member

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();
Copy link
Member

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();
Copy link
Member

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(
Copy link
Member

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.
Copy link
Member

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.

Copy link
Member Author

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)
Copy link
Member

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": {}},
Copy link
Member

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.
Copy link
Member

Choose a reason for hiding this comment

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

Copy-paste error :)

@gospodnetic gospodnetic force-pushed the LT_EMT branch 3 times, most recently from 6912096 to 647496a Compare July 19, 2017 20:38
// Store the probability density of this light.
light_sample.m_probability = light_prob;
}
else if (light_type == LightSource::EmittingTriangleType)
Copy link
Member

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);
    ...
}

@gospodnetic gospodnetic force-pushed the LT_EMT branch 2 times, most recently from c8e7739 to 4df7e59 Compare July 20, 2017 13:00
@gospodnetic gospodnetic force-pushed the LT_EMT branch 3 times, most recently from 16194c6 to 979af79 Compare July 20, 2017 14:02
@dictoon dictoon merged commit 7a8761f into appleseedhq:master Jul 20, 2017
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.

None yet

2 participants