Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CppRaytracer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Yoel
CppRaytracer
Commits
4bae0e20
Commit
4bae0e20
authored
4 years ago
by
Yoel
Browse files
Options
Downloads
Patches
Plain Diff
Changed scatter and implemented new calcLightMulti-func
parent
0c102ae9
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
RayTracer/material/DiffuseMaterial.cpp
+15
-2
15 additions, 2 deletions
RayTracer/material/DiffuseMaterial.cpp
RayTracer/material/DiffuseMaterial.h
+6
-2
6 additions, 2 deletions
RayTracer/material/DiffuseMaterial.h
with
21 additions
and
4 deletions
RayTracer/material/DiffuseMaterial.cpp
+
15
−
2
View file @
4bae0e20
#include
"DiffuseMaterial.h"
#include
"DiffuseMaterial.h"
#include
<cassert>
#include
"../tools/Random.h"
#include
"../tools/Random.h"
#include
"texture/Constant.h"
#include
"texture/Constant.h"
...
@@ -28,9 +30,20 @@ util::Vec3 DiffuseMaterial::emission(float texel_x, float texel_y) const {
...
@@ -28,9 +30,20 @@ util::Vec3 DiffuseMaterial::emission(float texel_x, float texel_y) const {
}
}
util
::
Vec3
DiffuseMaterial
::
scattered_d
(
const
util
::
Vec3
&
d
,
util
::
Vec3
DiffuseMaterial
::
scattered_d
(
const
util
::
Vec3
&
d
,
const
util
::
Vec3
&
n
)
const
{
const
util
::
Vec3
&
n
)
const
{
return
n
+
util
::
rand_vec3_in_circle
(
1
);
util
::
Vec3
rand
=
util
::
rand_vec3_in_circle
(
1
);
util
::
Vec3
result
=
n
+
rand
;
/*if (util::dot(n, result) <= 0) {
std::cout << n << " " << rand << std::endl;
assert(false);
}*/
return
result
;
}
}
bool
DiffuseMaterial
::
scatter
()
const
{
bool
DiffuseMaterial
::
scatter
(
const
util
::
Vec3
&
d
,
const
util
::
Vec3
&
n
)
const
{
return
true
;
return
true
;
}
}
float
DiffuseMaterial
::
calculateLightMultiplier
(
const
util
::
Vec3
&
d_in
,
const
util
::
Vec3
&
d_out
,
const
util
::
Vec3
&
n
)
const
{
return
util
::
dot
(
n
,
d_in
);
}
}
// namespace material
}
// namespace material
\ No newline at end of file
This diff is collapsed.
Click to expand it.
RayTracer/material/DiffuseMaterial.h
+
6
−
2
View file @
4bae0e20
...
@@ -14,10 +14,14 @@ class DiffuseMaterial : public Material {
...
@@ -14,10 +14,14 @@ class DiffuseMaterial : public Material {
util
::
Vec3
emission
(
float
texel_x
,
float
texel_y
)
const
override
;
util
::
Vec3
emission
(
float
texel_x
,
float
texel_y
)
const
override
;
util
::
Vec3
scattered_d
(
const
util
::
Vec3
&
d
,
util
::
Vec3
scattered_d
(
const
util
::
Vec3
&
d
,
const
util
::
Vec3
&
n
)
const
override
;
const
util
::
Vec3
&
n
)
const
override
;
bool
scatter
()
const
override
;
bool
scatter
(
const
util
::
Vec3
&
d
,
const
util
::
Vec3
&
n
)
const
override
;
float
calculateLightMultiplier
(
const
util
::
Vec3
&
d_in
,
const
util
::
Vec3
&
d_out
,
const
util
::
Vec3
&
n
)
const
override
;
private:
private:
std
::
shared_ptr
<
util
::
Sampler
>
emission_texture
;
std
::
shared_ptr
<
util
::
Sampler
>
albedo_texture
;
std
::
shared_ptr
<
util
::
Sampler
>
albedo_texture
;
std
::
shared_ptr
<
util
::
Sampler
>
emission_texture
;
};
};
}
// namespace material
}
// namespace material
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment