Orthographic projection
by Alessandro Loureiro · in Torque Game Engine · 11/10/2004 (5:45 pm) · 41 replies
Hello all ^_^
I'd like to have my game use an isometric orthographic projection for the 3D view of the world. Now, I know that to make this I should change a few stuff on the engine code, but I'm not sure where, and how to do it. All my attempts resulted on distorted, impossible-to-play views. for those of you who aren't very sure of what I'm aiming at, look at these pictures from my first alpha which was made on another engine.
This one is using normal projection
[IMAGE]onfinite.com/libraries/142156/d7e.jpg[/IMAGE]
And this one, the correct orthographic projection:
[IMAGE]http://onfinite.com/libraries/142157/69c.jpg[/IMAGE]
Now my question is, how can this effect be achieved on TGE? I doubt you can turn the default camera into a isometric one by just messing with the projection matrix, let alone use this orthographic projection. If anyone could point me in the right direction, I'd mostly apreciate it. Thanks in advance :)
I'd like to have my game use an isometric orthographic projection for the 3D view of the world. Now, I know that to make this I should change a few stuff on the engine code, but I'm not sure where, and how to do it. All my attempts resulted on distorted, impossible-to-play views. for those of you who aren't very sure of what I'm aiming at, look at these pictures from my first alpha which was made on another engine.
This one is using normal projection
[IMAGE]onfinite.com/libraries/142156/d7e.jpg[/IMAGE]
And this one, the correct orthographic projection:
[IMAGE]http://onfinite.com/libraries/142157/69c.jpg[/IMAGE]
Now my question is, how can this effect be achieved on TGE? I doubt you can turn the default camera into a isometric one by just messing with the projection matrix, let alone use this orthographic projection. If anyone could point me in the right direction, I'd mostly apreciate it. Thanks in advance :)
#2
11/10/2004 (6:30 pm)
(Nice screenshots, by the way. I love FFT!)
#3
However, my lack of knowledge in C++ Game Programming (I do know C++, though) and 3D Math are starting to me my first (and biggest) bump...
now I just need to find out how to set up an isometric camera
EDIT: tried to do what you suggested... but this struct was on guiTSctrl.h... I couldn't find info on what is this GUI control, but setting its ortho value to true doesn't have any impact on the game viewport. And that's what happened, nothing changed.
11/10/2004 (7:25 pm)
Thanks ben... my game idea is to make a game which you can fight tactical battles against friends over the internet. I started development on 3D GameStudio, but ended up turning to TGE because of the much much better networking module. However, my lack of knowledge in C++ Game Programming (I do know C++, though) and 3D Math are starting to me my first (and biggest) bump...
now I just need to find out how to set up an isometric camera
EDIT: tried to do what you suggested... but this struct was on guiTSctrl.h... I couldn't find info on what is this GUI control, but setting its ortho value to true doesn't have any impact on the game viewport. And that's what happened, nothing changed.
#4
11/10/2004 (10:00 pm)
GuiTSCtrl is the control which all 3d rendering is done through. I know it's possible to set up an ortho projection matrix in Torque, as we do it for the RTS pack. When we've finally got the release done, I'll dig in the code a bit to see if there's a short answer for you. :)
#5
thanks for the info... I'll try to figure it out in here also...
and for the second part... how is it possible to change the camera position/targeting? I mean, in which parts of the source I can find the code that controls that, so I can turn the default 1st person camera into a Iso one?
11/11/2004 (5:15 am)
Ah, so the 3D rendering is done through a GUI control? that I didn't know! ^_^thanks for the info... I'll try to figure it out in here also...
and for the second part... how is it possible to change the camera position/targeting? I mean, in which parts of the source I can find the code that controls that, so I can turn the default 1st person camera into a Iso one?
#6
Advanced Camera
AdvancedCam Orbitmode Camera/Player Independant Rotation
Both break out some of the various things you can do with cameras, and may even give you a feel or a solution for what you are looking for.
11/11/2004 (5:44 am)
You may want to check out the two following resources:Advanced Camera
AdvancedCam Orbitmode Camera/Player Independant Rotation
Both break out some of the various things you can do with cameras, and may even give you a feel or a solution for what you are looking for.
#7
11/11/2004 (11:01 am)
OK, I *THINK* I got the camera right. I'm not sure about the zooming, but at least the position. Now I still have to setup ortho...
#8
Switching to ortho isn't too hard. You can change line 729 in game.cc from "query->ortho = false;" to "query->ortho = true;" but I'm clearly missing something else, because after I make the change, I'm left with a grey screen.
Changing the near plane to 0 seemed to help a little, because I could see some polygons rendered from time to time, but I couldn't figure this out 100%.
EDIT: oops, forgot to fill in some details before posting
12/30/2004 (12:44 pm)
Any updates on this? I was fooling around with the engine code last night and I couldn't figure this out either. I even have the RTS pack and I couldn't find anything in there.Switching to ortho isn't too hard. You can change line 729 in game.cc from "query->ortho = false;" to "query->ortho = true;" but I'm clearly missing something else, because after I make the change, I'm left with a grey screen.
Changing the near plane to 0 seemed to help a little, because I could see some polygons rendered from time to time, but I couldn't figure this out 100%.
EDIT: oops, forgot to fill in some details before posting
#9
After ditching all my interiors, I get an ortho view, but the terrain looks horrible. I'm thinking the rendercode for terrain detail assumes a linear perspective projection, and gets angry when you don't use perspective mode.
03/01/2005 (8:22 pm)
Sorry to necro the thread, but has anybody gotten the full ortho to work? I switched the cameraquery to ortho as Drew did, only to discover that some nasty hack in the interior code goes and sets it back to perspective again :(After ditching all my interiors, I get an ortho view, but the terrain looks horrible. I'm thinking the rendercode for terrain detail assumes a linear perspective projection, and gets angry when you don't use perspective mode.
#10
03/02/2005 (5:50 am)
Good question. I haven't had much time to tamper with the engine code lately, and my previous attempts also weren't anything near useful. I'd really appreciate if somebody got it to work and share the results, but I'm getting the feeling nobody did yet...
#11
03/02/2005 (8:06 am)
Yeah, I never got this to work. I sort of got it to work with the rts kit, but it was really nasty looking.
#12

Of course, you'll need to pump the near clipping plane up to avoid z-buffer precision issues.
03/02/2005 (9:21 am)
Well, you could put the camera really really far away, with a very narrow FOV... like this:
Of course, you'll need to pump the near clipping plane up to avoid z-buffer precision issues.
#13
03/02/2005 (9:55 am)
Wow that looks pretty good
#14
so it WORKS fine... dang it, so much time lost
03/02/2005 (1:37 pm)
Why in heaven's name didn't I do that? THAT'S how I made it in GameStudio, to take the screenshot in the beggining of the topic! But when I mentioned this method on IRC they said I was gonna have a lot of serious issues, so I left it aside...so it WORKS fine... dang it, so much time lost
#15
03/02/2005 (1:53 pm)
Manoel, do you have a have a modified gui control you can maybe post as a resource? I have already hacked up GameTSCtrl to mess with the camera, so I may just add a "fakeortho" flag that does this and post it.
#16
I also moved the far plane and fogging distances out as far as I could.
03/02/2005 (2:49 pm)
I'm messing about doing an old school platform style game and my solution to the camer was also to move it very far away and narror the FOV. I've ended up with a FOV of 20 and the camera typically at between 80 and 120 units away from the plane which the action takes place on. Works fine although I did have to fiddle with some native code in the editor to allow me to edit the scene with the new FOV.I also moved the far plane and fogging distances out as far as I could.
#17
Foregive my newbie-ness, I just bought the engine a few hours ago.
03/18/2005 (4:30 am)
Has the 'real' solution for this been found yet? I'd like to use an orthographic view as well, but would like to avoid any work-a-rounds if possible.Foregive my newbie-ness, I just bought the engine a few hours ago.
#18
But I just tested the AdvancedCamera godView mode, and it works perfectly for this.
If you have it installed in your source code, toggle to the advanced camera and call setGodViewMode() and setGodViewOffset("45 -60 60") on it, then call setFov(8) to change the FOV. You'll end up with a nice isometric view of your world (works like a charm with the camera-relative control resource).
The only quirk is that the camera still collides with interiors in godViewMode, and it should not. Not that hard to change, actually.
03/18/2005 (5:06 am)
I didn't make any internal changes to get that screenshot done. I just got into free camera mode, moved the camera very far away and called setFov(8).But I just tested the AdvancedCamera godView mode, and it works perfectly for this.
If you have it installed in your source code, toggle to the advanced camera and call setGodViewMode() and setGodViewOffset("45 -60 60") on it, then call setFov(8) to change the FOV. You'll end up with a nice isometric view of your world (works like a charm with the camera-relative control resource).
The only quirk is that the camera still collides with interiors in godViewMode, and it should not. Not that hard to change, actually.
#19
remember that in game development, it's the result that really counts, not the means used (unless it runs slow, but that's not the case)
03/18/2005 (5:15 am)
The only downside to this work-around is that you're using a method that's normally used to make zooming effetcs (like the telescopic aim of a sniper rifle), so you can't achieve zooming effects in relation to the main scene (you're already using them, darn it. nothing keeps you from moving the camera closer/farther to the ground to make simple zoom effects, though). And I really doubt you'd need such a feature in an ortho-isometric game. So, my guess is you don't really *need* a "real" solution to this. the above stated works just fine.remember that in game development, it's the result that really counts, not the means used (unless it runs slow, but that's not the case)
#20
Thanks for the quick replies.
03/18/2005 (5:49 am)
Yeah you're right, I don't think I'll need anything other than simple zoom effects, if even that. I just didn't know if later on I might run into problems because the camera is so far back or something. It's just one of the first things i'll be doing code-wise, didn't think I'd have to implement a hack so soon ;)Thanks for the quick replies.
Associate Kyle Carter