Forum Discussion
Zylann
11 years agoHonored Guest
[Solved] Distortion doesn't seems right
Hello!
Still learning Oculus integration, and I nearly managed to get all the Oculus features I need to work with my project.
However I noticed that when I enable the distortion shader, stereoscopy just doesn't works. It's even better when I don't activate it Oo
I have a custom C++ code base.
Without distortion, my final rendering looks like this:
http://zylannprods.fr/dl/oculusdev/oculus_1.png
With client rendered distortion, I get this:
http://zylannprods.fr/dl/oculusdev/oculus_2.png
In the scene, the player is basically a 3D object with two child cameras at relative positions (-0.1,0,0) and (0.1,0,0). Each camera renders an eye on the final viewport.
But when distortion is ON, It's like the look directions are crossing and VR doesn't works :s It also seems there is a significant magnifying effect...
Any idea what can cause this issue?
Still learning Oculus integration, and I nearly managed to get all the Oculus features I need to work with my project.
However I noticed that when I enable the distortion shader, stereoscopy just doesn't works. It's even better when I don't activate it Oo
I have a custom C++ code base.
Without distortion, my final rendering looks like this:
http://zylannprods.fr/dl/oculusdev/oculus_1.png
With client rendered distortion, I get this:
http://zylannprods.fr/dl/oculusdev/oculus_2.png
In the scene, the player is basically a 3D object with two child cameras at relative positions (-0.1,0,0) and (0.1,0,0). Each camera renders an eye on the final viewport.
But when distortion is ON, It's like the look directions are crossing and VR doesn't works :s It also seems there is a significant magnifying effect...
Any idea what can cause this issue?
13 Replies
- cyberealityGrand ChampionIt looks like you may be rendering the distortion twice, or your math is off somehow. The shape the strength of the distortion looks more than typical. Are you using SDK rendering or doing it custom?
- ZylannHonored GuestIt's custom rendering.
I checked positionning bypassing the distortion: rotated the head, moved in all directions, changed eyes distance back and forth, all seems fine. Until I enable the effect back... - MatlockHonored GuestIf your eye separation is zero, and distortion on, what does it look like.?
If it is a comfortable "mono" view, then your problem is with the eye separation, possibly backwards (swap l/r offset values).
If the view is still broken, then the problem is with the distortion render parameters - brantlewAdventurerA couple things I notice.
1. This looks like DK1 distortion. Are you using that device?
2. Either the eyes are reversed or your distortion center is off, because the right eye rendering shows the left green post closer. It should be the opposite.
Edit: Yeah when I look at the undistorted images, it looks like your center of distortion projection for each eye is not centered. They are distorting around points that are shifted toward the center (ie. on the left green post in the right eye side). It's true that this is where the lens centers physically intersect the DK1 panel, but that's not how distortion interacts with the the rendering projection plane. It should be centered. - ZylannHonored GuestI'm using a DK1.
If I centers both eyes on the same point:
Without distortion:
http://zylannprods.fr/dl/oculusdev/oculus_mono_nodist.png
With distortion:
http://zylannprods.fr/dl/oculusdev/oculus_mono_dist.png
The mono view is not good too.
How can I fix the center of distortion?
I'm using this code to set the UV uniforms (I'm using a GLSL version of the shaders):ovrSizei rtSize = { sourceSize.x(), sourceSize.y() };
ovrRecti camViewport = {
targetViewport.x(),
targetViewport.y(),
targetViewport.width(),
targetViewport.height()
};
ovrVector2f UVScaleOffset[2];
ovrHmd_GetRenderScaleAndOffset(eyeDesc.Fov, rtSize, camViewport, UVScaleOffset);
material->setParam("u_EyeToSourceUVScale", UVScaleOffset[0].x, UVScaleOffset[0].y);
material->setParam("u_EyeToSourceUVOffset", UVScaleOffset[1].x, UVScaleOffset[1].y);
The value of sourceSize is always (400,480) and targetViewport is (0,0,400,480) for eye 0 (left) and is (400,0,400,480) for the eye 1 (right).
But with this code, the right eye glitches because texture lookups are out of bounds. If I force a value of 0 for both viewports origins I get the previous screenshots where distortion is still wrong. So yeah, there is a wrong offset somewhere... but I don't know where :s - MatlockHonored GuestYou should keep eye separation zero until you fix the distortion.
Is this the roomtiny example? Are you trying to port that to opengl? - ZylannHonored GuestThis is my own Oculus integration, based on the docs (which in turn show examples of RoomTiny).
My engine uses OpenGL as primary renderer, so I ported the distortion shader to GLSL. - cyberealityGrand ChampionWhere are you getting the numbers 400 and 480 from? The DK1 screen is 1280x800.
So one eye viewport would be 640x800. - ZylannHonored GuestThese numbers are those from the screenshots I posted. They come from the default size of my window. To test with the Oculus I put it fullscreen on my second desktop (extended mode) which is displayed at 1280x800. It's basically a resize, the image is the same at higher/lower resolution, whatever scale I set.
- ZylannHonored GuestOk, I think I have a clue: the FOV.
I arbitrarily set angles of 90° on the two eyes, however it's a "classic" FOV, not a VR one.
I see the parameters are different for the projection matrix in RoomTiny, I will refactor a bit my code in order to feed this kind of FOV to my cameras instead, and see if it works.
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device