Ortho projection and other newbie questions

Started by OrangyTang, November 13, 2010, 10:03:06 PM

Previous topic - Next topic

OrangyTang

Hello, I thought i'd give this a try for my current project, but seem to have found a few snags:

1. Is there a way to set an orthographic camera projection? There doesn't seem to be a way to specify the projection that the camera uses, other than setting the FOV. Perspective seems to be implied. How do I set it to ortho?

2. Primatives.creatBox returns a box rotated by 45 degrees, wtf? What's up with that?

3. Camera.setLookAt seems to not be remembered if I call Camera.setPosition(). I have to re-specify the look at point whenever changing the position. Is this normal? Is there a way around this?

4. The hello world code uses direct calls to LWJGL's Display.isCloseRequested, and there doesn't seem to be any window management. Am I missing something? How do I control the window settings (in both GL and software mode).

Thanks.

EgonOlsen

#1
Quote from: OrangyTang on November 13, 2010, 10:03:06 PM
1. Is there a way to set an orthographic camera projection? There doesn't seem to be a way to specify the projection that the camera uses, other than setting the FOV. Perspective seems to be implied. How do I set it to ortho?
Nope, orthographic mode isn't supported, i'm sorry.

Quote from: OrangyTang on November 13, 2010, 10:03:06 PM
2. Primatives.creatBox returns a box rotated by 45 degrees, wtf? What's up with that?
Yes, that's a bit strange and no, there's no real reason for this. It's caused by the fact that it's a lathe object and starts in the x-y-plane. Just rotate it by 45°...It has no proper texture coordinates anyway, so it's not really useful for anything but quick and dirty prototyping. That's basically the purpose of the whole Primitives class.

Quote from: OrangyTang on November 13, 2010, 10:03:06 PM
3. Camera.setLookAt seems to not be remembered if I call Camera.setPosition(). I have to re-specify the look at point whenever changing the position. Is this normal? Is there a way around this?
Yes, that's normal. It doesn't lock the view onto something...it just aligns the camera in a way that it looks to a given point. If you move the camera, you have to recall lookAt().

Quote from: OrangyTang on November 13, 2010, 10:03:06 PM
4. The hello world code uses direct calls to LWJGL's Display.isCloseRequested, and there doesn't seem to be any window management. Am I missing something? How do I control the window settings (in both GL and software mode).
I'm not sure what exactly you mean by "window management"...?

OrangyTang

Wow, a 3d engine without ortho support. ??? Is there any chance of adding it? Otherwise it's completely unsuitable for my project and I'll have to look elsewhere (which is a shame, as none of the other 3d engines have software renderers as far as I know).

EgonOlsen

Actually the software renderer is the main reason for not supporting it. To keep it fast, it would require to maintain a complete second set of rasterizers just for ortho mode. Yours is the third request (IIRC) for ortho mode in over 8 years. At least one of them could be solved by going "real" 3D instead, the other one used the software renderer to render images on the server. They solved the issue by using very narrow fov setting, which was fine for their application but isn't suitable for normal games.

So...no, i'm not going to add this feature, i'm afraid. What is your project? Why can't it be done in "real" 3D, which looks far better anyway (just my opinion, of course... ;) )?

OrangyTang

The idea is to write a minecraft map renderer (along the lines of Cartographer and the like), and output tiled images which would then be fed into google maps or OpenLayers to get a nice high-res, explorable map.

Similar to the second example, it'd be for an offline render on a headless server (which may or may not have a proper graphics card, hence wanting a software renderer). So speed isn't an issue, but I think without a proper ortho view transform the map tiles aren't going to join up correctly.

Since I don't care about speed, is there some way to hack it? The Camera seems to basically just be a matrix, can I construct an ortho matrix manually and force the camera to use that somehow? Obviously things like Camera.lookAt would cease to work, but it'd be a heck of a lot easier than writing my own software renderer.

EgonOlsen

That won't work, because the perspective correction when texture mapping will be applied anyway that that simply won't look right when texturing orthogonal projected polygons.