Put on the headset

Virtual Reality is a hit today in a variety kinds of industries. Not only animations, games and movies, but also education, even medicine start to make the best of the features of it. VR is not anything I could imagine 5 years ago, however it influences our life much now. As a student majoring in Entertainment Technology, I am lucky enough to have more opportunities to give a touch on VR technology.
Recall my first attempt on VR, like 4 years ago. I participated in a competition with some VR enthusiast and made a very simple version of portable VR headset, which, I would rather say, is very similar to the Google cardboard. While because people rarely saw VR in real life at that time, not to mention wearing a headset and feeling it, we turned out to get the 3rd place award. I realized then how VR is able to charm people, (who are tired of the real life, maybe not :)).
Through these semesters, having made, playtested and tried out many VR games, I found out that I am a person who would easily get absorbed in the VR world, (perhaps) same with our professor Pollard, which, I don’t think it’s a bad thing at all. Because I can go through different experience without stepping out of the buildings. I would feel losing balance standing on a thin wood in the air, cry out when a dinosaur is reaching me and dodge aside if something is hitting me. My friend is totally the opposite to me, so she came up with an idea of creating a jumping experience. Then we spent like no more than 10 minutes to create a scene where we can be thrown from a high building. Then, a fit of dizziness came over me, I suppose, drugs are nothing more than this.

6 / (-132) = -1 ?

In Leetcode problem 150. Evaluate Reverse Polish Notation, a test case

1
["10","6","9","3","+","-11","","/","","17","+","5","+"]

gave a wrong answer.
After looking into it, it turned out that Python caculates 6 / (-132) as -1, which seems weird to me.
The reason why that happened is that Python’s default division of intergers returns the floor(towards negitive infinity).
A simple way to avoid this is to use

1
result = int(float(a) / b).

Mini Project 2

Cloth simulation

Cloth simulation with mass spring method and constraint based method in C++ and OpenGL.

Features

  • Simulating method can be choosen from mass spring and constraint based
  • Object collision
  • Wind
  • Stiffness increase / decrease
  • Tearable
  • View / Shading mode options

How to use

In terminal, under current folder

1
2
$ make
$ ./main -r 30 -c 30 -m 0 -p 0

To run with different parameters

Opt Meaning Value
-r grid row count [3, 30]
-c grid column count [3, 30]
-m mode 0 ( mass spring ), 1 ( constraint based )
-p pin 2 or 4 points 0(2), 1(4)

In the window, to change the view or interact with the cloth

Key Meaning
W/A/S/D Move the view
mouse scrolling Scale the view
R Reset to default view
T Change to side view
E (hold) + mouse Rotate the view
Z Turn on/off the wind
X/C Increase/Decrease spring stiffness
Y Toggle wireframe/shaded mode
I/J/K/L/U/O Move the ball
[ Decrease the ball radius
] Increase the ball radius

Mini Project 1

In the Mini-Project 1, I implemented two of the options, one is CCD IK and the other is Keyframing.

CCD IK
platform: Unity 3D
deliverable: CCD/CCD.app
uploaded files: CCD/UnityFiles.tar CCD/CCD.app
description: This app allows us to simulation CCD IK. In this program, we can choose to generate 1 - 90 joints randomly rotated and scaled by using the slider to the top slider. Also, we can choose the iteration counts by changing the value of the slider below. By hitting create button, a set of joints will appear. By holding key “A,S,D,Q,W,E” on the keyboard, you can move the IK handle to the left, down, right, forward, up, backward. By holding key “J,K,L,U,I,O”, you can move the camera view in the same way. By hitting one of those joints on the screen, we can set the end effector to any of them.
process:
create 5 joints
if the target can't be reached
select the end effector
change the camera view

Keyframing
platform: Blender
deliverable: Keyframing/squash.blend videos to be uploaded still rendering..
description: This is the first model I’ve ever done the modeling, texturing, rigging, animating and rendering all by myself. I implemented two walk cycles, one is the normal one, the other angry.


implementation:
For the rigging part, I followed a standard rigging style for a bipedal character. And then created two knee pole targets, to make sure that the knees of my character are facing forward all the time. Two feet controllers were added to make it convenient to animate the step motion. And I also added two heel IK handlers to make the rotation of the feet more natural.
rigging
controllers
Then I followed the Animators_Survival_Kit to make the walking cycle, which turned out to be not bad, (satisfied me at least XD ). Then the angry walking cycle, since the motion is a bit exaggerated, end up being a little bumpy. Funny.


Setup glfw and glew

I used OpenGL more than once before. However, every time I have to start a new OpenGL project, it would be like the first time. Because I will encounter so many new problems or old which I don’t remember. Today I used XCode to build a very simple program, but there turned out to be some fresh errors.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Undefined symbols for architecture x86_64:
"_glewExperimental", referenced from:
_main in main-8eb2b0.o
"_glewInit", referenced from:
_main in main-8eb2b0.o
"_glfwCreateWindow", referenced from:
_main in main-8eb2b0.o
"_glfwInit", referenced from:
_main in main-8eb2b0.o
"_glfwMakeContextCurrent", referenced from:
_main in main-8eb2b0.o
"_glfwTerminate", referenced from:
_main in main-8eb2b0.o
"_glfwWindowHint", referenced from:
_main in main-8eb2b0.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Actually they are not special at all. It’s just because those libraries were not completely installed or linked(I guess). But the challenge today is my Homebrew and Macport also broke down like they intend(probrably because I haven’t used them for a long time). Then to solve the problem. I used the very universal solution: reinstall everything - homebrew, macport, glew, glfw3. Then it worked. But it took me incredibly hours.

1
gcc -o main main.cpp -framework OpenGL -framework GLUT -lGLEW -lglfw3