I’m attempting to get Jonathan Harts excellent Oculus ANE working with a Google Cardboard setup, and running into some problems I’d like to see if anyone wants to help me with!?;-)
I’m attempting to modify the code here
https://github.com/jonathanhart/oculus-ane/blob/master/engineIntegrations/away3d/src/oculusANE/away3d/OculusView.as
Here is what’s happening below.
I’m currently stuck on the barrel filter. Applying the filter to the left view is fine, however applying the filter to the right eye covers the entire view (covering over the leftEye) with the background of the stage3Dview proxy.
Anyone seen this happen before?
// Define a new Stage3DManager for the Stage3D objects
stage3DManager = Stage3DManager.getInstance(stage);
// Create a new Stage3D proxy to contain the separate views
stage3DProxy = stage3DManager.getFreeStage3DProxy();
stage3DProxy.addEventListener(Stage3DEvent.CONTEXT3D_CREATED, onContextCreated);
stage3DProxy.addEventListener(Event.ENTER_FRAME, onEnterFrame);
stage3DProxy.antiAlias = 0;
stage3DProxy.color = 0x000000;
leftEye = new View3D();
leftEye.width = stage.stageWidth/2;
leftEye.height = stage.stageHeight;
leftEye.backgroundColor = 0xFF6600;
leftEye.stage3DProxy = stage3DProxy;
leftEye.shareContext = true;
addChild( leftEye );
rightEye = new View3D();
rightEye.width = stage.stageWidth*0.5;
rightEye.height = stage.stageHeight;
rightEye.x = stage.stageWidth*0.5;
rightEye.backgroundColor = 0xFF0000;
rightEye.stage3DProxy = stage3DProxy;
rightEye.shareContext = true;
addChild( rightEye );
leftEye.render();
rightEye.render();
// Setup camera
camera.lens.far = cameraViewDistance;
camera.lens.near = 100;
camera.z = 0;
rightEye.camera = new Camera3D();
rightEye.camera.lens = new VRLens(zoom,0.75,0.5);
//rightEye.camera.lens = new PerspectiveLens(zoom);
rightEye.camera.lens.far = cameraViewDistance;
rightEye.camera.lens.near = 100;
rightEye.z = 0;
cameraControllerR = new HoverController(rightEye.camera, null, pan, 0, 0.1);
leftEye.camera = new Camera3D();
leftEye.camera.lens = new VRLens(zoom,0.25,0.5);
//leftEye.camera.lens = new PerspectiveLens(zoom);
leftEye.camera.lens.far = cameraViewDistance;
leftEye.camera.lens.near = 100;
leftEye.z = 0;
cameraControllerL = new HoverController(leftEye.camera, null, pan, 0, 0.1);
rightEye.scene = scene;
leftEye.scene = scene;
//camera.stereoOffset = 5;
hmdInfo = new HmdInfo();
hmdInfo.hScreenSize = stage.stageWidth;
hmdInfo.vScreenSize = stage.stageHeight;
hmdInfo.vScreenCenter = 0.046799998730421066;
hmdInfo.eyeToScreenDistance = 0.04100000113248825;
hmdInfo.lensSeparationDistance = 0.06350000202655792;
hmdInfo.interPupillaryDistance = 0.06400000303983688;
hmdInfo.hResolution = 1280;
hmdInfo.vResolution = 800;
hmdInfo.distortionK = new Vector.<Number>;
hmdInfo.distortionK.push(1);
hmdInfo.distortionK.push(0.2199999988079071);
hmdInfo.distortionK.push(0.23999999463558197);
hmdInfo.distortionK.push(0);
hmdInfo.chromaAbCorrection = new Vector.<Number>;
hmdInfo.chromaAbCorrection.push(0.9959999918937683);
hmdInfo.chromaAbCorrection.push(-0.004000000189989805);
hmdInfo.chromaAbCorrection.push(1.0140000581741333);
hmdInfo.chromaAbCorrection.push(0);
var dk:Vector.<Number> = hmdInfo.distortionK;
barrelDistortionFilterLeft = new BarrelDistortionFilter3D(0.3, 0.5, 3, 0.5, dk[0], dk[1], dk[2], dk[3]);
leftEye.filters3d = [barrelDistortionFilterLeft];
barrelDistortionFilterRight = new BarrelDistortionFilter3D(0.7, 0.5, 3, 0.75, dk[0], dk[1], dk[2], dk[3]);
rightEye.filters3d = [barrelDistortionFilterRight];