Commit 7037855b authored by Shiven Bhatt's avatar Shiven Bhatt
Browse files

adding image slides

parent 89510f22
glass.png

201 KB

shadow.png

1.04 MB

......@@ -11,9 +11,9 @@ class Slide:
class Slides(Scene):
def construct(self):
def get_spaced_text(text, im, spacing=0.5):
def get_spaced_text(text, im, spacing=0.5, font_size=90):
spacer = Text("d",font_size=90).scale(spacing).align_to(im,DOWN)
return Text(text,color="white",font_size=90).scale(0.5).next_to(spacer, UP)
return Text(text,color="white",font_size=font_size).scale(0.5).next_to(spacer, UP)
def get_sphere_slide(im_path, text, durations):
im = ImageMobject(im_path).scale_to_fit_height(SCREEN_HEIGHT)
......@@ -22,34 +22,75 @@ class Slides(Scene):
get_spaced_text(text, im)
], durations)
'''def get_comparison_slide(paths, texts, durations):
images = []
for path in paths:
images.append(ImageMobject(path).scale_to_fit_height(SCREEN_HEIGHT))'''
cheapo_group = self.get_image_group(["monte_carlo_one.png", "monte_carlo_vando.png", "monte_carlo_many.png"])
cheapo_group_text = "one sample random samples many samples"
guru_text = '''
“It is generally not so much about the fact that rasterisation couldn't do the things.
It probably could, but it would most likely need several rendering passes
and all kinds of dirty tricks to accomplish things that depend on nonlocal effects.”
- (stackexchange guru joojaa)
'''
slides = [
Slide([self.get_image_group(["raster_vs_raytrace.webp"])], [1]),
### INTRODUCTION ###
# title slide here
Slide([self.get_image_group(["raster_vs_raytrace.webp"])], [8]),
### RASTERIZATION ###
# rasterization animation here
### PROBLEMS ####
get_sphere_slide("sad_sphere.png", "\"I'm not smooth\" :(", [1, 1]),
get_sphere_slide("happy_sphere.png", "\"I'm smooth!\" :)", [1, 1]),
Slide([self.get_image_group(["shadow.png", "glass.png"])], [1]),
Slide([Text(guru_text,color="white",font_size=20)], [1]),
### RAYTRACING ###
# raytracing animation goes here
Slide([self.get_image_group(["different_materials.png"])], [1]),
### PHYSICS ###
Slide([self.get_image_group(["vindow_light_transfer.jpg"])], [1]),
Slide([self.get_image_group(["vindow_light_transfer.jpg"])], [1]),
Slide([self.get_image_group(["vindow_light_same.jpg"])], [1]),
Slide([self.get_image_group(["vindow_function_angle.jpg"])], [1]),
Slide([self.get_image_group(["rendering_eq.png"])], [1]),
### MONTE CARLO INTEGRATION ###
Slide([self.get_image_group(["monte_carlo_img.png"])], [1]),
Slide([self.get_image_group(["monte_carlo_eq1.png", "monte_carlo_eq2"])], [1]),
### MONTE CARLO RAYTRACING ###
# graphic with integral over angle of incoming light????????
Slide([self.get_image_height("monte_carlo_vando.png")], [1]),
Slide([self.get_image_height("monte_carlo_bouncing.png")], [1]),
Slide([cheapo_group, get_spaced_text("one sample random samples many samples", cheapo_group, spacing=0.1)], [1,1,1,1]),
Slide([cheapo_group, get_spaced_text(cheapo_group_text, cheapo_group, spacing=0, font_size=40)], [1,1]),
Slide([self.get_image_height("monte_carlo_bouncing_infinite.png")], [1]),
Slide([self.get_image_height("monte_carlo_path_tracing.png")], [1]),
Slide([self.get_image_height("monte_carlo_path_tracing.png")], [1]),
Slide([self.get_image_group(["different_materials.png"])], [1]),
Slide([self.get_image_group(["mirror.png"])], [1]),
get_sphere_slide("happy_sphere.png", "\"I'm smooth!\" :)", [1, 1]),
Slide([self.get_image_group(["motion_blur.png"])], [1]),
### PATH TRACING ###
# raytracing animation goes here
### CONCLUSION ###
# title slide here
Slide([self.get_image_group(["raster_vs_raytrace.webp"])], [1]),
]
self.slideshow(slides)
def slideshow(self, slides):
def slideshow(self, slides, fade_in_fade_out_time=1):
for slide in slides:
for i in range(0, len(slide.objects)):
self.play(FadeIn(slide.objects[i]))
self.play(FadeIn(slide.objects[i]), run_time=fade_in_fade_out_time)
self.wait(slide.durations[i])
self.play(FadeOut(*slide.objects))
self.play(FadeOut(*slide.objects), run_time=fade_in_fade_out_time)
def get_image_group(self, images):
image_width = SCREEN_WIDTH / (len(images))
......@@ -88,22 +129,23 @@ class RasterizationTriangleScene(ThreeDScene):
cube.shift([0, 0, 3])
rect = Rectangle(width=7, height=5)
rect.shift([-1, 0, -4])
self.add(rect)
self.add(cube)
self.play(Create(rect), run_time=1)
self.play(Create(cube), run_time=1)
camera_plane = Text("camera plane",color="white",font_size=30)
camera_plane.shift([1.5, 3, -4])
self.add(camera_plane)
self.wait(1)
self.play(Create(camera_plane), run_time=1)
self.wait(7)
normal = Line3D(start=[0.25, 0.25, 0], end=[0.25, 0.25, -1])
normal.shift([-0.5, -0.5, 2.5])
triangle = Polygon([0, 0, 0], [0, 1, 0], [1, 0, 0], stroke_width = 1, stroke_color=RED)
triangle.shift([-0.5, -0.5, 2.5])
self.play(Create(triangle))
self.play(Create(normal))
self.wait(1)
self.play(Create(triangle), run_time=1)
self.wait(2)
self.play(Create(normal), run_time=1)
self.wait(10)
plane_triangle = Polygon([0, 0, 0], [0, 0.7, 0], [0.7, 0, 0], stroke_width = 1, stroke_color=RED)
plane_triangle.shift([-0.35, -0.35, -4])
......@@ -112,9 +154,9 @@ class RasterizationTriangleScene(ThreeDScene):
self.add(remain_triangle)
self.play(Transform(triangle, plane_triangle))
self.wait(1)
self.wait(3)
self.move_camera(phi=PI, theta=0, gamma= PI / 2)
self.wait(1)
self.wait(5)
class RaytracingScene(Scene):
def construct(self):
......@@ -148,5 +190,3 @@ class RaytracingScene(Scene):
self.wait(3)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment