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
Light tree #1505
Light tree #1505
Conversation
Compare the retrieved position and calculated center of the bbox for both NPL and EM.
…4 non-physical lights)
@@ -285,8 +285,8 @@ namespace | |||
{ | |||
float node_probability( | |||
const LightTreeNode<foundation::AABB3d>& node, | |||
const foundation::AABB3d bbox, | |||
const foundation::Vector3d surface_point) | |||
const foundation::AABB3d& bbox, |
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.
Fix indentation (1 indentation = 4 spaces only).
const foundation::Vector3d surface_point, | ||
float s) const | ||
const foundation::Vector3d& surface_point, | ||
float s) const |
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.
One minor thing I don't think I mentioned: whenver we indent stuff, we try to stick to tab "stops", i.e. multiples of 4 spaces.
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.
The spacing between the first argument and it's type should be multiple of 4 or the character column? (I tend to stick to column).
// Retrieve the importance multiplier. | ||
float get_uncached_importance_multiplier() const; | ||
|
||
// Set the light transformation. | ||
void set_transform(const foundation::Transformd& transform); | ||
|
||
// Set the flag that the light is LightTreeCompatible | ||
bool is_light_tree_compatible() const; |
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 respectfully disagree, I think it somewhat clutters the renderer::Light
interface by giving this flag a predominant place and by duplicating what can already be accomplished by checking the flags.
I think that
if (m_flags & LightTreeCompatible)`
is fairly readable, don't you think?
@@ -118,9 +113,13 @@ bool Light::on_frame_begin( | |||
if (!ConnectableEntity::on_frame_begin(project, parent, recorder, abort_switch)) | |||
return false; | |||
|
|||
m_flags = 0; | |||
if (is_light_tree_compatible()) | |||
if (m_flags & LightTreeCompatible) |
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.
Ah, that's another approach indeed. The downside is that it won't work if we add another flag.
What I proposed is different, see the description on Slack.
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 as proposed
…o both white and colored lights
… not available publicly.
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.
Second round of reviews. Almost there!!
import os | ||
|
||
import appleseed as asr | ||
|
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.
Remove redundant blank line.
import numpy as np | ||
|
||
import appleseed as asr | ||
|
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.
Remove redundant blank line.
output_scene_name = "output/" + str(grid_lights_count) + "x" + str(grid_lights_count) + "_" + color + "_point_lights" | ||
|
||
def build_project(): | ||
|
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.
Remove redundant blank line.
light.set_transform(asr.Transformd(mat)) | ||
assembly.lights().insert(light) | ||
else: | ||
print "Unknown color: ", color |
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's best to use Python 3's print syntax.
Add:
from __future__ import print_function
and then:
print("Unknown color: " + color)
or:
print("Unknown color: {0}".format(color))
'intensity_multiplier': "3" | ||
|
||
}) | ||
light_position = asr.Vector3d( i, j, 0.2 ) |
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.
Like in C++, no spaces before or after parentheses:
light_position = asr.Vector3d(i, j, 0.2)
{ | ||
public: | ||
const AssemblyInstance* m_assembly_instance; | ||
size_t m_object_instance_index; |
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.
Include <cstddef>
.
size_t m_object_instance_index; | ||
size_t m_region_index; | ||
size_t m_triangle_index; | ||
foundation::Vector3d m_v0, m_v1, m_v2; // world space vertices of the triangle |
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.
Include foundation/math/vector.h
.
// | ||
|
||
class LightSource | ||
: public foundation::NonCopyable |
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.
Include foundation/core/concepts/noncopyable.h
.
// Destructor | ||
virtual ~LightSource(); | ||
|
||
// Get the reference to the source position. |
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.
// Get the light source position.
@@ -77,6 +77,9 @@ namespace | |||
m_inputs.declare("intensity", InputFormatSpectralIlluminance); | |||
m_inputs.declare("intensity_multiplier", InputFormatFloat, "1.0"); | |||
m_inputs.declare("exposure", InputFormatFloat, "0.0"); | |||
|
|||
// Point lights can be used by the LightTree |
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.
End full line comment with a .
Updated with the requested changes :) |
Initial integration of the LightTree sampling. The tree can handle only point source lights. The point lights are flagged as
LightTreeCompatible
and, as such, extracted into a separate vector within theLightSampler
Since we know the lights within the
LightTree
can only be non physical for now, contributions from theLightTree
within theDirectLightingIntegrator
are added using theadd_non_physical_light_sample_contribution()
. It is something that works now but should be changed/expanded once I add other types of lights to the tree. I wouldn't change it now because I am not sure yet what and how should I change. I can duplicate theadd_non_physical_light_sample_contribution()
function and rename it intoadd_light_tree_sample_contribution()
just to mark the spot that will be expanded.