https://wiki.povray.org/api.php?action=feedcontributions&user=Clodo&feedformat=atomPOV-Wiki - User contributions [en]2024-03-28T12:37:51ZUser contributionsMediaWiki 1.35.1https://wiki.povray.org/content?title=HowTo:ODS&diff=8510HowTo:ODS2016-05-17T20:55:50Z<p>Clodo: Created page with "Omnidirectional stereo (ODS) is a projection model for stereo 360 degree videos. It’s designed for VR viewing with a headmounted display (HMD). More information [https:/..."</p>
<hr />
<div>Omnidirectional stereo (ODS) is a projection model for stereo 360 degree videos.<br />
It’s designed for VR viewing with a headmounted display (HMD).<br />
More information [https://developers.google.com/cardboard/jump/rendering-ods-content.pdf in this Google PDF].<br />
<br />
=How to render=<br />
Currently (2016-03-11), render ODS image require an alpha version of POV-Ray, that support user_defined camera. Download from [https://github.com/POV-Ray/povray/releases/tag/v3.7.1-alpha.8509766%2Bav119 here]<br />
<br />
Use the following code for an ODS top-bottom (left eye on top, right eye on bottom):<br />
<source lang="pov"><br />
// ODS Top/Bottom<br />
#declare odsIPD = 0.065; // Interpupillary distance<br />
#declare odsVerticalModulation = 0.2; // Use 0.0001 if you don't care about Zenith & Nadir zones.<br />
#declare odsLocationX = 0;<br />
#declare odsLocationY = 0;<br />
#declare odsLocationZ = 0;<br />
#declare odsHandedness = -1; // "-1" for left-handed or "1" for right-handed<br />
#declare odsAngle = 0; // Rotation, clockwise, in degree. <br />
<br />
camera {<br />
user_defined<br />
location {<br />
function { odsLocationX + cos(((x+0.5+odsAngle/360)) * 2 * pi - pi)*(odsIPD/2*pow(sin(select(y, 1-2*(y+0.5), 1-2*y)*pi), odsVerticalModulation))*select(-y,-1,+1) }<br />
function { odsLocationY }<br />
function { odsLocationZ + sin(((x+0.5+odsAngle/360)) * 2 * pi - pi)*(odsIPD/2*pow(sin(select(y, 1-2*(y+0.5), 1-2*y)*pi), odsVerticalModulation))*select(-y,-1,+1) * odsHandedness }<br />
}<br />
direction {<br />
function { sin(((x+0.5+odsAngle/360)) * 2 * pi - pi) * cos(pi / 2 -select(y, 1-2*(y+0.5), 1-2*y) * pi) }<br />
function { sin(pi / 2 - select(y, 1-2*(y+0.5), 1-2*y) * pi) }<br />
function { -cos(((x+0.5+odsAngle/360)) * 2 * pi - pi) * cos(pi / 2 -select(y, 1-2*(y+0.5), 1-2*y) * pi) * odsHandedness }<br />
}<br />
}<br />
</source><br />
Use the following code for an ODS side-by-side:<br />
<source lang="pov"><br />
// ODS Side-by-Side<br />
#declare odsIPD = 0.065; // Interpupillary distance<br />
#declare odsVerticalModulation = 0.2; // Use 0.0001 if you don't care about Zenith & Nadir zones.<br />
#declare odsLocationX = 0;<br />
#declare odsLocationY = 0;<br />
#declare odsLocationZ = 0;<br />
#declare odsHandedness = -1; // "-1" for left-handed or "1" for right-handed<br />
#declare odsAngle = 0; // Rotation, clockwise, in degree. <br />
<br />
camera {<br />
user_defined<br />
location {<br />
function { odsLocationX + cos(((select(x,2*(x+0.5),2*x)+odsAngle/360)) * 2 * pi - pi)*(odsIPD/2*pow(sin((1-(y+0.5))*pi), odsVerticalModulation))*select(x,-1,1) }<br />
function { odsLocationY }<br />
function { odsLocationZ + sin(((select(x,2*(x+0.5),2*x)+odsAngle/360)) * 2 * pi - pi)*(odsIPD/2*pow(sin((1-(y+0.5))*pi), odsVerticalModulation))*select(x,-1,1) * odsHandedness }<br />
}<br />
direction {<br />
function { sin(((select(x,2*(x+0.5),2*x)+odsAngle/360)) * 2 * pi - pi) * cos(pi / 2 -(1-(y+0.5)) * pi) }<br />
function { sin(pi / 2 - (1-(y+0.5)) * pi) }<br />
function { -cos(((select(x,2*(x+0.5),2*x)+odsAngle/360)) * 2 * pi - pi) * cos(pi / 2 -(1-(y+0.5)) * pi) * odsHandedness }<br />
}<br />
} <br />
</source><br />
<br />
<source lang="pov"><br />
// ODS Single Eye<br />
#declare odsIPD = 0.065; // Interpupillary distance <br />
#declare odsVerticalModulation = 0.2; // Use 0.0001 if you don't care about Zenith & Nadir zones.<br />
#declare odsLocationX = 0;<br />
#declare odsLocationY = 0;<br />
#declare odsLocationZ = 0;<br />
#declare odsHandedness = -1; // "-1" for left-handed or "1" for right-handed<br />
#declare odsAngle = 0; // Rotation, clockwise, in degree. <br />
#declare odsEye = -1; // -1 for Left eye, +1 for Right eye<br />
<br />
camera {<br />
user_defined<br />
location {<br />
function { odsLocationX + cos(((x+0.5+odsAngle/360)) * 2 * pi - pi)*(odsIPD/2*pow(sin((1-(y+0.5))*pi), odsVerticalModulation))*odsEye }<br />
function { odsLocationY }<br />
function { odsLocationZ + sin(((x+0.5+odsAngle/360)) * 2 * pi - pi)*(odsIPD/2*pow(sin((1-(y+0.5))*pi), odsVerticalModulation))*odsEye * odsHandedness }<br />
}<br />
direction {<br />
function { sin(((x+0.5+odsAngle/360)) * 2 * pi - pi) * cos(pi / 2 -(1-(y+0.5)) * pi) }<br />
function { sin(pi / 2 - (1-(y+0.5)) * pi) }<br />
function { -cos(((x+0.5+odsAngle/360)) * 2 * pi - pi) * cos(pi / 2 -(1-(y+0.5)) * pi) * odsHandedness }<br />
}<br />
} <br />
</source><br />
<br />
=Caveats=<br />
* Camera Direction is actually not supported. It’s always look_at<0,0,1>. You can use the odsAngle parameter for a rotation (degree) around Y axis.<br />
* Zenith & Nadir Zones<br />
Base ODS algorithm have spiral/singularities towards the zenith and nadir points.To avoid that, i modulate the stereoscopic eye separation such that it begins at normal eye separation near the horizon, and is smoothly decreased, reaching zero by the time either the zenith or nadir points on the polar axis are visible to the user, producing a monoscopic image.<br />
I use this [https://www.wolframalpha.com/input/?i=0.065*pow(sin((x%2B0.5)*pi),0.02)+range+-0.5..0.5 formula]:<br />
<br />
[[File:pov_ods.png|ODS Vertical Modulation]]<br />
<br />
where 0.02 it’s the '''odsVerticalModulation''' and 0.065 the default '''IPD'''. Play with this value to understand how IPD are reduced near the Zenith (x:-0.5) and Nadir (x:0.5).<br />
<br />
In general, it’s recommended to avoid objects at zenith & nadir points, and use a odsVerticalModulation near 0 (0.0001), to obtain a perfect IPD / 3d effect.<br />
If you have objects at zenith & nadir points, use a odsVerticalModulation near 1 can be a good compromise.<br />
<br />
<br />
Other approach:<br />
Domemaster3D (Shader for 3DS Max, Maya, Softimage etc) recommend a texture to reduce the effect. [http://www.andrewhazelden.com/blog/2014/10/render-spherical-stereo-content-with-the-domemaster3d-v1-6-alpha/ link]<br />
<br />
SolidAngle/Arnold use mixed approach. [http://pedrofe.com/oculus-camera/ link]<br />
<br />
Another kind of modulation: [https://www-s.ks.uiuc.edu/Publications/Papers/paper.cgi?tbcode=STON2016A link]<br />
<br />
=Best practice=<br />
* Objects should remain at least 60cm from the camera (relative to an IPD of 6.5cm).<br />
Use this code to check (it’s auto adapt based on IPD):<br />
<source lang="pov"><br />
sphere<br />
{<br />
<odsLocationX,odsLocationY,odsLocationZ>, 0.6*odsIPD/0.065<br />
pigment<br />
{<br />
color <1,0,0><br />
filter 0.97<br />
}<br />
hollow<br />
}<br />
</source><br />
* Objects appearing directly above or below the camera should remain at least 3.5m from the camera (relative to an IPD of 6.5cm).<br />
* Antialiasing is very very very important on VR headset.<br />
<br />
=Recommended Resolutions=<br />
<br />
I recommend, at least for the current (year 2016) generation of VR headset (GearVR, Oculus Rift, HTC Vive), at least 6480 x 6480 pixels in top/bottom for static images. For videos, see below.<br />
<br />
Resolution must have 2:1 aspect ratio (standard equirectangular/latlong), that become 4:1 for side-by-side or 1:1 for a top-bottom.<br />
<br />
It’s difficult to estimate a good resolution.<br />
VR headset do a distortion for lenses, any every VR headset can have different lenses, different FOV, different panel resolution etc.<br />
<br />
The GearVR for example has a 90° FOV on a 2560×1440 panel, but the center pixel covers 0.06° after distortion. This value is sometime called “pixel coverage” or “pixel density” or “pixel per display pixel” or “eye buffer scaling”. So, for the GearVR, 0.06° pixels means we need 360/0.06 = 6000 pixels to cover one monoscopic turn.<br />
<br />
=Rendering Animation/Video=<br />
<br />
This is actually problematic.<br />
<br />
In theory, the resolution must be at least as explained above for images.<br />
<br />
Any VR headset works with high frame-rate:<br />
<br />
Oculus Rift DK2 (Development Kit 2): 75 FPS<br />
Oculus Rift CV1 (Customers Version 1): 90 FPS<br />
HTC Vive: 90 FPS<br />
Sony Playstation PSVR : 120 FPS<br />
In general, future-generation VR headset: expected 120 FPS<br />
<br />
But [https://en.wikipedia.org/wiki/H.264/MPEG-4_AVC#Levels H264] don’t have any level profile compatible with this kind of resolution.<br />
Also [https://en.wikipedia.org/wiki/High_Efficiency_Video_Coding#Tiers_and_levels HEVC/H265] have the same problem.<br />
<br />
But we also need a coded that is hardware-accelerated to obtain the high FPS requested, and generally only H264/H265 are optimized for this.<br />
<br />
Anyway, if you build a video at 30 FPS, for example if played in a 90 FPS HMD it don't cause nausea (because the head-tracking still works at 90 FPS).<br />
<br />
=Interesting Links=<br />
<br />
[http://news.povray.org/povray.general/thread/%3Cweb.56d38071f91c97bb4e8811590%40news.povray.org%3E/ POV-Ray newsgroup, topic about the approach]<br />
<br />
[http://news.povray.org/povray.text.scene-files/thread/%3Cweb.56e05da626a7967a4e8811590%40news.povray.org%3E/ POV-Ray newsgroup, topic about contents]<br />
<br />
[https://forums.oculus.com/community/discussion/30854/ Oculus Forum Topic]<br />
<br />
[https://community.renderman.pixar.com/article/991/rendering-for-vr.html Renderman/Pixar approach]<br />
<br />
[http://bernieroehl.com/prerendered_spherical_stereoscopic_panoramas/ Bernie Roehl POV-Ray approach]<br />
<br />
[https://code.blender.org/2015/03/1451/ Blender approach]<br />
<br />
[https://scottsingercg.wordpress.com/2015/11/24/spherical-stereo-camera-for-emersive-rendering/ Scott Singer approach]<br />
<br />
<br />
=QUICKRES.INI=<br />
<br />
Reference resolutions for POV-Ray quickres.ini<br />
<source lang="pov"><br />
[ODS TB Quick Test - 512 x 512]<br />
Width=512<br />
Height=512<br />
Antialias=Off<br />
<br />
[ODS TB Test - 1024 x 1024]<br />
Width=1024<br />
Height=1024<br />
Antialias=Off<br />
<br />
[ODS TB Minimum - 3600 x 3600]<br />
Width=3600<br />
Height=3600<br />
Antialias=On<br />
Antialias_Threshold=0.3<br />
<br />
[ODS TB High - 6480 x 6480]<br />
Width=6480<br />
Height=6480<br />
Antialias=On<br />
Antialias_Threshold=0.3<br />
<br />
[ODS TB Ultra - 12288 x 12288]<br />
Width=12288<br />
Height=12288<br />
Antialias=On<br />
Antialias_Threshold=0.3<br />
<br />
[ODS TB 1440p - 2560 x 1440]<br />
Width=2560<br />
Height=1440<br />
Antialias=On<br />
Antialias_Threshold=0.3<br />
<br />
[ODS TB UHD-1 2160p - 3840 x 2160]<br />
Width=3840<br />
Height=2160<br />
Antialias=On<br />
Antialias_Threshold=0.3<br />
<br />
[ODS TB DCI 4K - 4096 x 2160]<br />
Width=4096<br />
Height=2160<br />
Antialias=On<br />
Antialias_Threshold=0.3<br />
<br />
[ODS TB 8K UHD - 7680 x 4320]<br />
Width=7680<br />
Height=4320<br />
Antialias=On<br />
Antialias_Threshold=0.3<br />
<br />
[ODS LR Minimum - 7200 x 1800]<br />
Width=7200<br />
Height=1800<br />
Antialias=On<br />
Antialias_Threshold=0.3<br />
<br />
[ODS LR High - 12960 x 3240]<br />
Width=12960<br />
Height=3240<br />
Antialias=On<br />
Antialias_Threshold=0.3<br />
<br />
[ODS LR Ultra - 24576 x 6144]<br />
Width=24576<br />
Height=6144<br />
Antialias=On<br />
Antialias_Threshold=0.3<br />
[ODS LR Low - 7200 x 1800]<br />
Width=7200<br />
Height=1800<br />
Antialias=On<br />
Antialias_Threshold=0.3<br />
<br />
[ODS LR Normal - 12960 x 3240]<br />
Width=12960<br />
Height=3240<br />
Antialias=On<br />
Antialias_Threshold=0.3<br />
<br />
[ODS LR High - 24576 x 6144]<br />
Width=24576<br />
Height=6144<br />
Antialias=On<br />
Antialias_Threshold=0.3<br />
<br />
[ODS TB Low - 3600 x 3600]<br />
Width=3600<br />
Height=3600<br />
Antialias=On<br />
Antialias_Threshold=0.3<br />
<br />
[ODS TB Normal - 6480 x 6480]<br />
Width=6480<br />
Height=6480<br />
Antialias=On<br />
Antialias_Threshold=0.3<br />
<br />
[ODS TB High - 12288 x 12288]<br />
Width=12288<br />
Height=12288<br />
Antialias=On<br />
Antialias_Threshold=0.3<br />
<br />
[ODS TB YouTube - 3840 x 2160]<br />
Width=3840<br />
Height=2160<br />
Antialias=On<br />
Antialias_Threshold=0.3<br />
</source></div>Clodohttps://wiki.povray.org/content?title=File:pov_ods.png&diff=8509File:pov ods.png2016-05-17T20:37:42Z<p>Clodo: </p>
<hr />
<div></div>Clodo