Semester 2, Week 04 Post - 62firelight/manimRT-490 GitHub Wiki

What's New

  • Renamed the distance parameter to length in the Ray3D Mobject (and all scenes that refer to distance)
  • Fixed typos in Ray3D's get_equation method
  • Tested the distribution of ManimRT by "releasing" it on TestPyPI
  • Made a plan for the educational videos

Packaging ManimRT

Release

I have tested releasing ManimRT as a package.

You can find (and install) the ManimRT package on TestPyPI here -- https://test.pypi.org/project/manim-rt/

Make sure to uninstall ManimRT after using it, as this version will most likely be replaced later.

As part of "releasing" this package, I added some lines to the __init__.py file so that it imported everything from the classes (e.g., RTSphere, Ray3D, RTCamera) in the same directory. This addition ensured that I wouldn't have to add unnecessary notation when using ManimRT (e.g. RTSphere.RTSphere to refer to an RTSphere).

Plugin Template

https://pypi.org/project/manim-plugintemplate/

The plugin template at this link was helpful in getting an idea of what to do for the file structure and what to do with the different files.

However, I thought there were some gaps in the documentation for how to do specific things (for example, it doesn't tell you how to authenticate yourself when you upload a package) as it seems to expect you to know how to do those things by default. I think it's a good guide if you're already familiar with uploading packages to PyPI, but not so much if you're a beginner (like me).

Educational Videos for 490

Thinking about how to handle these videos which will be included in the final report...

Goals

I have two goals in mind when it comes to making the educational videos.

The goal of these educational videos are to:

  • Explain key ray tracing concepts
  • Demonstrate capabilities of ManimRT

Plan

  1. Introduction to Ray Tracing
    • What is ray tracing?
    • Quick overview of shadows, reflections and refractions
    • Quick overview of other applications (path tracing, real time ray tracing, etc)
  2. Ray-Object Intersections
    • Finding intersections between a ray and a sphere (at the origin)
    • Handling transformed objects
    • Handling other objects
  3. Lighting in a Ray Tracer
    • Introduce Phong illumination model
    • Calculating unit vectors and light energy from light sources (formula where $E = E_0/d^2$)
    • Shadows and reflections

For now, I have decided to not to do a video on refraction. While I can demonstrate refraction using the stuff I've implemented, I don't think I would be able to explain it well. Also, the rule of three is just nice in general.

Questions

Big Question

Could you try installing the ManimRT package from TestPyPI and testing to see if it works (using the code below)?

Use the following command to install ManimRT.

pip install -i https://test.pypi.org/simple/ manim-rt

Create a file called ManimRTExample.py and paste the following code:

from manim import *

from manim_rt import *


class ManimRTExample(ThreeDScene):
    def construct(self):
        self.set_camera_orientation(phi=65*DEGREES, theta=-135*DEGREES, zoom=1.5)
        
        sphere = RTSphere(color=BLUE)
        
        ray = Ray3D([-5, 0, 0], length=10, color=RED)
        
        self.begin_ambient_camera_rotation(0)
        
        self.add(sphere)
        
        self.play(Create(ray, run_time=2))
        
        self.wait(2)

Open a command line interface and go to the directory with ManimRTExample.py.

Use the following command to test the scene:

manim -pql ManimRTExample.py

After confirming if it works or not, uninstall ManimRT. pip uninstall manim-rt should do the trick.

Small Questions

  1. Any experience using Sphinx and/or Furo (the same tools used to generate the documentation for Manim)?
  2. What would be the preferred format for ManimRT's documentation? Is the GitHub Wiki enough? Or should it look like the existing Manim documentation?
  3. Is it possible to reuse the animation from the evaluation for the videos (or the other way around) to save time? Or is it too early to decide that right now?
  4. Is there a better name for this white dot that's part of the virtual camera? I forgot why I called this projection_point in the first place.

image

  1. Would it be possible to review my script for Introduction to Ray Tracing at this link? Ignore the sections that are commented.

What's Next

  • Develop full video for introduction to ray tracing
  • Write tutorial documentation for ManimRT
  • Think about evaluation