X3D Objects to Oculus Rift

Click on the name of a file to get started - adjust the sliders to rotate/scale the object

SURF 2015 - Kyle Davis in collaboration with Sandy Ressler

attribute vec3 position; attribute vec2 texcoord; uniform mat4 modelViewProjectionMatrix; varying vec2 fragTexCoord; void main() { vec2 pos = sign(position.xy); fragTexCoord = texcoord; gl_Position = vec4((pos.x - 1.0) / 2.0, pos.y, 0.0, 1.0); //gl_Position = vec4(pos.xy / 4.0 + vec2(-0.75,0.75), 0.0, 1.0); } #ifdef GL_ES precision highp float; #endif uniform sampler2D tex; uniform float leftEye; varying vec2 fragTexCoord; void main() { float distortionScale = 0.7; //0.685; //float distortionK[4] = float[](1.0, 0.22, 0.24, 0.0); vec2 lensCenter = vec2(0.151976495726, 0.0); if (leftEye == 0.0) { lensCenter.x *= -1.0; } vec2 theta = (fragTexCoord * 2.0) - 1.0; float rSq = theta.x * theta.x + theta.y * theta.y; vec2 rvec = theta * (1.0 + 0.22 * rSq + 0.24 * rSq * rSq); //+ 0.0 * rSq * rSq * rSq); vec2 texCoord = (distortionScale*rvec+(1.0-distortionScale)*lensCenter + 1.0) / 2.0; if (any(notEqual(clamp(texCoord, vec2(0.0, 0.0), vec2(1.0, 1.0)) - texCoord, vec2(0.0, 0.0)))) { //if (leftEye == 0.0) gl_FragColor = vec4(1.0,1.0,0.0,1.0); //else gl_FragColor = vec4(1.0,0.0,0.0,1.0); discard; } else { vec3 col = texture2D(tex, texCoord).rgb; gl_FragColor = vec4(col, 1.0); } //gl_FragColor = texture2D(tex, fragTexCoord); } attribute vec3 position; attribute vec2 texcoord; uniform mat4 modelViewProjectionMatrix; varying vec2 fragTexCoord; void main() { vec2 pos = sign(position.xy); fragTexCoord = texcoord; gl_Position = vec4((pos.x + 1.0) / 2.0, pos.y, 0.0, 1.0); }

Change Shapes

Add a new object


Viewpoint Buttons

Sliders

Move slider slowly to locate objects if not visible

Upload File

Leap Motion

Leap Motion: Rotating X-axis