From 601c7836ca876773c88b154b71b2f207241cbc0c Mon Sep 17 00:00:00 2001 From: shivbat <shivbat@cs.washington.edu> Date: Tue, 3 May 2022 14:59:29 -0700 Subject: [PATCH] raytracing scene --- lightbulb.png | Bin 0 -> 2108 bytes video.py | 33 ++++++++++++++++++++++++++++++++- 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 lightbulb.png diff --git a/lightbulb.png b/lightbulb.png new file mode 100644 index 0000000000000000000000000000000000000000..a0289b574408b563b7b58fc4394e6a129f1165a0 GIT binary patch literal 2108 zcmV-C2*dY@P)<h;3K|Lk000e1NJLTq003S9003?X1^@s6uBfEL000OBNkl<ZcwX(D zfpr@<42G=<noLk-f;tmaouKIiQ6{K6L6r%bPEdJ*rV~_|AkGApCulN(`~QA81!BoN z@{R;4Kk~hMa&$Zr{D=bqkakvAy;LEvs?uxk^s0leqy!y&2VaRmrEa^%ckq=6RO+^C zd<S2NK&5WG#&_`X1Rfq9)~NlrJn_S7wK~Q>-A2ue)Odj30pG8J@GZde-xpOn_)62& z!FTZS1iGn-XO*>P2cH#Zd}AGaJgclVJNT?P;~VSX<5^{`*}(^J3Yc$jo59WJtklsM z+P}faZ_@5B=;K|1KAuUC_8INJ&E0->KORuF5b_TZ^bVg4=}W=CDhQn^iEA0h8}zf! z3BLsR4FnwWD3rAr{G1?$wxBrFbPb)is62<9{bdJF;T)~M82AC`*|nWOih#dF_?FO% zg1;pA*3gTC&k0|0@ZZUTx5g(gmcjNO@$)CxVy-FCr3Q2p@B#S00}x%p(E=zxqQVx} z1{W8-m_iSVlkpyX+)h1!KIn@6tm+l9>8>2bY`oi%v)~3dFGK@h<9SZZdJ5dceNF<w za-zL1trLuyKsVF)0S*R9&0U9lV%&d)`wWbh0(a+w&~HL-fGEW=x63%D6lNMfCWL4? zgD!#(l`ptK`%N=Kko=hwG)xjFl>rYU=1}3YKa~jR#>VHnR~<Z{6BeNlQKFWUu;1f) z7rSW6Tf+(D<(mXf8Uv!FMK~4gRQ;;p1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CwU>cY^Yw8$LRjqSNWbn`P5SH9^v6vL$DcP@<k@d=@PS3`ED<F;Jg%p+ z*yIFE%-Mdg=Z!FdUle=*x;HHMM3ReA3gWN3XEnW(iMo9IbULFr{9@o!pvx=I#g-;U zo1EEN@6q<rlz=t-BH&Y@4+{>S+u>)OQkZ>~5p6LItrK9AC&Vn_X9qtQy3%?#Z=bv| z;j!Cau$bye80PwapH}cofWN_L^vSEFR4WF)IB)MUGbb-9NL=0Uz)u=OOdln{uhB6V zC)(;{fqfbWZB6>+FtoAwNVt-NYXcK#Tz|5a?BJEjcs55^F;!>g2JIxti8jtou0f_* z+j-&{@t{)npekuV*`|A<ArH9dvz8K&=>tm9_T6fH?59=m2go+-bg?HGtCk2Go5&8{ zQq5Ig9efA>l>p2|H#IdBqJytN9esKNpviE55Y>}*sIs*;g|1Z_??%7$qxZO`{As2I zwz!gVG*ggD+;0`UFH<>Z{HBMLQUq)gyhOj$T%99N8P`xZIb|`YlR3{c3tqwJQIN5} ztmhjyHJyL%kmjk$(lmI1PqXt1*E*8m5%u_2R;Sj3$mYsaYaV==Vb^c9Y4DOA)F*mV zh%pCG?QgQQ4xZrLGdHmyXKx$EcCe)0QwDzzjgMUymN1<4Z0q2!WnrB&I4-b{hn89_ zO@nU{ST32G1}~=te197_X8g?2aO1qm(mHth;;F&Y0GfNH&zqzUp;`xjfQ;@L`dF4t zZut$uHw~Ub${uPg>{C5xJ14E#(meQP$t@J@V!+En%WP%nC?3}XW+R(jQ1x7068IQ< z-?Ux7RPfAD?nk^Frh@rDEp&}vXa=A3;}>IUp4u#Q@Req?gYV!g5vbH{*Z2;;5`jwH mc8%}gD-o#FZP)lp;Qs?rOSPQ-eGc^i0000<MNUMnLSTX^DG?L^ literal 0 HcmV?d00001 diff --git a/video.py b/video.py index 6ee7b46..f847f64 100644 --- a/video.py +++ b/video.py @@ -1,4 +1,5 @@ from manim import * +from matplotlib.lines import Line2D SCREEN_WIDTH = 14.2 SCREEN_HEIGHT = 8 @@ -101,4 +102,34 @@ class RasterizationTriangleScene(ThreeDScene): class RaytracingScene(Scene): def construct(self): square = Square(side_length=3) - square.shift([1, 1]) + square.shift([1, 1, 0]) + + circle = Circle(radius=1.5) + circle.shift([-3, -2, 0]) + + triangle = Triangle() + triangle.shift([1.5, -3, 0]) + + lightbulb = ImageMobject("lightbulb.png") + lightbulb.shift([-0.75, -3.5, 0]) + self.add(lightbulb) + self.play(Create(square), run_time=0.5) + self.play(Create(circle), run_time=0.5) + self.play(Create(triangle), run_time=0.5) + self.wait(1) + + + light_rays = [ + ([-2, 5, 0], [-2, -0.85, 0]), + ([-2, -0.85, 0], [1.4, -2.2, 0]), + ([1.4, -2.2, 0], [0, -0.5, 0]), + ([0, -0.5, 0], [-0.7, -3.3, 0]) + ] + + for ray in light_rays: + self.play(Create(Line3D(start=ray[0], end=ray[1], color=YELLOW)), run_time=0.5) + + self.wait(3) + + + -- GitLab