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.

Camera problems

4 posters

Go down

Camera problems Empty Camera problems

Post  michele.balistreri 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

Back to top Go down

Camera problems Empty Same problem

Post  unclej 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

Back to top Go down

Camera problems Empty Re: Camera problems

Post  sio2interactive 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...
sio2interactive
sio2interactive

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

http://sio2interactive.com

Back to top Go down

Camera problems Empty Re: Camera problems

Post  meteors 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
meteors
meteors

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

Back to top Go down

Camera problems Empty Re: Camera problems

Post  meteors 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
meteors
meteors

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

Back to top Go down

Camera problems Empty Re: Camera problems

Post  sio2interactive 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...
sio2interactive
sio2interactive

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

http://sio2interactive.com

Back to top Go down

Camera problems Empty Re: Camera problems

Post  Sponsored content


Sponsored content


Back to top Go down

Back to top


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