Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Fixta

Pages: [1]
1
Support / Re: Blitting in VR display happens on left eye only
« on: November 18, 2016, 03:57:32 pm »
@AeroShark

Reticles are perfectly aligned now that I take the half of the texture size as parameter for positioning.
How surprising ! :-)
Thanks for pointing that out in your reply!

About the not centered issue, you probably need to correct your placement with (the destination height)/2 and the same for the width I'd say.
So: fb.getWidth()/2-destinationWidth/2
(not sure whether you need to subtract or add, I guess you'll find out if you try it)
destinationWidth being the amount of pixels your blit will take in width.

fb.blit(reticleTex, 0, 0, fb.getWidth()/2+290, fb.getHeight()/2, 256, 256 ,64, 64, 2, false);
Why are your arguments "64, 64" here? And "128, 128" in the other?:
And why "+290", it might look okay on your phone but I doubt placement would look good on phones with other screen resolutions! :p

2
Support / Re: Blitting in VR display happens on left eye only
« on: November 18, 2016, 11:40:14 am »
Hi!
First of all, thank you so much for your time replying the post.

You surely don't remember this because it's dug out from a 2011 post, but what confuses you is a hint that you gave to monkokoi :-) :
___
[...] You might want to play around with http://www.jpct.net/jpct-ae/doc/com/threed/jpct/Config.html#viewportOffsetX, but i'm not sure if this will work properly on all devices. « Last Edit: August 23, 2011, 08:31:09 am by EgonOlsen »
___

Then I followed what monkokoi did:
// ... when it comes time to render ...

cam.setPosition( LEFT_EYE_POSITION );
cam.lookAt( TARGET_POSITION );
com.threed.jpct.Config.viewportOffsetX = 0.0f;
world.renderScene(fb);
world.draw(fb);

cam.setPosition(RIGHT_EYE_POSITION );
cam.lookAt( TARGET_POSITION );
com.threed.jpct.Config.viewportOffsetX = 1.0f;
world.renderScene(fb);
world.draw(fb);

fb.display();
« Reply #9 on: August 23, 2011, 07:50:37 am »
___

But, rendering in two textures as you suggest is definitely a straightforward, very clean solution. Your code is by the way cristal clear. I'll go on with that solution. I might also put this in a Helper class as you suggested to Monokoi if you still find this useful for the wiki.

Again, thank you for your support.
The more I read about your engine, the more I like it because it doesn't constraint you in a specific way of using it and has all the necessary to build quite complex apps. Plus the fact that you keep full control on GLSL shading...
Congrats!

3
Support / Re: Blitting in VR display happens on left eye only
« on: November 17, 2016, 06:48:08 pm »
Hi AeroShark!
Thank you for your reply.

About the centered question, you might be right. I presumed the default coordinate was at the center of the texture but it sounds stupid now when I write this :-) I will try this and let you know.

About the +290, as I wrote in my previous post: "The little reticle cut in half by the limit of the framebuffer is a test [...]"
The values 256, 256, 64, 64 are a guess work: my texture is 128x128 but it seems that Android rescaled it by a factor of 2 so I played with the values to get something right. I'll definitely change this when I will have solved the real issue of having the reticle correctly displayed on the right half of the screen.

Thanks again!

4
Support / Re: Blitting in VR display happens on left eye only
« on: November 17, 2016, 08:47:42 am »
Here is a picture.
My question is: how can I have a second reticle on the right half of the screen. Same buffer, with a blit of a texture, rendered twice. But It only appears on the left half of the screen. The little reticle cut in half by the limit of the framebuffer is a test to check that the second blitting happend on the first (left) framebuffer and correspond to the line of code:
fb.blit(reticleTex, 0, 0, fb.getWidth()/2+290, fb.getHeight()/2, 256, 256 ,64, 64, 2, false);

I hope it's clearer now...
I know I'm missing something with the use of the framebuffer in this particular case (two renderings with a viewport offset).
Thank you!


5
Support / Blitting in VR display happens on left eye only
« on: November 16, 2016, 08:16:29 pm »
Howdy!
In the frame of a VR app, I split the screen in two halves. Each half renders the scene with a different camera position. I set the Config.viewportOffsetX to 0.0f for the left eye and 1.0f for the right eye.
Everything is working like a charm.
I tried to add a reticle in the center of each half screen by blitting a texture but it appears only on the left part of the screen. I understand that it is the same framebuffer that is rendered twice, but I can't figure out a way to do this (I assume I would have the same issue using an Overlay).
My code in onDrawFrame is:
[...]

        //LEFT EYE
        scn.update();
        fb.clear(back);
        //The 2 following rotations of the camera
        //are needed to set the JPCT camera as it is in Blender.
        cam.rotateAxis(cam.getXAxis(), (float) Math.PI/2);
        cam.rotateAxis(cam.getYAxis(), (float) Math.PI/2);

        //Position left eye
        cam.setPosition(new SimpleVector(0.0f+eyeDistance, 0.0f, 1.3f));
        //Rendering in the left viewport
        com.threed.jpct.Config.viewportOffsetX = 0.0f;
        world.renderScene(fb);
        world.draw(fb);
        //Left reticle
        fb.blit(reticleTex, 0, 0, fb.getWidth()/2, fb.getHeight()/2, 256, 256 ,128, 128, 2, false);

        //RIGHT EYE
        cam.setPosition(new SimpleVector(0.0f-eyeDistance, 0.0f, 1.3f));
        com.threed.jpct.Config.viewportOffsetX = 1.0f;
        world.renderScene(fb);
        world.draw(fb);
        // /!\
        // Right reticle
        // This one appears cut in half by the limit of the (left drawn) framebuffer
        fb.blit(reticleTex, 0, 0, fb.getWidth()/2+290, fb.getHeight()/2, 256, 256 ,64, 64, 2, false);
        fb.display();

Does someone could give me any advice on how to do this ? This would make my night :)

And also, I noticed that the reticle is not well centered. It's a bit off-centered and it surprised me since I used the width and height of the framebuffer divided by two. I saw a deprecated method, getOutputWidth/Height, so maybe for some reasons getWidth/Height might not return the right values. Someone knows where I could have some details about this please ? Thank you!
 
Fixta.

6
Thank you so much for your quick answer!
I can't believe I spent hours on this one :)
I was doing a
camera.rotateZAxis(new simpleVector(0.0f, 0.0f, 1.0f), Math.PI/2) instead of
camera.rotateAxis(camera.getZAxis(), Math.PI/2)!

This is why the rotations were not good anymore after rotating the axis.

Everything is fine now, thanks a lot!
Bravo and thank you for JPCT-Blend :)

7
Hi Guys!

First things first, thank you for JPCT-Blend which I find very handful, and this forum.
In the frame of a master thesis, I'm currently working on a VR prototype.
For now, everything works fine and the way I want it to, except that the sample scene appears like it has been
rotated -90° on the Y axis in the Blender coordinates system.
I tried to remap the Sensor coordinate system to no avail.

I also tried the solution given by Paulo in this forum without success.
One solution I see would be to multiply the JPCT-View Matrix by the proper rotation matrix (i.e, +90° on the Z axis if I'm correct).
My question is: How could I do that in a clean way ?

Thanks for your help!
François-Xavier.

PS: I'm using this excellent work from Alexander Pacha to get the sensors fusion of the android device. It works incredibly well for VR:
https://bitbucket.org/apacha/sensor-fusion-demo




Pages: [1]