diff options
author | Benoit Bolsee <benoit.bolsee@online.be> | 2008-05-24 12:34:04 +0400 |
---|---|---|
committer | Benoit Bolsee <benoit.bolsee@online.be> | 2008-05-24 12:34:04 +0400 |
commit | 7f10f5f66f6b29a7a4e508da7b3c80a50d00618d (patch) | |
tree | 0c91e54a1986b4de1c9c1b5bb182c2a55f539aae /source/gameengine/Rasterizer | |
parent | 5f70682f6a622b2832e50860cc2699c67d9b7e65 (diff) |
fix BGE bug #8646: unusable anaglyph settings
The best rules for stereo rendering are now applied to Blender. Here is the new situation:
1) The focal distance is now settable through the GUI: select the camera (each camera can have a different setting) and go to the camera data (F9): the "Dof Dist" and "Dof Ob" can be used to set the focal distance for that camera. The "Dof Ob" is interesting because it sets the focal distance so that the center this object will appear at the surface of the screen when running the game.
2) The eye separation is automatically set to focal_distance/30, which is considered to be a reasonable value. If you need a different value, you can always use Python scripting.
Notes:
- If you switch camera during the game, the focal distance will also change unless you have set the focal distance by scripting, in which case it overwrites the focal distance setting of all cameras.
- If you don't set the focal distance in the camera data or by scripting, the default value will be used. The default value corresponds more of less to the near clipping plane which means that all the objects will be very far with little 3D effect.
- If you don't set the eye separation by scripting, it is automatically computed as focal_distance/30, regardless on how the focal distance was set.
Diffstat (limited to 'source/gameengine/Rasterizer')
4 files changed, 10 insertions, 3 deletions
diff --git a/source/gameengine/Rasterizer/RAS_CameraData.h b/source/gameengine/Rasterizer/RAS_CameraData.h index 99c0c412cf7..6aa9b34962b 100644 --- a/source/gameengine/Rasterizer/RAS_CameraData.h +++ b/source/gameengine/Rasterizer/RAS_CameraData.h @@ -40,13 +40,16 @@ struct RAS_CameraData int m_viewportbottom; int m_viewportright; int m_viewporttop; + float m_focallength; RAS_CameraData(float lens = 35., float clipstart = 0.1, float clipend = 100., bool perspective = true, - bool viewport = false, int viewportleft = 0, int viewportbottom = 0, int viewportright = 0, int viewporttop = 0) : + float focallength = 0.0f, bool viewport = false, int viewportleft = 0, int viewportbottom = 0, + int viewportright = 0, int viewporttop = 0) : m_lens(lens), m_clipstart(clipstart), m_clipend(clipend), m_perspective(perspective), + m_focallength(focallength), m_viewport(viewport), m_viewportleft(viewportleft), m_viewportbottom(viewportbottom), diff --git a/source/gameengine/Rasterizer/RAS_IRasterizer.h b/source/gameengine/Rasterizer/RAS_IRasterizer.h index 5e8b5ad8276..18a7f261c94 100644 --- a/source/gameengine/Rasterizer/RAS_IRasterizer.h +++ b/source/gameengine/Rasterizer/RAS_IRasterizer.h @@ -344,6 +344,7 @@ public: float top, float frustnear, float frustfar, + float focallength = 0.0f, bool perspective = true )=0; /** diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp index ea41b2f7d13..f99121e5b7c 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp @@ -1802,6 +1802,7 @@ MT_Matrix4x4 RAS_OpenGLRasterizer::GetFrustumMatrix( float top, float frustnear, float frustfar, + float focallength, bool ){ MT_Matrix4x4 result; @@ -1813,9 +1814,10 @@ MT_Matrix4x4 RAS_OpenGLRasterizer::GetFrustumMatrix( float near_div_focallength; // next 2 params should be specified on command line and in Blender publisher if (!m_setfocallength) - m_focallength = 1.5 * right; // derived from example + m_focallength = (focallength == 0.f) ? 1.5 * right // derived from example + : focallength; if (!m_seteyesep) - m_eyeseparation = 0.18 * right; // just a guess... + m_eyeseparation = m_focallength/30; // reasonable value... near_div_focallength = frustnear / m_focallength; switch(m_curreye) diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h index c63a7b80b7c..23714a12151 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h @@ -246,6 +246,7 @@ public: float top, float frustnear, float frustfar, + float focallength, bool perspective ); |