Commit 291449b4 authored by Hui Wang's avatar Hui Wang
Browse files

update doc for A4

parent 678e6ab2
......@@ -19,4 +19,16 @@ Try to create your own model with Scotty3D!
![](./docs/results/me_f20.png)
### Path Tracer
Here are sampled images created by CMU students. ([video](https://youtu.be/yJ5eY3EIImA?t=142))
Try to render your own image with Scotty3D!
![fall 2020 path tracer 0](docs/results/pt_f20_0.jpg)
![fall 2020 path tracer 1](docs/results/pt_f20_1.png)
![fall 2020 path tracer 2](docs/results/pt_f20_2.png)
![fall 2020 path tracer 3](docs/results/pt_f20_3.png)
### Animation
Here are sampled animation created by CMU students. ([video](https://youtu.be/yJ5eY3EIImA?t=326))
\ No newline at end of file
......@@ -4,24 +4,18 @@
# Animation Overview
**Warning: This part is UNTESTED!**
There are four primary components that must be implemented to support Animation functionality.
**A4.0**
- [(Task 1) Spline Interpolation](./splines)
- [(Task 2) Skeleton Kinematics](./skeleton_kinematics)
**A4.5**
- [(Task 3) Linear Blend Skinning](./skinning)
- [(Task 4) Particle Simulation](./particles)
- [(Task 1) Spline Interpolation](/docs/animation/splines.md)
- [(Task 2) Skeleton Kinematics](/docs/animation/skeleton_kinematics.md)
- [(Task 3) Linear Blend Skinning](/docs/animation/skinning.md)
- [(Task 4) Particle Simulation](/docs/animation/particles.md)
Each task is described at the linked page.
## Converting Frames to Video
Additionally, we will ask you to create your own animation. Once you've rendered out each frame of your animation, you can combine them into a video by using:
Additionally, we will ask you to create your own animation. Once you've rendered out each frame of your animation (see [Animate Mode](/docs/guide/animate.md) for details), you can combine them into a video by using:
`ffmpeg -r 30 -f image2 -s 640x360 -pix_fmt yuv420p -i ./%4d.png -vcodec libx264 out.mp4`
......
---
layout: default
title: Particles
parent: "A4: Animation"
nav_order: 4
permalink: /animation/particles
[[Home]](/docs/index.md) [[User Guide]](/docs/guide/guide.md) [[Mesh Edit]](/docs/meshedit/overview.md) [[Path Tracer]](/docs/pathtracer/overview.md) [[Animation]](/docs/animation/overview.md)
---
# Particle Systems
......
---
layout: default
title: Skeleton Kinematics
parent: "A4: Animation"
nav_order: 2
permalink: /animation/skeleton_kinematics
[[Home]](/docs/index.md) [[User Guide]](/docs/guide/guide.md) [[Mesh Edit]](/docs/meshedit/overview.md) [[Path Tracer]](/docs/pathtracer/overview.md) [[Animation]](/docs/animation/overview.md)
---
# Skeleton Kinematics
......@@ -20,11 +16,17 @@ When a joint's parent is rotated, that transformation should be propagated down
<center><img src="task2_media/forward_kinematic_diagram.jpg" style="height:480px"></center>
There are 3 types of coordinate spaces: bind, joint, and pose. Bind is the initial coordinate frame of the vertices of where they are bound to relative to the mesh. Joint is the position of the vertex relative to a given joint. Pose is the world-space position after the joint transforms have been applied. You'll want to compute transforms that take vertices in bind space and convert them to posed space
<center><img src="task2_media/coordinate_spaces.png" style="height:480px"></center>
You need to implement these routines in `student/skeleton.cpp` for forward kinematics.
* `Joint::joint_to_bind`
Return a matrix transforming points in the space of this joint
to points in mesh space in bind position up to the base of this joint (end of its parent joint). You should traverse upwards from this joint's parent all the way up to the root joint and accumulate their transformations.
to points in mesh space in bind position up to the base of this joint (end of its parent joint). You should traverse upwards from this joint's parent all the way up to the root joint and accumulate their transformations.
- Bind position implies that all joints have `pose = Vec3{0.0f}`.
- (Hint: `Mat4::euler()` and `Mat::translate()` might come in handy).
* `Joint::joint_to_posed`
Return a matrix transforming points in the space of this joint to points in mesh space, taking into account joint poses. Again, you should traverse upwards from this joint's parent to the root joint.
* `Skeleton::end_of`
......
---
layout: default
title: Skinning
parent: "A4: Animation"
nav_order: 3
permalink: /animation/skinning
[[Home]](/docs/index.md) [[User Guide]](/docs/guide/guide.md) [[Mesh Edit]](/docs/meshedit/overview.md) [[Path Tracer]](/docs/pathtracer/overview.md) [[Animation]](/docs/animation/overview.md)
---
# Linear Blend Skinning
......@@ -19,10 +15,12 @@ Your implementation should have the following basic steps for each vertex:
- Find where this vertex would end up (in world coordinates) if it were transformed along with bone j.
- Find the closest point on joint j's bone segment (axis) and compute the distance to this closest point (Hint: `closest_on_line_segment` might come in handy).
- Diagram of `closest_on_line_segment`:
<center><img src="task3_media/closest_on_line_segment.png" style="height:280px"></center>
- Compute the resulting position of the vertex by doing a weighted average of the bind-to-posed transforms from each bone and applying it to the vertex. The weights for the weighted average should be the inverse distance to the joint, so closer bones have a stronger influence.
Below we have an equation representation. The ith vertex v is the new vertex position. The weight w is the weight metric computed as the inverse of distance between the ith vertex and the closest point on joint j. We multiply this term with the position of the ith vertex v with respect to joint j after joint's transformations has been applied.
Below we have an equation representation. The i-th vertex v is the new vertex position. The weight w is the weight metric computed as the inverse of distance between the ith vertex and the closest point on joint j. We multiply this term with the position of the ith vertex v with respect to joint j after joint's transformations has been applied.
<center><img src="task3_media/skinning_eqn1.png" style="height:100px">
<img src="task3_media/skinning_eqn2.png" style="height:120px"></center>
......
[[Home]](/docs/index.md) [[User Guide]](/docs/guide/guide.md) [[Mesh Edit]](/docs/meshedit/overview.md) [[Path Tracer]](/docs/pathtracer/overview.md) [[Animation]](/docs/animation/overview.md)
---
layout: default
title: Splines
parent: "A4: Animation"
nav_order: 1
permalink: /animation/splines
---
# Spline Interpolation
As we discussed in class, data points in time can be interpolated by constructing an approximating piecewise polynomial or spline. In this assignment you will implement a particular kind of spline, called a Catmull-Rom spline. A Catmull-Rom spline is a piecewise cubic spline defined purely in terms of the points it interpolates. It is a popular choice in real animation systems, because the animator does not need to define additional data like tangents, etc. (However, your code may still need to numerically evaluate these tangents after the fact; more on this point later.) All of the methods relevant to spline interpolation can be found in `spline.h` with implementations in `spline.inl`.
......@@ -76,7 +73,7 @@ Internally, a Spline object stores its data in an STL map that maps knot times t
### Using the splines
Once you have implemented the functions in `spline.cpp`, you should be able to make simple animations by translating, rotating or scaling the mesh in the scene. The main idea is to:
Once you have implemented the functions in `spline.inl`, you should be able to make simple animations by translating, rotating or scaling the mesh in the scene. The main idea is to:
* create an initial keyframe by clicking at a point on the white timeline at the bottom of the screen
* specify the initial location/orientation/scale of your mesh using the controls provided
* create more keyframes with different mesh locations/orientations/scales and watch the splines smoothly interpolate the movement of your mesh!
......
......@@ -38,3 +38,7 @@ Different poses can be set as keyframes to animate the object.
<video src="./animate_mode/guide-posing-rig.mp4" controls preload muted loop style="max-width: 100%; margin: 0 auto;"></video>
![](./animate_mode/guide-posing-rig.mp4)
### Animation Rendering
To render your animation, press `Render` button in `Timeline` window. The animation will be rendered as a sequence of frames named as `%04d.png` in `Output Folder`.
![](./animate_mode/render-animation.png)
\ No newline at end of file
......@@ -18,10 +18,10 @@ different actions in `Render` mode.
For the detailed documentation, see the guides of each mode:
- [Layout Mode](/docs/guide/layout.md)
- [Model Mode](/docs/guide/model.md)
- [Render Mode](/docs/guide/render.md),
- [Rigging Mode](/docs/guide/rig.md),
- [Animate Mode](/docs/guide/animate.md),
- [Simulate Mode](/docs/guide/simulate.md).
- [Render Mode](/docs/guide/render.md)
- [Rigging Mode](/docs/guide/rig.md)
- [Animate Mode](/docs/guide/animate.md)
- [Simulate Mode](/docs/guide/simulate.md)
The current mode is displayed as the "pressed" button in the menu bar, and available actions
are are detailed in the left sidebar. Note that some actions are only available when a model/element/etc. is selected.
......
......@@ -107,6 +107,7 @@ void Skeleton::skin(const GL::Mesh& input, GL::Mesh& output,
for(size_t i = 0; i < verts.size(); i++) {
// Skin vertex i. Note that its position is given in object bind space.
// map[i].push_back(j) will create <i,[j,]> pair in the map if not found.
}
std::vector<GL::Mesh::Index> idxs = input.indices();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment