Hacking the Kinect with GAFFTA Day 3

4,659 views

Published on

Day 3 of my workshop using open frameworks and c++ to use the kinect

Published in: Technology
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
4,659
On SlideShare
0
From Embeds
0
Number of Embeds
3,750
Actions
Shares
0
Downloads
0
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

Hacking the Kinect with GAFFTA Day 3

  1. 1. OPEN FRAMEWORKS + KINECT PART III @GAFFTAThursday, March 14, 13
  2. 2. 3D and Open Frameworks Cameras 3D Math Classes OpenGL WrappersThursday, March 14, 13
  3. 3. Vector Classes ofVec2f , ofVec3f , ofVec4f align() cross() distance() rotate() perpendicular() dot() vectors are used to store dimensional data such as position, direction, length ( or magnitude )Thursday, March 14, 13
  4. 4. Quaternion Classes ofQuaternion With 3D rotation becomes more complicated rotating in X ,Y , and Z in different orders will result in different perceived rotations. Quaternions are used to calculate “moves” between rotations for consistency.Thursday, March 14, 13
  5. 5. Matrices Classes ofMatrix3x3 , ofMatrix4x4 getRotate( ) getEuler( ) inverse( ) makeRotate( ) Matrices are often used to calculate 3d transformation data on a set of data to move things between coordinate spaces. Luckily of wraps a lot of this lower level functionality so these classes are more behind the scenes classes until you want to get really low level.Thursday, March 14, 13
  6. 6. 3D Math ofWrapDegrees() ofRadToDeg( ) ofNoise( ) ofInsidePoly() ofRandom( ) Open Frameworks does a really good job of wrapping simple math functions that are often used when working with polygons angles and generative artThursday, March 14, 13
  7. 7. Cameras Cameras is a great way to control how a 3D rendered scene looks. Cameras are the “eyes” of the window. The camera position has a large effect on rendered effects such as lights and shading. *HTTP://WWW.OPENFRAMEWORKS.CC/DOCUMENTATION/3D/OFCAMERA.HTML ofCamera - base camera class. Camera rendering is controlled similar to an ofFbo with ofCamera::begin() and ofCamera::end( ) ofEasyCam - extends ofCamera and adds a little extra functionality including mouse dragging functionality.Thursday, March 14, 13
  8. 8. OpenGL OpenGL is an API for interactive directly with the GPU which is much more adept at handling parallel processing than the CPU. OpenGL is a very deep and extensive topic but the basics are wrapped well in Open Frameworks ofMesh - An ofMesh represents a set of vertices in 3D spaces, and normals at those points, colors at those points, and texture coordinates at those points. Each of these different properties is stored in a vector.Vertices are passed to your graphics card and your graphics card fill in the spaces in between them in a processing usually called the rendering pipeline. The rendering pipeline goes more or less like this: *HTTP://WWW.OPENFRAMEWORKS.CC/DOCUMENTATION/3D/OFMESH.HTMLThursday, March 14, 13
  9. 9. OpenGL ofNode - basic “3d” object class with position , rotation , and orientation. It also has some hand functions like : lookAt( ) which orients an ofNode object to any other ofNode object ofShader - shaders are small programs written in GLSL that allow for really intensive rendering computation. They are often split into two parts : the Vertex shader which works with vertices , and the Fragment shader which works with pixels. Shaders are a very deep topic but OF makes it easy to : load a shader from an external text file pass any data into the shader begin() and end() rendering. ofTexture - allows pixel data to be rendered on 3d vertices ofMaterial - contains properties for how textures are rendered such as shininess and color along with specular colorThursday, March 14, 13
  10. 10. Kinect Point Cloud The kinect interprets the scene in 3D so it’s easy to work with the raw data. All you have have to do in OF is add it to an ofMesh and point an ofCamera at it.Thursday, March 14, 13
  11. 11. ofxKinect + ofxUI + Point CloudThursday, March 14, 13
  12. 12. Splicing the Point CloudThursday, March 14, 13
  13. 13. Masking a Fragment ShaderThursday, March 14, 13
  14. 14. Cube Point CloudThursday, March 14, 13
  15. 15. Apply Vertex + Fragment ShaderThursday, March 14, 13

×