Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Courses
Scotty3D
Commits
a859afb3
Commit
a859afb3
authored
Nov 04, 2020
by
TheNumbat
Browse files
change normal color default to not have lighting
parent
d9439828
Changes
1
Show whitespace changes
Inline
Side-by-side
src/student/pathtracer.cpp
View file @
a859afb3
...
@@ -50,18 +50,20 @@ Spectrum Pathtracer::trace_ray(const Ray &ray) {
...
@@ -50,18 +50,20 @@ Spectrum Pathtracer::trace_ray(const Ray &ray) {
Mat4
world_to_object
=
object_to_world
.
T
();
Mat4
world_to_object
=
object_to_world
.
T
();
Vec3
out_dir
=
world_to_object
.
rotate
(
ray
.
point
-
hit
.
position
).
unit
();
Vec3
out_dir
=
world_to_object
.
rotate
(
ray
.
point
-
hit
.
position
).
unit
();
// Debugging: if the normal colors flag is set, return the normal color
if
(
debug_data
.
normal_colors
)
return
Spectrum
::
direction
(
hit
.
normal
);
// Now we can compute the rendering equation at this point.
// Now we can compute the rendering equation at this point.
// We split it into two stages: sampling lighting (i.e. directly connecting
// We split it into two stages: sampling lighting (i.e. directly connecting
// the current path to each light in the scene), then sampling the BSDF
// the current path to each light in the scene), then sampling the BSDF
// to create a new path segment.
// to create a new path segment.
// TODO (PathTracer): Task 5
// TODO (PathTracer): Task 5
// Instead of initializing this value to a constant color, use the direct,
// The starter code sets radiance_out to (0.5,0.5,0.5) so that you can test your geometry
// indirect lighting components calculated in the code below. The starter
// queries before you implement path tracing. You should change this to (0,0,0) and accumulate
// code sets radiance_out to (0.5,0.5,0.5) so that you can test your geometry
// the direct and indirect lighting computed below.
// queries before you implement path tracing.
Spectrum
radiance_out
=
Spectrum
(
0.5
f
);
Spectrum
radiance_out
=
debug_data
.
normal_colors
?
Spectrum
::
direction
(
hit
.
normal
)
:
Spectrum
(
0.5
f
);
{
{
auto
sample_light
=
[
&
](
const
auto
&
light
)
{
auto
sample_light
=
[
&
](
const
auto
&
light
)
{
// If the light is discrete (e.g. a point light), then we only need
// If the light is discrete (e.g. a point light), then we only need
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment