Forum Discussion
Slin
12 years agoExpert Protege
Calculating the distortion shader parameters
Today I wanted to implement Rift support into our game engine http://rayne3d.com/ and I am having some trouble with calculating the parameters needed for the distortion shader. The needed parameter...
Slin
12 years agoExpert Protege
I kinda fixed it now, so here is my updated list:
My result:
Bildschirmfoto 2013-08-08 um 15.32.40 (2).png
The fov seems to be a bit off, but other than that it looks and feels fine :)
vec2 LensCenter; //x+(w+projshift*0.5)*0.5, y+h*0.5
vec2 ScreenCenter; //left view: x+w*0.5, y+h*0.5
vec2 Scale; // w*0.5/factor, h*0.5*aspect/factor
vec2 ScaleIn; // 2/w, 2/h/aspect
vec4 HmdWarpParam; //HMDInfo.DistortionK
vec4 ChromAbParam; //HMDInfo.ChromaAbCorrection
x = 0 for left and 0.5 for right view (views x coordinate in 0-1)
y = 0 (views y coordinate in 0-1)
w = 0.5 (views width in 0-1)
h = 1.0 (views height in 0-1)
projshift = 0.15197 for left and -0.15197 for right view (1.0f-2.0f*HMDInfo.LensSeparationDistance/HMDInfo.HScreenSize)
aspect = 0.8 (w/h)
float lensradius = -1.0f-_projshift;
float lensradsq = lensradius*lensradius;
factor = hmdwarpparam.x+hmdwarpparam.y*lensradsq+hmdwarpparam.z*lensradsq*lensradsq+hmdwarpparam.w*lensradsq*lensradsq*lensradsq
My result:
Bildschirmfoto 2013-08-08 um 15.32.40 (2).png
The fov seems to be a bit off, but other than that it looks and feels fine :)
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 11 years ago
- 1 month ago
- 1 year ago