如何调整每个眼睛的纹理rajawali vr(Cardboard android sdk)?我的360张照片在两只眼睛中有所不同

时间:2016-03-23 06:27:46

标签: android google-cardboard rajawali rajawalivr

如何调整每个眼睛视图的纹理rajawali vr(Cardboard android sdk)?

我的360照片显示两只眼睛不同,左眼和右眼有视觉差异。如您所见,左侧图像与右侧图像略有不同。如果您在Google Cardboard中看到它,这将成为一个非常大的问题。如何解决?

enter image description here

我使用的rajawalirajawali vr版本为commit c53cd57 on master branch

这是VR Activity

public class CcPhotoViewActivity extends VRActivity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setRenderer(new VRRenderer(this) {
            @Override
            protected void initScene() {
                // R.drawable.loading_bg is a standard 360 photo
                Sphere sphere = createPhotoSphereWithTexture(new Texture("photo", R.drawable.loading_bg));

                boolean result = getCurrentScene().addChild(sphere);

                getCurrentCamera().setPosition(Vector3.ZERO);
                getCurrentCamera().setFieldOfView(100);
            }

            @Override
            public void onOffsetsChanged(float xOffset, float yOffset, float xOffsetStep, float yOffsetStep, int xPixelOffset, int yPixelOffset) {

            }

            @Override
            public void onTouchEvent(MotionEvent event) {

            }
        });
    }

    private static Sphere createPhotoSphereWithTexture(ATexture texture) {
        Material material = new Material();
        material.setColor(0);
        try {
            material.addTexture(texture);
        } catch (ATexture.TextureException e) {
            e.printStackTrace();
            throw new RuntimeException(e);
        }

        Sphere sphere = new Sphere(50, 32, 16);
        sphere.setScaleX(-1);
        sphere.setMaterial(material);

        return sphere;
    }

}

提前致谢。

1 个答案:

答案 0 :(得分:0)

如果你把单个相机放在非vr的原点(x = 0,y = 0,z = 0)然后启用vr纸板视图你应该为右眼和左眼放两个相机尺寸(0.3,0,0) )和(-0.3,0,0)分别