Skip to content

Latest commit

 

History

History

rt_next_week

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Ray Tracing: The Next Week

source

1. Motion Blur

In a real camera, the shutter opens and stays for a time interval, and the camera and objects may move during that time. Its really an average of what the camera sees over that interval that we want.

Intuition of Ray Tracing

  • visual quality worth more than run-time
  • almost all effects can be brute-forced

Introduction to SpaceTime Ray Tracing

generate rays at random times while the shutter is open and intersect the model at that one time.

The way it is usually done is to have the camera move and the objects move, but have each ray exist at exactly one time.

Solution

  • add time to each ray, the ray exists at the time.
  • modify the camera, it will only generate rays in an interval
    • the interval can be set by constructor parameters, so the function call is simpler, this is a personal preference on design choice.
  • add moving object, the object will have a function that maps time to the position. I think it can be any trajectory generate method.
    • in the hit function, each time it will generate a new random center based on the interval given in the constructor.
  • track the time in the intersection. Set time for scattered ray, reflected ray and refracted ray.

Debug cudaFree error 700

ref 1 ref 2

Warning: 5 records have invalid timestamps due to insufficient device buffer space. You can configure the buffer space using the option --device-buffer-size.

cudaFree 700 error solved, the reason it casting moving_sphere to sphere in the free function

2. Bounding Volume Hierarchies

  • main bottle neck: calculation of ray-object intersection.
    • run time: O(# obj)
    • repeated search on the same model (what about animation ?)
    • should be able to use divide and conquer to archieve sub-linear search
  • common approaches
    • divide the space
    • divide the objects (much easier to code up)

Key Idea

bounding volume a volume that fully encloses (bounds) all the objects

if (ray hits bounding object)
    return whether ray hits bounded objects 
else
    return False
  • we are dividing objects into subsets.
  • we are not dividing screen or the volume
  • any object is in just one bounding volume
  • bounding volumes can overlap

Hierarchies of Bounding Volumes

  • it is a tree
  • the tree has no order
  • subtrees can overlap, in the overlap volume, each object belongs to exactly one of the two bounding volumes
if(hits purple)
    hit0 = hits blue enclosed objects
    hit1 = hits red enclosed objects
    if (hit0 or hit1)
        return True and info of closer hit
return False

Axis-Aligned Bounding Boxes (AABBs)

Question: What are octree and k-d tree ?

ref 1

Factors of design bounding volume

  • ray boundding volume intersection should be fast
  • bounding volume should be compact
  • What we want to know
    • whether or not it"s a hit ?
  • What we dont want to know
    • hit points
    • hit normals
  • AABB: axis-aligned bounding rectangular parallelepiped axis-aligned bounding box
  • n-dimensional AABB: the intersection of n axis-aligned intervals, often called "slabs"

Constructing Bounding Boxes for Hittables

  • compute the bounding boxes of all the hittables
  • make a hierarchy of boxes over all the primitives, and the individual primitives (like the sphere will live at the leaves)

The BVH Node Class

Its hit can be done in recursive way or iterative way. It turns out CUDA prefers iteration.

Solid Textures

What is a texture in graphics ?

  • a function that makes colors on a surface procedural.
    • The procedure can be
      • color synthesis code
      • image lookup
  • The author prefers to make color as texture although most programs keeps constant rgb colors and textures in different classes.

Perlin Noise

wikipedia

Perlin Noise is a technique used to produce natural appearing textures on computer generated surfaces for motion picture visual effects. The development of Perlin Noise has allowed computer graphics artists to better represent the complexity of natural phenomena in visual effects for the motion picture industry.

Perlin noise returns something similar to blurred white nose.

  • A key part of Perlin noise is that it is repeatable: it takes a 3D point as input and always returns the same randomish number. Nearby points return similar numbers.

  • Another important part of Perlin noise is that it be simple and fast, so it’s usually done as a hack.

Rectangles and Lights

Early ray tracers used abstract light sources, like points in space, or directions.

Modern ray tracers have more physically based lights, which have position and size.

To create such light sources, we need emissive materials to turn any regular object into something that emits light into our scene.

Instances

Translation and Rotation

Note the below 2 shifts have differnt reference coordinate frames.

  • hit: shift the ray

  • bounding_box: shift the object

Volumes

Implementation of smoke/fog/mist effects.

volumes / participating media

  • subsurface scattering: usually adds software architectural mayhem because volumes are a different animal than surfaces.

  • a surface that probabilistically might or might not be there at every point in the volume