Camera problems

View previous topic View next topic Go down

Camera problems

Post  michele.balistreri on Tue Oct 21, 2008 7:33 am

I am totally new to OpenGL and blender, so this might be a stupid question. I need to do a mostly 2D game, with a top view mode (that is, stuff is seen from above). What I did was create a camera in the origin, elevate it on the 'z' axis and set it as orthografic (I don't need perspective). I then put an object right under the camera so that with camera view in blender I can see it. When I export the scene and render it mostly like tutorial 2 I get nothing (if I just try tutorial02.sio2 it works instead).

What is the best way to accomplish what I am trying to do? For some reason even resetting the camera to "perspective" (which worked at first, although with a strange rotation) does not seem to help anymore.

michele.balistreri

Posts : 5
Join date : 2008-10-21

View user profile

Back to top Go down

Same problem

Post  unclej on Thu Feb 05, 2009 2:58 pm

I have exactly the same problem.

It seems that having x & y both zero for the camera direction makes the scene disappear. You can test this by just setting the camera direction to (0,0,1) For now I'm working around it by just orienting my entire scene and camera in blender so it's not viewed this way. Seems that some camera transformation in sio2CameraRender is not working if x & y are zero to me.

unclej

Posts : 1
Join date : 2009-01-29

View user profile

Back to top Go down

Re: Camera problems

Post  sio2interactive on Thu Feb 05, 2009 4:29 pm

If you want to do a 2D game you do NOT need to use the Camera... simply set manually an orthographic view (sio2Enter2D / sio2Leave2D) and render your sprite / object manually...

The camera negative axis will negate its direction and the "Orthographic" toggle in Blender is NOT supported by SIO2...

The current camera and culling system is 3D based, if you plan to do 2D games you'll have to implement theses things yourself as SIO2 is a 3D engine, but still have 2D functionalities (mainly use for HUD etc...).

However you do have all the base that you need in order to create 2D games but extra work is required compare to 3D...
avatar
sio2interactive

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

View user profile http://sio2interactive.com

Back to top Go down

Re: Camera problems

Post  meteors on Sat Feb 07, 2009 8:58 pm

There is something wrong with the camera export. Try to position a camera in Blender, looking down from above, and export it.


Best,
-joshua
avatar
meteors

Posts : 241
Join date : 2008-11-08
Location : Sunny Florida

View user profile

Back to top Go down

Re: Camera problems

Post  meteors on Sun Feb 08, 2009 7:39 pm

My personal solution to this was just to re-orient my game so that the X-axis is up.

A hack, but a pretty good one considering the alternatives.


Best,
-joshua
avatar
meteors

Posts : 241
Join date : 2008-11-08
Location : Sunny Florida

View user profile

Back to top Go down

Re: Camera problems

Post  sio2interactive on Sun Feb 08, 2009 8:22 pm

This is not a good solution, simply use the old sio2LookAt:

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 );
}



Use the same parameters as for gluLookAt...
avatar
sio2interactive

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

View user profile http://sio2interactive.com

Back to top Go down

Re: Camera problems

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