Setting 'Top-Down' Camera Perspective Problem

View previous topic View next topic Go down

Setting 'Top-Down' Camera Perspective Problem

Post  monkeys on Mon Aug 03, 2009 6:48 am

I'm trying to use a simple 'top-down' camera perspective to view my small scene, which is small enough to fit on the screen at once, so I want to be directly centered over the scene.

The Problem I try to set the camera in blender to a 'Top-Down' perspective, that is, viewing the scene from directly above (camera Rot x = 0.0, y= 0.0 z = 180.0), the scene will render as extremely far away, even if my camera is very close to the scene in blender. It also displays some strange perspective behaviour as things move closer and further away on the scene.

I think this must have something to do with the perspective settings in blender or something, because i've noticed that if i move the camera to that it is not quite directly above the scene, ie. facing slightly upwards (camera Rot x=10.0, y=0.0, z=180.0), then the behaviour is nowhere near as bad. It's only as you approach being directly above the scene that the behaviour occurs.

I'm sure someone must have coma across something like this before, while attempting to use a top-down camera perspective? Can anyone shed some light on this for me?

monkeys

Posts : 8
Join date : 2009-07-22

View user profile

Back to top Go down

Re: Setting 'Top-Down' Camera Perspective Problem

Post  sio2interactive on Mon Aug 03, 2009 7:45 am

Just use sio2LookAt, its the same as gluLookAt

_________________
SIO2 Interactive
Free Open Source 3D Game Engine for iPhone and iPod Touch
http://sio2interactive.com
avatar
sio2interactive

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

View user profile http://sio2interactive.com

Back to top Go down

Re: Setting 'Top-Down' Camera Perspective Problem

Post  monkeys on Mon Aug 03, 2009 8:37 pm

sio2interactive wrote:Just use sio2LookAt, its the same as gluLookAt

How would I go about implementing sio2LookAt? I've found this code on another part of the site:

Code:



void sio2LookAt( vec3 *_e,
            vec3 *_c,
            vec3 *_u )
{
    float m[ 16 ];
 
  vec3 f,
      s,
      u;
 
  sio2Vec3Diff( _c, _e, &f );
 
  sio2Normalize( &f, &f );

  sio2CrossProduct( &f, _u, &s );
 
  sio2Normalize( &s, &s );

  sio2CrossProduct( &s, &f, &u );
 
  memset( &m[ 0 ], 0, 64 );

    m[  0 ] = s.x;
    m[  4 ] = s.y;
    m[  8 ] = s.z;

    m[  1 ] = u.x;
    m[  5 ] = u.y;
    m[  9 ] = u.z;

    m[  2 ] = -f.x;
    m[  6 ] = -f.y;
    m[ 10 ] = -f.z;

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

But I'm not sure where to integrate it into my current application?

monkeys

Posts : 8
Join date : 2009-07-22

View user profile

Back to top Go down

Re: Setting 'Top-Down' Camera Perspective Problem

Post  sio2interactive on Mon Aug 03, 2009 8:45 pm

Just check the spec of gluLookAt

_________________
SIO2 Interactive
Free Open Source 3D Game Engine for iPhone and iPod Touch
http://sio2interactive.com
avatar
sio2interactive

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

View user profile http://sio2interactive.com

Back to top Go down

Re: Setting 'Top-Down' Camera Perspective Problem

Post  skaterazn on Mon Aug 31, 2009 5:58 am

hello, i want to do the same thing, but i cannot figure out how to use sio2lookat.
does somebody have a sample code?

skaterazn

Posts : 12
Join date : 2009-07-03

View user profile

Back to top Go down

Re: Setting 'Top-Down' Camera Perspective Problem

Post  sio2interactive on Mon Aug 31, 2009 4:54 pm

sio2LookAt( vec3 <pos in worldspace>, vec3 <target in worldspace>, vec3 <normalized up vector> );

_________________
SIO2 Interactive
Free Open Source 3D Game Engine for iPhone and iPod Touch
http://sio2interactive.com
avatar
sio2interactive

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

View user profile http://sio2interactive.com

Back to top Go down

Re: Setting 'Top-Down' Camera Perspective Problem

Post  Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

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