Skip to content

3D Inverse Kinematics with Constraints and... GPU Ray Tracing!

Notifications You must be signed in to change notification settings

onlyuser/dexvt-lite

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

3D Inverse Kinematics with Constraints and... GPU Ray Tracing!

Copyright (C) 2011-2017 mailto:onlyuser@gmail.com

About

dexvt-lite is a 3D inverse kinematics and GPU ray tracing tech demonstrator. It features rovolute joint constraints, prismatic joint constraints, end-effector orientation constraints, and... GPU ray tracing!

See sister project demonstrating other engine features: dexvt-test

Algorithm

3D Inverse Kinematics

Supports rovolute joint constraints, prismatic joint constraints, and end-effector orientation constraints. The way each constraint type is handled is described below:

  • Revolute Joint Constraints

    • "Non-hinge" joints
      1. In each joint's rotation step, rotate on a pivot that aligns the end-effector with the target.
      2. Enforce joint constraints in euler space by capping the post-rotation orientation of the adjacent segment to be within the joint's maximal deviation from neutral orientation. Do this for each axis.
    • "Hinge" joints
      1. In each joint's rotation step, rotate on a pivot that minimizes the distance between the end-effector and the target, all the while staying within the joint's plane of free rotation. Setting non-constraint-violating goals early on avoids most problems described here.
      2. Enforce joint constraints perpendicular to the joint's pivot by squeezing the post-rotation orientation of the adjacent segment to be within the joint's plane of free rotation. This adds numerical stability to the pivot so it doesn't "drift".
      3. Enforce joint constraints within the joint's plane of free rotation by capping the post-rotation orientation of the adjacent segment to be within the joint's maximal deviation from neutral orientation.
  • Prismatic Joint Constraints

    • In each joint's translation step, slide the adjacent segment by the maximal extent it can slide within the joint's range of free translation to align the end-effector with the target.
  • End-effector Orientation Constraints

    • In each joint's rotation/translation step, extend the end-effector position by the end-effector orientation offset.

GPU Ray Tracing

  • Supports 4 material types:

    • Reflective
    • Transparent
    • Diffuse
    • Glowing
  • Supports 3 primitive types:

    • Spheres
    • Planes
    • Boxes

Screenshots

Screenshot Screenshot Screenshot Screenshot Screenshot Screenshot Screenshot Screenshot Screenshot Screenshot Screenshot Screenshot Screenshot Screenshot Screenshot Screenshot Screenshot Screenshot Screenshot

Requirements

Unix tools and 3rd party components (accessible from $PATH):

gcc mesa-common-dev freeglut3-dev libglew-dev libglm-dev libpng-dev curl imagemagick

Resource files not included:

resource files purpose
data/SaintPetersSquare2/posx.png
data/SaintPetersSquare2/negx.png
data/SaintPetersSquare2/posy.png
data/SaintPetersSquare2/negy.png
data/SaintPetersSquare2/posz.png
data/SaintPetersSquare2/negz.png
Cube map texture (6 faces)
data/chesterfield_color.png Color map texture
data/chesterfield_normal.png Normal map texture

Make Targets

target action
all make binaries
test all + run tests
clean remove all intermediate files
lint perform cppcheck
docs make doxygen documentation
resources download resource files
clean_lint remove cppcheck results
clean_docs remove doxygen documentation
clean_resources remove resource files

Controls

Keyboard:

key purpose
b toggle bounding-box
f toggle frame rate
g toggle guide wires
h toggle HUD
l toggle lights
n toggle normals
p toggle ortho-projection
t toggle texture
w toggle wireframe
x toggle axis
z toggle labels
up/down pitch
left/right yaw
pg-up/pg-dn roll
home toggle target
space toggle animation
esc exit

Mouse:

mouse-button + drag purpose
left orbit
right zoom

References

"Setting up an OpenGL development environment in Ubuntu Linux"
http://www.codeproject.com/Articles/182109/Setting-up-an-OpenGL-development-environment-in-Ub
"OpenGL Programming"
http://en.wikibooks.org/wiki/OpenGL_Programming
"Tutorial - Getting Started with the OpenGL Shading Language (GLSL)"
http://joshbeam.com/articles/getting_started_with_glsl/
"Cube Maps: Sky Boxes and Environment Mapping"
http://antongerdelan.net/opengl/cubemaps.html
"3D C/C++ tutorials - OpenGL - GLSL cube mapping"
http://www.belanecbn.sk/3dtutorials/index.php?id=24
"Skyboxes using glsl Version 330"
http://gamedev.stackexchange.com/questions/60313/skyboxes-using-glsl-version-330
"Rioki's Corner - GLSL Skybox"
http://www.rioki.org/2013/03/07/glsl-skybox.html
"How would you implement chromatic aberration?"
http://gamedev.stackexchange.com/questions/58408/how-would-you-implement-chromatic-aberration
"How do you calculate the angle between two normals in glsl?"
http://stackoverflow.com/questions/338762/how-do-you-calculate-the-angle-between-two-normals-in-glsl
"Chapter 7. Environment Mapping Techniques"
http://http.developer.nvidia.com/CgTutorial/cg_tutorial_chapter07.html
"Humus Cube Map Textures - Colosseum"
http://www.humus.name/index.php?page=Textures
"Kay's Blog Texture and game development freebies! - Well Preserved Chesterfield"
http://kay-vriend.blogspot.tw/2012/11/well-preserved-chesterfield.html
"Philip Rideout's OpenGL Bloom Tutorial"
http://prideout.net/archive/bloom/
"An investigation of fast real-time GPU-based image blur algorithms"
https://software.intel.com/en-us/blogs/2014/07/15/an-investigation-of-fast-real-time-gpu-based-image-blur-algorithms
"mattdesl/lwjgl-basics - ShaderLesson5"
https://github.com/mattdesl/lwjgl-basics/wiki/ShaderLesson5
"Jam3/glsl-fast-gaussian-blur - glsl-fast-gaussian-blur"
https://github.com/Jam3/glsl-fast-gaussian-blur
"john-chapman-graphics SSAO Tutorial"
http://john-chapman-graphics.blogspot.tw/2013/01/ssao-tutorial.html
"Know your SSAO artifacts"
http://mtnphil.wordpress.com/2013/06/26/know-your-ssao-artifacts/
"songho.ca OpenGL Projection Matrix"
http://www.songho.ca/opengl/gl_projectionmatrix.html
"3D MeshWorks"
http://www.jrbassett.com
"Missing gtc/constants.hpp #12"
g-truc/glm#12
"Kinematics (Advanced Methods in Computer Graphics) Part 4"
http://what-when-how.com/advanced-methods-in-computer-graphics/kinematics-advanced-methods-in-computer-graphics-part-4/
"alfanick's inverse-kinematics repo (ccd.cpp)"
https://github.com/alfanick/inverse-kinematics/blob/master/ccd.cpp
"Best Inverse kinematics algorithm with constraints on joint angles"
https://stackoverflow.com/questions/21373012/best-inverse-kinematics-algorithm-with-constraints-on-joint-angles
"Real-Time 3d Robotics UI (Python)"
https://coreykruger.wordpress.com/programming-and-scripting/462-2/
"Anand's blog - GPGPU In Android: Load a texture with floats and read it back"
http://www.anandmuralidhar.com/blog/tag/gpgpu/
"Ray-Plane and Ray-Disk Intersection"
https://www.scratchapixel.com/lessons/3d-basic-rendering/minimal-ray-tracer-rendering-simple-shapes/ray-plane-and-ray-disk-intersection
"Ray-Sphere Intersection"
https://www.scratchapixel.com/lessons/3d-basic-rendering/minimal-ray-tracer-rendering-simple-shapes/ray-sphere-intersection

Keywords

3D inverse kinematics (cyclic coordinate descent), forward kinematics, rovolute joint constraints, prismatic joint constraints, end-effector orientation constraints, GPU ray tracing