POV-Ray : Newsgroups : povray.general : Omni-directional Stereo Content : Re: Omni-directional Stereo Content Server Time
3 May 2024 07:18:02 EDT (-0400)
  Re: Omni-directional Stereo Content  
From: Clodo
Date: 8 Mar 2016 17:00:00
Message: <web.56df4a1d976329954e8811590@news.povray.org>
I write directly in POV-Ray sources the adaption of formulas based on ODS
document in the first post of this thread.
I added the simple code to directly render both eyes in single image.

      // Feature missing: original direction ignored (front)

   // Maybe params:
   DBL ipd = 0.065;
   int mode = 4; // 0: nostereo, 1: left, 2: right, 3: side-by-side, 4:
top/bottom

   // Convert the x coordinate to be a DBL from 0 to 1.
   x0 = x / width;

   // Convert the y coordinate to be a DBL from 0 to 1.
   y0 = y / height;

   int eye = 0;
   if (mode == 0)
   {
    eye = 0;
   }
   else if (mode == 1)
   {
    eye = -1;
   }
   else if (mode == 2)
   {
    eye = +1;
   }
   else if (mode == 3)
   {
    if (x0 < 0.5) // Left eye on Left
    {
     x0 *= 2;
     eye = -1;
    }
    else // Right eye on Right
    {
     x0 -= 0.5;
     x0 *= 2;
     eye = +1;
    }
   }
   else if (mode == 4)
   {
    if (y0 < 0.5) // Left eye on Top
    {
     y0 *= 2;
     eye = -1;
    }
    else // Right eye on Bottom
    {
     y0 -= 0.5;
     y0 *= 2;
     eye = +1;
    }
   }


   DBL pi = M_PI;

   DBL theta = x0 * 2 * pi - pi;
   DBL phi = pi / 2 - y0*pi;

   DBL scale = eye * ipd / 2;

   ray.Origin[0] = cameraLocation[0] + cos(theta) * scale;
   ray.Origin[1] = cameraLocation[1] + 0;
   ray.Origin[2] = cameraLocation[2] + sin(theta) * scale;

   ray.Direction[0] = sin(theta) * cos(phi);
   ray.Direction[1] = sin(phi);
   ray.Direction[2] = -cos(theta) * cos(phi);

   if (useFocalBlur)
    JitterCameraRay(ray, x, y, ray_number);

   InitRayContainerState(ray, true);


The Bill scene test rendered with IPD 0.065 and mode 4 (top/bottom) with the
above code:

http://www.clodo.it/host/images/0cfb243a2018ff0d3e668329da99756626c95594.png

The projection and the 3D effect seem correct on headset. Z axis is inverted,
doesn't matter, easy to fix.
The big issue it's the same issue that also have the "Bill P. mesh camera" and
"Paul Bourke povray 3.6 patch":
near the polar in Y axis, a spiral effect.

http://www.clodo.it/host/images/42c1548d0620db0c5e54324e6ad6cd23ee86f8fb.png

Tested with two of more popular image/video player for Oculus Headset: Virtual
Desktop & MaxVR . No differences.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.