Presentation is loading. Please wait.

Presentation is loading. Please wait.

Implementação de Stereo na Biblioteca VGL Marcos Machado.

Similar presentations


Presentation on theme: "Implementação de Stereo na Biblioteca VGL Marcos Machado."— Presentation transcript:

1 Implementação de Stereo na Biblioteca VGL Marcos Machado

2 Métodos de Stereo da Câmera do VGL // Set parallax min and max (in degrees) void SetParallax (float pmin, float pmax); // Set screen void SetPhysicalScreen (float w, float d); // Set zero parallax setting (from 0.0 to 1.0) void SetZeroParallax (float zps);

3 ComputeStereo do VGL: parâmetros Parâmetros: pmin pmax w d view volume d w xcxc ycyc zczc y' x' view frustum physical screen pmin pmax

4 Controle do paralaxe P/2 /2 d P/2 /2 tg ( /2 ) = P / 2d Desktop: d = 60 cm, max = 1,5 o P max 1,57 cm Sala RV: d = 3 m, max = 1,5 o P max 7,85 cm

5 ComputeStereo do VGL (1) P/2 = d * tg ( /2 ) float phy_pmin = - m_distance*(float)tan(m_pmin*VGL_PI/360.0f); float phy_pmax = m_distance*(float)tan(m_pmax*VGL_PI/360.0f); float pmin = phy_pmin/m_width*(m_vmax.x-m_vmin.x)*m_znear/m_vmin.z; float pmax = phy_pmax/m_width*(m_vmax.x-m_vmin.x)*m_znear/m_vmin.z;

6 Escolhe P min e P max, calcula t c e Z ZPS

7 P min tctc Z nea r Z far Z ZP S P ma x

8 Escolhe P min e P max, calcula t c e Z ZPS tctc Z nea r Z far Z ZP S P min P ma x t c / Z far = (P min + P max ) / (Z far - Z near ) t c = Z far. (P min + P max ) / (Z far - Z near )

9 Escolhe P min e P max, calcula t c e Z ZPS tctc Z nea r Z far Z ZP S P min P ma x t c / Z ZPS = P min / (Z ZPS - Z near ) Z ZPS = Z near. t c / (t c - P min ) t c = Z far. (P min + P max ) / (Z far - Z near )

10 ComputeStereo do VGL (2) tc = m_zfar*(pmin+pmax)/(m_zfar-m_znear); zps = tc*m_znear/(tc-pmin);

11 Dados P min e Z ZPS, calcula t c

12 Dados P min e t c, calcula P max

13 ComputeStereo do VGL (3) if (m_zps>=0.0f) // if explicitly given { zps = m_znear + m_zps*(m_zfar-m_znear);... tc = (zps*pmin)/(zps-m_znear); float p = tc*(m_zfar-m_znear)/m_zfar - pmin; if (p > pmax) { // use pmax and find pmin p = pmax / (zps/m_zfar*(m_zfar-m_znear)/(zps-m_znear) - 1.0f); tc = (zps*p)/(zps-m_znear); pmin = tc*(zps-m_znear)/zps; // pmin based on pmax value } else { pmax = p; // pmax based on pmin value } }

14

15 tctc HIT (Horizontal Image Translation) HIT Em OpenGL, projeção é feita no plano Z near Z nea r tctc Z zps

16 HIT (Horizontal Image Translation) Z near Z zps Z far tctc HIT

17 HIT (Horizontal Image Translation) Z near Z zps Z far tctc HIT tctc

18 HIT (Horizontal Image Translation) Z near Z zps Z far tctc HIT = t c. Z near / Z zps HIT tctc

19 ComputeStereo do VGL (4) m_hit = m_tc * m_znear / zps * m_vmin.z / m_znear;

20 GetProjection( ) // compute stereo params if (!m_updated) ComputeStereo(); m.Identity(); m.Frustum( m_vmin.x-m_curreye*m_hit, m_vmax.x-m_curreye*m_hit, m_vmin.y,m_vmax.y, m_vmin.z,m_vmax.z); // current eye (-1=stereo left, 0=mono, 1=stereo right)

21 GetModelView( )... if (m_curreye != 0) m.Translate(-m_curreye*m_tc,0.0f,0.0f);...


Download ppt "Implementação de Stereo na Biblioteca VGL Marcos Machado."

Similar presentations


Ads by Google