About _SIO2transform on 1.3.2

View previous topic View next topic Go down

About _SIO2transform on 1.3.2

Post  exavi on Sun Jan 25, 2009 12:04 pm

I've updated the whole code of my project to 1.3.2 but right now it does not appear anything on screen

I'm thinking if this may be because right now is working with _SIO2transform which has loc(location) dir(┐direction?) and scl (scale), because in this case I will have to change the whole code where I played with camera targets and the rotation of the objects of the whole project...

I've changed all transforms to work with the new version but from what I can see seems that this "dir" means direction and in this case I guess that there must be some another way to use it... I mean that we cant just say object->_SIO2transform->dir->z+=45.0f and expect it to spin 45degrees in z, right?

if right now is working with direction values, is there any way to "transform" these values to use them like the old version? I mean something like multiplying it against the world matrix or some trick like that... :S

exavi

Posts : 37
Join date : 2008-10-21

View user profile

Back to top Go down

Re: About _SIO2transform on 1.3.2

Post  exavi on Sun Jan 25, 2009 1:26 pm

Ah, btw I've tried to do:

sio2->_SIO2camera->_SIO2transform->dir->x = object->_SIO2transform->loc->x - sio2->_SIO2camera->_SIO2transform->loc->x;
sio2->_SIO2camera->_SIO2transform->dir->y = object->_SIO2transform->loc->y - sio2->_SIO2camera->_SIO2transform->loc->y;
sio2->_SIO2camera->_SIO2transform->dir->z = object->_SIO2transform->loc->z - sio2->_SIO2camera->_SIO2transform->loc->z;

which is "dir=tar-loc" (basically what you do when exporting) and it does not work well, the camera targets the object but does weird things with what it shows. like squashing the world. Do I still need to multiply by (0.001, 0.001, -1.001) ???

exavi

Posts : 37
Join date : 2008-10-21

View user profile

Back to top Go down

Re: About _SIO2transform on 1.3.2

Post  exavi on Sun Jan 25, 2009 1:42 pm

...argh ok, I think that I have it fixed...


i added sio2Normalize(sio2->_SIO2camera->_SIO2transform->dir,sio2->_SIO2camera->_SIO2transform->dir);

after doing the dir=tar-loc thing it seems to work, but it seems also not to be exactly at the same position as before... this can be fixed by changing the pos values but maybe I forgot something else and it does not work when I try to plug the trick to my project. (right now I was just playing with a template)

please if someone can tell me if I still need to do something more to use this like 1.3.1, I would really appreciate it. Wink

Code:
sio2->_SIO2camera->_SIO2transform->dir->x = object->_SIO2transform->loc->x - sio2->_SIO2camera->_SIO2transform->loc->x;
sio2->_SIO2camera->_SIO2transform->dir->y = object->_SIO2transform->loc->y - sio2->_SIO2camera->_SIO2transform->loc->y;
sio2->_SIO2camera->_SIO2transform->dir->z = object->_SIO2transform->loc->z - sio2->_SIO2camera->_SIO2transform->loc->z;
sio2Normalize(sio2->_SIO2camera->_SIO2transform->dir,sio2->_SIO2camera->_SIO2transform->dir);

exavi

Posts : 37
Join date : 2008-10-21

View user profile

Back to top Go down

Re: About _SIO2transform on 1.3.2

Post  david4482 on Mon Jan 26, 2009 2:19 am

Also having some trouble with camera in 1.3.2. Using the camera in supplied tutorial blend files works fine but If I change the camera rotation in blender to point down z axis nothing displays back in engine (change to matrix creation since introduction of transforms?). Very odd anyway. I will test again this evening and post more info.

david4482

Posts : 7
Join date : 2009-01-24

View user profile

Back to top Go down

Re: About _SIO2transform on 1.3.2

Post  sio2interactive on Mon Jan 26, 2009 3:07 am

Can you send me that blend file that cause problem by email, so I can check it out?

Cheers,
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: About _SIO2transform on 1.3.2

Post  exavi on Mon Jan 26, 2009 4:03 am

sio2, could you please tell me if I am missing something when making the camera look at something?

for some reason needs at least two frames to make it point at something the right way. and this weird inbetween frame is driving me crazy.

I thought that dir=tar-loc; would do the trick, am I missing something?

exavi

Posts : 37
Join date : 2008-10-21

View user profile

Back to top Go down

Re: About _SIO2transform on 1.3.2

Post  sio2interactive on Mon Jan 26, 2009 5:01 am

1. sio2Vec3Diff( tar, _SIO2transform->loc, _SIO2transform->dir )
2. sio2Normalize( _SIO2transform->dir, _SIO2transform->dir )
3. sio2TransformBindMatrix( _SIO2transtorm )

That's pretty much it....
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: About _SIO2transform on 1.3.2

Post  autology on Mon Jan 26, 2009 7:49 pm

I'm in a similar situation:

I've implemented vec3diff/normalize/bind

The camera location is correct.
The camera direction is oriented toward my look target (and normalized)

But I still see nothing in the viewport - I'll keep at it to see if something else is not set correctly.

autology

Posts : 22
Join date : 2008-12-29

View user profile

Back to top Go down

Re: About _SIO2transform on 1.3.2

Post  sio2interactive on Mon Jan 26, 2009 8:25 pm

Ok, just to clarify, the only thing that have changed is that the tar variable have been taken out... basically the tar (target location in worldspace) was only used to calculate the camera direction...

So basically:

_SIO2transform->loc = worldspace position of the camera
_SIO2transform->dir = Direction vector ( normalized -1 to 1 ) to represent the camera direction

To calculate the dir:

tar (in WS) - loc (in WS) = dir

then normalize

then update the matrix of SIO2transform and that's it...
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: About _SIO2transform on 1.3.2

Post  autology on Mon Jan 26, 2009 9:22 pm

What you've said makes sense, and I can't seem to place the error:

Example:

camera loc-> 0,-10,0
target-> 0,0,0

and you would expect that a dir of -> |{0,10,0}| -> {0,1,0} should point at the object, but it's not.

I am also getting the perspective errors (object appears stretched) that others have mentioned previously.

Before I tear apart my current navigation code to debug this - any ideas?




Code:

      sio2Vec3Diff(tar, sio2->_SIO2camera->_SIO2transform->loc, sio2->_SIO2camera->_SIO2transform->dir );
      sio2Normalize( sio2->_SIO2camera->_SIO2transform->dir, sio2->_SIO2camera->_SIO2transform->dir );
      sio2TransformBindMatrix( sio2->_SIO2camera->_SIO2transform );

autology

Posts : 22
Join date : 2008-12-29

View user profile

Back to top Go down

Re: About _SIO2transform on 1.3.2

Post  monsterkodi on Tue Jan 27, 2009 12:40 pm

I have also quite some problems with the camera.

sio2, please correct me if I am wrong:
As I understand the code, the sio2CameraRender function uses the cross product of the direction vector and (0,0,1) to calculate the sideway vector.
There seems to be no check in place if the direction vector is parallel to the z axis. Since I need a camera that is able to also look straight up or down I would get the gimbal lock problem.
Because of this and the fact the I need a camera roating around a fixed point int the distance, I use my own code to setup the model matrix based on some old quaternion code. Now I have the problem that I can't get billboards to work correctly. Is it possible that the billboard/halo code depends on the assumption that the camera up vector is always (0,0,1)?

I found a comment somewhere stating that you plan to add quaternions. I think it would be a good idea to base the camera code on quaterion rotation and make some tests for cameras with different up orientations.
I would like to help with that redesign, if possible.
avatar
monsterkodi

Posts : 21
Join date : 2009-01-15

View user profile http://monsterkodi.net

Back to top Go down

Re: About _SIO2transform on 1.3.2

Post  david4482 on Tue Jan 27, 2009 3:19 pm

monsterkodi: I think quaternions would be the solution too. I was going to look into it but sounds like you are a good few steps ahead are already so would be great if you guys could get a redesign together.

david4482

Posts : 7
Join date : 2009-01-24

View user profile

Back to top Go down

Re: About _SIO2transform on 1.3.2

Post  sio2interactive on Tue Jan 27, 2009 4:36 pm

Sure that would be great, send me your camera code using quaternion, as well as the blender integration and an example project (to show me that it works), and I will add it to the source tree!

Tks in advance,

Cheers,
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: About _SIO2transform on 1.3.2

Post  monsterkodi on Tue Jan 27, 2009 4:59 pm

Well, I am not sure if I can pull this of by myself, since I am not very familiar with the internals of the engine yet.
But with your help it should be possible. I will start with "downgrading" my quaternion code from c++ to pure c and implement some functions to set up the camera transformations with it.
Have I been right with the billboard issue mentioned above? And/or are there any other dependancies on the camera transformations in other parts of the engine?
avatar
monsterkodi

Posts : 21
Join date : 2009-01-15

View user profile http://monsterkodi.net

Back to top Go down

Re: About _SIO2transform on 1.3.2

Post  sio2interactive on Tue Jan 27, 2009 5:32 pm

Yeah Im always assuming that the up vector is Z+
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: About _SIO2transform on 1.3.2

Post  monsterkodi on Wed Jan 28, 2009 2:38 am

Ok, are there any other parts of the engine depending on this assumption?
avatar
monsterkodi

Posts : 21
Join date : 2009-01-15

View user profile http://monsterkodi.net

Back to top Go down

Re: About _SIO2transform on 1.3.2

Post  sio2interactive on Wed Jan 28, 2009 4:47 am

The billboard I guess nothing else that I can think of... Actually just putting back the up vector in the camera struct and do the necessary changes in the camera render function and sio2objectbillboard will do the trick.
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: About _SIO2transform on 1.3.2

Post  monsterkodi on Wed Jan 28, 2009 5:20 am

That sounds good. I will let you know when I have something accomplished. Probably this coming weekend.
avatar
monsterkodi

Posts : 21
Join date : 2009-01-15

View user profile http://monsterkodi.net

Back to top Go down

Re: About _SIO2transform on 1.3.2

Post  monsterkodi on Thu Jan 29, 2009 11:56 am

good news: i am alost finished with the quaternion based camera.
i have a set of working quaternion functions and a 'minimal invasive' change to the camera which doesn't break the old behaviour (which is really broken btw. Wink )
not bad for 1.5 evenings drunken

the remaining problems are the billboards and the correct fov.
blender has two modes for the fov (the little d button beside the lens value field). one is degrees, but the other one i couldn't figure out yet.
has anybody an idea how i can convert the other value to degrees?
avatar
monsterkodi

Posts : 21
Join date : 2009-01-15

View user profile http://monsterkodi.net

Back to top Go down

Re: About _SIO2transform on 1.3.2

Post  monsterkodi on Thu Jan 29, 2009 4:59 pm

never mind, i found it in the blender sources. the conversion from blender lens to degrees is

angle = 360.0 * atan(16.0/lensvalue) / M_PI
avatar
monsterkodi

Posts : 21
Join date : 2009-01-15

View user profile http://monsterkodi.net

Back to top Go down

Re: About _SIO2transform on 1.3.2

Post  monsterkodi on Sat Feb 07, 2009 3:57 pm

any news regarding this subject?
sio2, did you have time to check out my camera implementation?
if yes, is it of any use? or do you need any changes?
avatar
monsterkodi

Posts : 21
Join date : 2009-01-15

View user profile http://monsterkodi.net

Back to top Go down

Re: About _SIO2transform on 1.3.2

Post  sio2interactive on Sat Feb 07, 2009 4:30 pm

Yeah what you did is pretty good... I will integrate it with the 1.3.3 revision...
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: About _SIO2transform on 1.3.2

Post  sio2interactive on Sat Feb 07, 2009 4:32 pm

If would be nice if you can also help me with the SIO2_IPO_CURVE_EXTRAPOLATION_CYCLIC_EXTRAPOLATION I never had time to finish it and its on my TODO list forever but as it constantly continue growing it has been pushed down Wink

Lemme know if you need more info.


Cheers,
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: About _SIO2transform on 1.3.2

Post  monsterkodi on Sun Feb 08, 2009 4:11 am

good to hear that you can use my camera implementation.

since this problem is probably confusing a lot of people, i think it would be a good idea to make a sticky post which explains the limitations of the current camera system until the new release is out. any idea when it will (approximately) be finished?

concerning the ipo extrapolation:
i am not familiar with animation in blender. but i had a look at the documentation for the ipo curves and the missing extrapolation seems easy to implement.
do you have a test project (or at least a blender file) for testing the ipo curves? if yes, it would be nice if you could send it to me.
avatar
monsterkodi

Posts : 21
Join date : 2009-01-15

View user profile http://monsterkodi.net

Back to top Go down

Re: About _SIO2transform on 1.3.2

Post  sio2interactive on Sun Feb 08, 2009 4:26 am

I'll create an example project and send it to you... I add that on my todo list right now Wink

Cheers,
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: About _SIO2transform on 1.3.2

Post  Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top


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