Featured image of post Ray Tracing Tutorial - Cherno

Ray Tracing Tutorial - Cherno

Table of contents

Output An Image

Use Template

  1. Supports:

    1. Recursive clone

      1
      
      git clone https://github.com/zichen34/RayTracing-Cherno.git
      
    2. Install development system dependencies: r1-GPT5

      1
      2
      3
      4
      5
      6
      
      sudo apt update
      sudo apt install -y build-essential git cmake \
          libx11-dev libxcursor-dev libxi-dev libxrandr-dev libxinerama-dev \
          libgl1-mesa-dev libvulkan-dev vulkan-tools \
          libwayland-dev libxkbcommon-dev \
          libglm-dev
      

    ::: aside

    References {{{
    1. GPT5 - Run app on Ubuntu }}}
    :::

Build Premake5 From Source

  1. Problems:

    1. The lastest released binary premake-5.0.0-beta7 requires GLIBC_2.38

      Commands of installing prebuilt bin {{{ ```shell # Quick option: download a premake5 binary wget https://github.com/premake/premake-core/releases/download/v5.0.0-beta7/premake-5.0.0-beta7-linux.tar.gz tar -xzf premake-5.0.0-beta7-linux.tar.gz sudo mv premake5 /usr/local/bin/ premake5 --version ``` }}}

      The binary premake5 is not usable due a GLIBC mismatch:

      1
      2
      3
      
      zichen@zichen-X570-AORUS-PRO-WIFI:~/Downloads$ premake5 --version
      premake5: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.38' not found (required by premake5)
      premake5: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.38' not found (required by premake5)
      
  2. Supports:

    1. Check GLIBC version:

      1
      2
      
      ldd --version     # glibc version
      lsb_release -ds   # Ubuntu version
      
      Output {{{ ```shell zichen@zichen-X570-AORUS-PRO-WIFI:~/Downloads$ ldd --version ldd (Ubuntu GLIBC 2.35-0ubuntu3.11) 2.35 Copyright (C) 2022 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Written by Roland McGrath and Ulrich Drepper.

      zichen@zichen-X570-AORUS-PRO-WIFI:~/Downloads$ lsb_release -ds Ubuntu 22.04.5 LTS

      1
      2
      
      }}}
      </details>
      
    2. Build premake5 from downloaded source code package r3-Github

      1
      2
      3
      
      unzip premake-5.0.0-beta7-src.zip -d premak5-src/
      $ cd build/gmake.unix
      $ make config=release
      

    ::: aside

    References {{{ 1. [GPT5 - Run app on Ubuntu](https://chatgpt.com/c/69128f99-ff3c-832d-88ab-fe1517ca84db) 2. [Download Premake | Premake](https://premake.github.io/download) 3. [premake-core/BUILD.txt](https://github.com/premake/premake-core/blob/master/BUILD.txt) }}}
    :::

Resize Image

Replace Image in the Original Structure

  1. Problems:

    1. Maintain the same memory address pointer to the image, while substituting an new image with updated width and height.
  2. Supports:

    1. Resize r1-

    ::: aside

    References {{{ 1. [Rendering a Sphere Using Ray Tracing! // Ray Tracing Series - The Cherno](https://youtu.be/v9vndyfk2U8?list=PLlrATfBNZ98edc5GshdBtREv5asFW3yXl&t=332) }}}
    :::

Render A Ball

  1. Problems:

    1. Ray hits a ball, and return color value


Determine whether a Line intersects a Circle

  1. Problems:

  2. Supports:

    1. Parametric equations:

      +———————-+——————————+——————————-+ | | Ray | Circle | +======================+==============================+===============================+ | Function | $y = x$ | $(x-a)^2 + (y-b)^2 = r^2$ | +———————-+——————————+——————————-+ | Parametric | (Origin, Direction, Len) | | | equations in | | | | Vector form | | | +———————-+——————————+——————————-+ | Parametric | $x = o_x + d_x t$
      | | | equations in | $y = o_y + d_y t$ | | | component form | | | +———————-+——————————+——————————-+


Built with Hugo
Theme Stack designed by Jimmy