FORUM CLOSED, PLEASE REGISTER AT FORUM.SIO2INTERACTIVE.COM
Would you like to react to this message? Create an account in a few clicks or log in to continue.

problem with camera look down?

4 posters

Go down

problem with camera look down? Empty problem with camera look down?

Post  warrangka Thu Feb 19, 2009 8:30 pm

Hello

if i try to put the camera look down (in blender with Transform camera properties with rotX=0, rotY=0 and rotZ=0, and in my case with lockx = 0, locky = 0 and lockz = 17) i have problems because i dont see anything. If i change the angle, for example rotx=10, then it work ok.

The same happens if i use sio2Rotate3D with 90 and 0 values (in previous version i used sio2Orbit( &tmp_pos, plataforma->pos, 90, 0, 55.0f ); and it worked )

How can I do this?

Thanks

warrangka

Posts : 5
Join date : 2009-02-17

Back to top Go down

problem with camera look down? Empty Re: problem with camera look down?

Post  flying24 Thu Feb 19, 2009 10:23 pm

I'm not sure about your second question, but I believe the problem with the camera looking straight down is addressed in this post:

http://forum.sio2interactive.com/sio2-engine-f3/camera-problems-t76.htm

flying24

Posts : 9
Join date : 2009-02-13

Back to top Go down

problem with camera look down? Empty Re: problem with camera look down?

Post  sio2interactive Thu Feb 19, 2009 11:24 pm

just use sio2LookAt instead...
sio2interactive
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 45
Location : Shanghai

http://sio2interactive.com

Back to top Go down

problem with camera look down? Empty Re: problem with camera look down?

Post  warrangka Fri Feb 20, 2009 9:46 pm

Do you have any example?. I try this code but dont work Mad (in tutorial03 trying to view one face of the cube)

Code:

void templateRender( void )
{
   glMatrixMode( GL_MODELVIEW );
   glLoadIdentity();

   glClear( GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT );

   vec3 eyes_point;
   eyes_point.x = 10.0f;
   eyes_point.y = 0.0f;
   eyes_point.z = 0.0f;
   
   vec3 center_reference_point;
   center_reference_point.x = 0.0f;
   center_reference_point.y = 0.0f;
   center_reference_point.z = 0.0f;
   
   vec3 direction_up_vector;
   direction_up_vector.x = 0.0f;
   direction_up_vector.y = 1.0f;
   direction_up_vector.z = 0.0f;
   
   sio2LookAt(&eyes_point, &center_reference_point, &direction_up_vector);


   SIO2camera *_SIO2camera = ( SIO2camera * )sio2ResourceGet( sio2->_SIO2resource,
                                               SIO2_CAMERA,
                                               "camera/Camera" );

   if( _SIO2camera )
   {
      sio2CameraSetPerspective( _SIO2camera, sio2->_SIO2window );

      sio2WindowEnterLandscape3D();
      {
         
         sio2CameraRender( _SIO2camera );
         
         sio2ResourceRender( sio2->_SIO2resource,
                        sio2->_SIO2window,
                        _SIO2camera,
                        SIO2_RENDER_SOLID_OBJECT );
      }
      sio2WindowLeaveLandscape3D();
   }
}

warrangka

Posts : 5
Join date : 2009-02-17

Back to top Go down

problem with camera look down? Empty Re: problem with camera look down?

Post  sio2interactive Sat Feb 21, 2009 3:25 am

1. Why you still call sio2CameraRender after sio2LookAt?

2. Why the up axis is Y when the camera exported blender use Z as the up axis?

3. Is you are trying to create a game with that is a static top view just use sio2Enter2D with a zNear / zFar... you do not need a 3D perspective...

4. If you don't want to use an orthographic projection just make the eye point straing on the y axis do not negate the z axis... the same problem will occur will gluLookAt at as Im using the same code as MESA do to it...

5. I don't know what happen with the sio2LookAt in 1.3.3 I think I find/replace something that I shouldn't so replace the function with this code:

Code:


void sio2LookAt( vec3 *_e,
             vec3 *_c,
             vec3 *_u )
{
   vec3 f,
       s,
       u;
   
    float m[ 4 ][ 4 ];
   
    f.x = _c->x - _e->x;
    f.y = _c->y - _e->y;
    f.z = _c->z - _e->z;
   
   sio2Normalize( &f, &f );
   
    s.x = ( f.y * _u->z ) - ( f.z * _u->y );
    s.y = ( f.z * _u->x ) - ( f.x * _u->z );
   s.z = ( f.x * _u->y ) - ( f.y * _u->x );

   sio2Normalize( &s, &s );
   
   u.x = ( s.y * f.z ) - ( s.z * f.y );
    u.y = ( s.z * f.x ) - ( s.x * f.z );
   u.z = ( s.x * f.y ) - ( s.y * f.x );   
   
   memset( &m[ 0 ], 0, 64 );
   
   m[ 0 ][ 0 ] =
   m[ 1 ][ 1 ] =
   m[ 2 ][ 2 ] =
   m[ 3 ][ 3 ] = 1.0f;
   
    m[ 0 ][ 0 ] = s.x;
    m[ 1 ][ 0 ] = s.y;
    m[ 2 ][ 0 ] = s.z;
   
    m[ 0 ][ 1 ] = u.x;
    m[ 1 ][ 1 ] = u.y;
    m[ 2 ][ 1 ] = u.z;
   
    m[ 0 ][ 2 ] = -f.x;
    m[ 1 ][ 2 ] = -f.y;
    m[ 2 ][ 2 ] = -f.z;

    glMultMatrixf( &m[ 0 ][ 0 ] );
   
   glTranslatef( -_e->x, -_e->y, -_e->z );
   
   #ifdef SIO2_DEBUG_GL

      sio2ErrorGL( __FILE__, __FUNCTION__, __LINE__ );
   #endif   
}



6. Here's the code that you post above fixed to work with tutorial03 giving you a straight perspective after that you can simply push and pop a matrix to orient the 3d perspective to be in top view if you want...

Code:


  glMatrixMode( GL_MODELVIEW );
  glLoadIdentity();

  glClear( GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT );

  vec3 eyes_point;
  eyes_point.x = 0.0f;
  eyes_point.y = -25.0f;
  eyes_point.z = 0.0f;
 
  vec3 center_reference_point;
  center_reference_point.x = 0.0f;
  center_reference_point.y = -24.0f;
  center_reference_point.z = 0.0f;
 
  vec3 direction_up_vector;
  direction_up_vector.x = 0.0f;
  direction_up_vector.y = 0.0f;
  direction_up_vector.z = 1.0f;
 

  SIO2camera *_SIO2camera = ( SIO2camera * )sio2ResourceGet( sio2->_SIO2resource,
                                              SIO2_CAMERA,
                                              "camera/Camera" );

  if( _SIO2camera )
  {
      sio2CameraSetPerspective( _SIO2camera, sio2->_SIO2window );

      sio2WindowEnterLandscape3D();
      {
        sio2LookAt(&eyes_point, &center_reference_point, &direction_up_vector);       
        //sio2CameraRender( _SIO2camera );
       
        // Push the matrix here with the desired degree of rotation

        // Update the camera frustum here...

        // Render...
        sio2ResourceRender( sio2->_SIO2resource,
                        sio2->_SIO2window,
                        _SIO2camera,
                        SIO2_RENDER_SOLID_OBJECT );

      // Pop the matrix here...
      }
      sio2WindowLeaveLandscape3D();
  }   




In addition sio2LookAt work exactly the same as gluLookAt so... its easy to find tutorials out there to make you understand the basics before going forward with you project...
sio2interactive
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 45
Location : Shanghai

http://sio2interactive.com

Back to top Go down

problem with camera look down? Empty Re: problem with camera look down?

Post  sctm81 Sun May 03, 2009 11:57 pm

I was trying to find the 'sio2Enter2d' Function - unsuccessfully. doesn't seem part of sio2...

sctm81

Posts : 29
Join date : 2009-04-24

Back to top Go down

problem with camera look down? Empty Re: problem with camera look down?

Post  sio2interactive Mon May 04, 2009 12:11 am

sio2WindowEnter2D
sio2interactive
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 45
Location : Shanghai

http://sio2interactive.com

Back to top Go down

problem with camera look down? Empty Re: problem with camera look down?

Post  sctm81 Tue May 05, 2009 1:06 am

Questions to 2D development in sio2. Please tell me if my understanding is correct...

1) i can model objects in blender and import them using sio2.
2) i don't include a camera.
3) i use sio2WindowEnter2D.
4) i have to use opengl commands instead of sio2 calls in order to render objects and animation. (if there is an sio2 way to render objects/animations in 2d mode, what commands would i use without a camera?)

sctm81

Posts : 29
Join date : 2009-04-24

Back to top Go down

problem with camera look down? Empty Re: problem with camera look down?

Post  sio2interactive Tue May 05, 2009 1:38 am

You can still use sio2 commands to render... the only thing is you'll have to do the clipping yourself... just use sio2ObjectRender using the SIO2resource pointers... 2D an 3D with SIO2 is pretty much the same thing...
sio2interactive
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 45
Location : Shanghai

http://sio2interactive.com

Back to top Go down

problem with camera look down? Empty Re: problem with camera look down?

Post  Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum