viewport question

I find it difficult to put this question into words seeing how much I suck at math etc, but here it goes:

I’d like to change the view frustum as such that the center is no longer in the middle of the screen, but without rotating the camera.
Just shifting the viewport down a bit so that quads on the Z-plane still face the camera without an angle.
I suppose that means ‘skewing’ the view frustum so to speak.

Just translate the matrix along the y axis using glTranslatef() or whatever other method you use.

doesn’t that just move the camera instead of skewing the frustum?

Try it. If it doesn’t work, could you please give a better explanation of the effect you want.

Stereoscopic projections skew the frustum to the left and right. You could take a look at how those are set up and just tweak the equations to skew on the Y axis instead of X (or just use them as-is and rotate your whole scene).

I believe that’s only necessary when doing stereo though. If you just have the one camera, the effect should be identical to just translating.

Thanks spoingie, I’ll look into that.

HeroesGraveDev, to explain it better:

Instead of this:

http://www.wictos.nl/gaga/from.jpg

I want this:

http://www.wictos.nl/gaga/to.jpg

If I translate down, the point where the road goes to infinity is still in the middle; the camera is just lower to the ground.
It’s also not just rotating down because the purple square you see still faces the viewport without an angle.

I’d translate the projection matrix, then, not the modelview matrix.

But that still just moves the camera, doesn’t it?
I’ve tried this but it’s not what I’m looking for: The point of infinity along the Z-axis is still in the center of the screen while I’d like it more to the top.

Anyway, I was able to sort of get what I need by overriding libgdx’s PerspectiveCamera.apply(), and put a glFrustumf() call in there for GL_PROJECTION (ignoring the projection matrix in the Camera class altogether).
It’s a bit dirty, and I suppose it would be much better to understand how to change the projection matrix to get the same effect, but I’ll try to figure it out somehow.

Sounds like you want to tilt the view so you’re facing up a little rather than horizontal?

Actually in my screenshot in the WIP section the view is still simply tilted down slightly, but that has problems with the alpha particles on the X/Y plane that then also appear slightly tilted, which looks a bit unnatural imho (which is especially apparent when the fov increases when you speed up).

Another solution would of course be to rotate the camera down and tilt those particles back up towards the screen, but I had the idea that not rotating but just moving the vanishing point slightly upwards would be easier and look a bit better (especially in cases where opaque elements and blended elements would collide because of the tilted blended elements).

Here’s a screenshot of how I did it now:

http://www.wictos.nl/gaga/skew.jpg

quite happy with the result now; imho it looks better than slightly tilting down the camera