Perspective
by Jan Kavan · in Torque Game Engine · 09/21/2004 (10:34 am) · 11 replies
Hi,
I still can't get different perspective and I am really stuck on this.
Can anyone descend from heights of game creating and help humble me?
I am trying to set something similar to gluPerspective for torque view port. I am lost though and I didn't find anything on subject for two days now.
My point is to decrease amount of scaling when moving with objects to front or to back.
Thanks again and sorry for new post on this subject. I really need a hand there.
I still can't get different perspective and I am really stuck on this.
Can anyone descend from heights of game creating and help humble me?
I am trying to set something similar to gluPerspective for torque view port. I am lost though and I didn't find anything on subject for two days now.
My point is to decrease amount of scaling when moving with objects to front or to back.
Thanks again and sorry for new post on this subject. I really need a hand there.
About the author
#2


That's why I need to set up the interior.
Thanks again
09/21/2004 (10:22 pm)
Well, if you use interior in a sense of interior yes, but in my case, there is no real interior. See this:

That's why I need to set up the interior.
Thanks again
#3
09/22/2004 (3:07 am)
You might try narrowing the field of view. You can use the console command setFov(#); where # is the field of view in degrees, from 1 to 179. The default field of view is 90. The scene you're using for a background there appears to have a field of view of 40 or so.
#4
09/22/2004 (3:58 am)
Yeah, you need to match the game camera's position and FOV to what you used to render the background.
#5
I found a setFOV() method listed in the TGE_Console_Cmds.rtf.
As Eric mentioned, though, you'll most likely need to set the position of the camera to get the right effect.
For instance - in your scene, it looks like your camera is either looking downward slightly or raised toward the ceiling.
I believe you'd use the camera object to set the camera position.
In the above mentioned docs, search for the method dropCameraToSelection.
You'll find, for example, the use of LocalClientConnection.camera.setTransform()...
{ Again NOTE: I'm a noob with Torque - so I don't claim that any of this works ;) }
09/22/2004 (7:06 am)
{ NOTE: I'm a noob with Torque }I found a setFOV() method listed in the TGE_Console_Cmds.rtf.
As Eric mentioned, though, you'll most likely need to set the position of the camera to get the right effect.
For instance - in your scene, it looks like your camera is either looking downward slightly or raised toward the ceiling.
I believe you'd use the camera object to set the camera position.
In the above mentioned docs, search for the method dropCameraToSelection.
You'll find, for example, the use of LocalClientConnection.camera.setTransform()...
{ Again NOTE: I'm a noob with Torque - so I don't claim that any of this works ;) }
#6
09/22/2004 (7:12 am)
Why not do a search for gluPerspective :) I think its actually what torque uses. Or is it glPerspective? might be.
#7
Back when taking a 3D graphics course, I created a small engine
that used pre-rendered background with a real-time rendered
character in the forground.
I also created a small editor where you could define the area where
the character could walk. This editor also let you define the scene
projection and position of the camera - and view these areas (as
outlined rectangles) adjusted by the projection/camera-position.
Anyway, you might find an aid in creating some rectangular object
that you can place in the scene (visibly). Then you can call the setFOV
and possibly adjust the camera directly in the console window.
(Nicely, it seems you can call the same methods in code and in the
console window). That way you could interactively try to discover
the transforms you need...
{ Again NOTE: I'm a noob with Torque - so I don't claim that any of this works ;) }
09/22/2004 (7:14 am)
{ NOTE: I'm a noob with Torque }Back when taking a 3D graphics course, I created a small engine
that used pre-rendered background with a real-time rendered
character in the forground.
I also created a small editor where you could define the area where
the character could walk. This editor also let you define the scene
projection and position of the camera - and view these areas (as
outlined rectangles) adjusted by the projection/camera-position.
Anyway, you might find an aid in creating some rectangular object
that you can place in the scene (visibly). Then you can call the setFOV
and possibly adjust the camera directly in the console window.
(Nicely, it seems you can call the same methods in code and in the
console window). That way you could interactively try to discover
the transforms you need...
{ Again NOTE: I'm a noob with Torque - so I don't claim that any of this works ;) }
#8
Wouldn't that require working directly in the C++ code?
My own assumption would be that the developer would want
to try to solve the problem at the scripting level if possible.
09/22/2004 (7:17 am)
[quote=Phil Carlisle]Why not do a search for gluPerspective :)[quote]Wouldn't that require working directly in the C++ code?
My own assumption would be that the developer would want
to try to solve the problem at the scripting level if possible.
#9
I know camera angle is different, it's not a problem for me to adjust. It's just the perspective which doesn't work for me now.
I'll try today this SetFOV and I'll see the results. If this will work, than I will slowly be set for the main game architecture implementation
which I already have paper designed. :)
Phil: there is no single call to gluPerspective, because torque is using different coordinate system. From what I know gluPerspective does this (btw it really is gluPerspective :)):
fHeight = tan( fovY / 180 * pi ) * zNear / 2;
fWidth = fHeight * aspect; //aspect is aspect ratio of the screen projection
glFrustum( -fWidth, fWidth, -fHeight, fHeight, zNear, zFar );
but in torque this is hardcoded in dlgSetFrustum and you cannot set the aspect thing unless you tweak the frustum function.
But I am no 3d guru so I am NOT messing with render code. LOL
Jacob, this is exactly what I am doing here! I hope I will succeed, because this engine is so great and it simplifies a lot for me,
although I have to C++ tweak it a lot. Kudoz to show tool and tic tac toe tutorial.
Thanks again. This is a great help for me.
**Ah typos. everywhere typos. shoot me now. :)
09/22/2004 (7:31 am)
Hi and thanks to everyone for answers. I will try to discover all those things tonight.I know camera angle is different, it's not a problem for me to adjust. It's just the perspective which doesn't work for me now.
I'll try today this SetFOV and I'll see the results. If this will work, than I will slowly be set for the main game architecture implementation
which I already have paper designed. :)
Phil: there is no single call to gluPerspective, because torque is using different coordinate system. From what I know gluPerspective does this (btw it really is gluPerspective :)):
fHeight = tan( fovY / 180 * pi ) * zNear / 2;
fWidth = fHeight * aspect; //aspect is aspect ratio of the screen projection
glFrustum( -fWidth, fWidth, -fHeight, fHeight, zNear, zFar );
but in torque this is hardcoded in dlgSetFrustum and you cannot set the aspect thing unless you tweak the frustum function.
But I am no 3d guru so I am NOT messing with render code. LOL
Jacob, this is exactly what I am doing here! I hope I will succeed, because this engine is so great and it simplifies a lot for me,
although I have to C++ tweak it a lot. Kudoz to show tool and tic tac toe tutorial.
Thanks again. This is a great help for me.
**Ah typos. everywhere typos. shoot me now. :)
#10
but calls to gluPerspective are overriden and it just distorted the view.
09/22/2004 (7:32 am)
Jacob: It's not possible to make 2 1/2D without coding. I had to set my own code for this type of projection,but calls to gluPerspective are overriden and it just distorted the view.
#11
Nothing special, but, for the fun of it, I had imported your image into that cheesy prerendered editor/egine I had created back during that 3D course and thought you might be interested to see. (I didn't want to post it publicly since it's your media and I'm not going to distribute it).
If you're interesting in seeing the result - send me an email (torquepub@jaek.com).
09/26/2004 (12:00 pm)
Kavan, I was going to send a personal message to you, but here doesn't seem to be a way.Nothing special, but, for the fun of it, I had imported your image into that cheesy prerendered editor/egine I had created back during that 3D course and thought you might be interested to see. (I didn't want to post it publicly since it's your media and I'm not going to distribute it).
If you're interesting in seeing the result - send me an email (torquepub@jaek.com).
Torque Owner Josh Moore