Particle Simulation, IK, and Ray Tracing Techniques

This project is the outcome of assignments from USC CSCI 420 and CSCI 520, taught by Prof. Jernej Barbic. CSCI 520 demonstrates that we have developed a particle physics engine and IK-driven skeletal animation by applying physical and mathematical models, as well as skinning methods, with the help of OpenGL and mathematical libraries such as Eigen and ADOL-C.

Three main contributions are displayed here:

Jelly (Particle Simulation)

<Description of what you have accomplished> It should achieved all the requirements of the assignment, including:

  1. external force (force field) using trilinear interpolation;
  2. internal forces constituted by structural, shear2D, shear3D, and bend mass-spring system with elastic and damping;
  3. collision with bounding box using penalty force.

<Also, explain any extra credit that you have implemented.>

  1. inclined plane initialization and collision;
  2. interactive control: globally push the jello cube based on vector NDC->world space transform;
  3. interactive control: locally control a single point/batch points within isotropic gaussian model by utilizing stencil buffer and color trick for simplicity (using depth buffer is another possible path but we stick to color here);
  4. debug mode to enable selected point force visualization (red: bend, green: shear/shear3D, blue: structural, yellow: user global/local input);
  5. a shader used to debug the stencil buffer (not shown in the final result but inside the code).

NOTE:

  1. the JPEG folder has shown the effect of item 2/3 of requirement part and item 1/2/3/4 of extra credit part using “jello.w”, where the first yellow input is global input and the second is local (you can see the obvious local effect). For requirement 1, using “rotate.w” can prove it has been completed.
  2. to control optional parameters of extra credit part, please locate to line 44-48 of “jello.cpp” and change the parameters to see the effect.
  3. for extra credit 2/3/4, you must specify a surface point first.

Some regrets (no time/effort to do) which may occur in later assignments:

  1. still cannot read an obj of sphere, even monkey head to enable irregular object collision detection;
  2. did not achieve light/phong’s or advanced BRDF shader/skybox change;
  3. did not achieve mouse selection solely by stencil buffer due to the complex mechanism behind it.

Inverse Kinematics (IK)

<Description of what you have accomplished> It should achieved all the requirements of the assignment, including:

  1. skinning;
  2. forward kinematics (FK);
  3. inverse kinematics (IK).

<Also, explain any extra credit that you have implemented.>

  1. implemented dual-quaternion skinning. See skinning.cpp » dualQuaternion();
  2. implemented pseudoinverse IK method. See ik.cpp » pseudoInverse();
  3. when the user moves the IK handle for a long distance, divide the IK process into several sub-steps to improve the solution, where each sub-step solves the IK problem on a portion of the original distance. See ik.cpp;
  4. implement IK handles at mesh vertices instead of at skeleton joints. This means that the IK computation now needs to involve skinning (achieved only when using linear blend & pseudo inverse). See ik.cpp.

NOTE:

  • You can find the animation in “JPEG” folder.
  • All the above extra credit can be re-implemented by controlling the user input hyperparams in driver.cpp (line 85).
  • For extra 4, to enable selection of mesh points, we changed some scripts in vega. A mesh point can be selected only if it is near the handle joint (the IK joint).

Ray Tracing

MANDATORY FEATURES

<Under “Status” please indicate whether it has been implemented and is functioning correctly. If not, please explain the current status.>

Feature: Status: finish? (yes/no) ————————————- ————————- 1) Ray tracing triangles yes

2) Ray tracing sphere yes

3) Triangle Phong Shading yes

4) Sphere Phong Shading yes

5) Shadows rays yes

6) Still images yes

7) Extra Credit (up to 30 points)

  1. Interactive multi-thread rendering (Using “Release” mode will make the program much faster! But it is still slow when rendering extra credit scenes. Please be patient when executing extra credit tasks, which may take more than 5 minutes, e.g. siggraph_5disney_100spp_2recursion_40attenuation.jpg will take 782s with 24 threads in Release mode);
  2. Monte-Carlo sampling with PDF normalization (spp can be adjusted in hw3.h, default=20);
  3. Soft shadow effect (by-product of Monte-Carlo sampling);
  4. Two extra shaders: default CS520 BRDF shader, and Disney BRDF simple shader (omitted subsurface scattering, etc.) with color scaler=5 to have the best overall visualization (the reason of implementing two shaders is because the output images are somewhat brighter with scaler=1 and very dark with scaler=255. By having similar output of two BRDF models we can assume that the bright/dark results were not caused by my algorithm, because the interpolation has no problem and can output core credit results 100% correctly);
  5. Reflection of 2 recursions with attenuation.

Note:

  1. Due to the reason of different representation form between core credit and extra credit, we make the input form to be: hw3.exe [y/n] *.scene *.jpg, where y means using extra credit scene. Every extra scene is marked with “_extra” suffix. Please ensure the input form and file is correct, For example:
    • hw3.exe y test2_extra.scene test2_disney_20spp.jpg
    • hw3.exe n test2.scene test2.jpg
  2. We only support changing shaders (BRDF/BRDFDisney) and color scaling through code;
  3. We only support changing spp, reflective recursion and attenuation through code.

This is the final version of my homework. I will not implement anti-aliasing or animations (for anti-aliasing, I am aware that DLSS is the SOTA technique which is related to deep learning; for animation, I prefer real-time processing over offline).

In addition, we have implementation of Euler-angle Bezier SLERP interpolation for skeletal animation, parametric curve subdivision rendering and orientation handling, mesh rendering, GLSL shaders, skybox rendering, texture mapping, etc.

Share: X (Twitter) Facebook LinkedIn