Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dev_log
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Benjamin Koltes
dev_log
Commits
1d96cb1f
Commit
1d96cb1f
authored
9 years ago
by
Benjamin Koltes
Browse files
Options
Downloads
Patches
Plain Diff
avec les shadow
parent
cc0404f8
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
__pycache__/operation_vector.cpython-33.pyc
+0
-0
0 additions, 0 deletions
__pycache__/operation_vector.cpython-33.pyc
__pycache__/raytracer.cpython-33.pyc
+0
-0
0 additions, 0 deletions
__pycache__/raytracer.cpython-33.pyc
raytracer.py
+14
-1
14 additions, 1 deletion
raytracer.py
with
14 additions
and
1 deletion
__pycache__/operation_vector.cpython-33.pyc
+
0
−
0
View file @
1d96cb1f
No preview for this file type
This diff is collapsed.
Click to expand it.
__pycache__/raytracer.cpython-33.pyc
+
0
−
0
View file @
1d96cb1f
No preview for this file type
This diff is collapsed.
Click to expand it.
raytracer.py
+
14
−
1
View file @
1d96cb1f
...
@@ -22,7 +22,8 @@ def trace_ray(ray, scene, camera):
...
@@ -22,7 +22,8 @@ def trace_ray(ray, scene, camera):
return
Vector
([
0
,
0
,
0
])
return
Vector
([
0
,
0
,
0
])
color
=
ambiant_illuminate
(
class_intersect
.
position
,
class_intersect
.
object
)
color
=
ambiant_illuminate
(
class_intersect
.
position
,
class_intersect
.
object
)
for
light
in
scene
.
light_list
:
for
light
in
scene
.
light_list
:
color
+=
phong_illuminate
(
light
,
class_intersect
.
position
,
class_intersect
.
normal
,
class_intersect
.
object
,
Vector
([
0
,
0
,
0
]))
# color += phong_illuminate(light, class_intersect.position, class_intersect.normal, class_intersect.object, Vector([0,0,0]))
color
+=
compute_light
(
light
,
scene
,
class_intersect
,
Vector
([
0
,
0
,
0
]))
color_object
=
class_intersect
.
object
.
material
.
color
color_object
=
class_intersect
.
object
.
material
.
color
c_x
,
c_y
,
c_z
=
color
.
coord
()
c_x
,
c_y
,
c_z
=
color
.
coord
()
return
Vector
([
max
(
min
(
c_x
,
1
),
0
),
max
(
0
,
min
(
c_y
,
1
)),
max
(
0
,
min
(
c_z
,
1
))])
return
Vector
([
max
(
min
(
c_x
,
1
),
0
),
max
(
0
,
min
(
c_y
,
1
)),
max
(
0
,
min
(
c_z
,
1
))])
...
@@ -37,3 +38,15 @@ def raytracer_render(camera, scene):
...
@@ -37,3 +38,15 @@ def raytracer_render(camera, scene):
color
=
trace_ray
(
ray
,
scene
,
camera
)
color
=
trace_ray
(
ray
,
scene
,
camera
)
affiche
[
i
,
j
,:]
=
color
.
coord
()
affiche
[
i
,
j
,:]
=
color
.
coord
()
return
affiche
return
affiche
def
compute_light
(
light
,
scene
,
intersection
,
viewer
):
ray
=
Ray
(
light
.
position
,
(
intersection
.
position
-
light
.
position
).
normalized
())
distance
=
(
intersection
.
position
-
light
.
position
).
norm
()
distance_limit
=
distance
*
.
99
for
o
in
scene
.
object_list
:
resultat
=
intersect
(
o
,
ray
)
if
resultat
!=
None
:
d
=
(
resultat
.
position
-
ray
.
starting_point
).
norm
()
if
d
<
distance_limit
:
# si un objet est dans la trajectoire du rayon
return
Vector
([
0
,
0
,
0
])
return
phong_illuminate
(
light
,
intersection
.
position
,
intersection
.
normal
,
intersection
.
object
,
viewer
)
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