Hi,
Has anyone attempted to achieve a VR viewer for Google Carboard etc?
I’ve got the split screen working using Stage3dProxy and that part is fine.
For many VR viewers, applications distort and filter the view for different headsets and devices. I’m wondering the best way to go about this in Away3d, or if there are any other examples of this beind done elsewhere.
The kind of effect I’m trying to achieve
http://d8d913s460fub.cloudfront.net/krpanocloud/webvr/index.html?v=119pr1
And there’s some information here
http://krpano.com/forum/wbb/index.php?page=Thread&threadID=12081
Basically I’d like to be able to adjust the effect for various devices.
I tried previously using Filters on the view, but ran into problems where applying the filter filled the screen, and I couldn’t find a way to make the filter work only on one view, without stage3D filling the rest of the screen with a white background because stage3D has to render to the whole screen.
Here’s some ideas for that problem
http://away3d.com/forum/viewthread/5794/
I also looked into how this ANE https://github.com/jonathanhart/oculus-ane works, and again had a similar issue where I couldn’t ge the filter to apply to only one view and not fill the screen.
The stage3d is inialised and opens the new view like this
private function initializeStage3d():void
{
Log.record("Pano.initializeStage3d()");
// 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.antiAlias = antiAlias;
stage3DProxy.width = stage.stageWidth;
stage3DProxy.height = stage.stageHeight;
stage3DProxy.viewPort.width = stage.stageWidth;
stage3DProxy.viewPort.height = stage.stageHeight;
view.width = stage.stageWidth/2;
view.shareContext = true;
view.disableMouse = true;
}
public function loadVR():void
{
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
stage3DProxy.addEventListener(Event.ENTER_FRAME, onEnterFrame);
dispatchEvent(new Event(VR_MODE_ON));
initializeVR();
}
private function initializeVR():void
{
Log.record('Pano.initialize()');
initialized = true;
rightEye = new View3D();
rightEye.height = stage.stageHeight;
rightEye.x = stage.stageWidth/2;
rightEye.y = 0;
rightEye.backgroundAlpha = 0;
rightEye.stage3DProxy = stage3DProxy;
rightEye.shareContext = true;
rightEye.camera = rightEyeCamera;
rightEye.camera.lens = new PerspectiveLens(100);
rightEye.camera.lens.far = cameraViewDistance;
rightEye.camera.lens.near = 100;
rightEye.scene = scene;
rightEye.width = stage.stageWidth/2;
addChild( rightEye );
rightEye.render();
}