A different perspective

I was ill for part of last week, so haven’t made quite the progress on items that I wanted to.  But I’m starting on the work needed for cascaded shadow maps, for really nice full-world shadow support.

The first requirement for this is to be able to render an orthographic projection.

Orthographic projections are actually pretty simple;  they’re a view which has no vanishing point;  objects don’t appear larger as they get closer to the camera, or smaller as they get further away.  Oddly enough, this is the traditional sort of view used for most “tycoon”-genre games.  The screenshot here is of a regular view into the MMORPG game world, taken from an orthographic camera.  And.. I think I kind of like it, once real shadows are in.  I’m starting to think about using this sort of view for general terrain editing and building placement modes, then going down into first-person perspectives for non-editing modes.

Until now, the VectorStorm library had no native support for orthographic views;  you could either render a flat 2D space, or you could render a perspective projection of a 3D space.  I’ve now added support for orthographic views to the vsCamera3D.  There are a whole host of changes under the hood which are needed to make use of this.  But the upside is that you can now ask a vsCamera3D for its projection matrix;  that’s no longer hidden inside the renderer.

To use an orthographic view, set a camera’s projection type to “vsCamera3D::PT_Orthographic”, and set its field of view to the vertical distance you want to be rendering.  The horizontal distance is automatically determined based upon the field of view and the aspect ratio (exactly as we were already doing on the vsCamera2D).

Tomorrow, I’ll be hooking up a couple of shadow map renders to this sort of view.  With any luck, I’ll get all the way through and be able to show demos of proper shadowing.