Back in the train, so back to fixing stuff. I was busy with the perspective projection. I managed to find several weird details in the code. Like adding the position of an entity twice. Once just as a raw value and once converted from meters to pixels. Resulting in a weird gap between tiles.

You can probably imagine how relieved I was that it was such a minor thing. But that also set me up to fix the depth and parallax effect. Because it turned out I simply forgot to set the depth on the entity transform. I was passing the depth to every PushBitmap and PushRectangle function. So I didn’t think about needing to set it on the entityTransform. That was just me forgetting I implemented that haha.

Now the PushBitmap call simply sets it and suddenly everything works. The tree parts are now sliding past each other, looking like an actual parallax effect. So I decided to make a tree entity, so I can more easily place them around. The game now includes two trees, with shadows, that have some parallaxing applied to them.

Maybe the next thing I try is the depth of field. I think this game will greatly benefit from proper depth of field. Creating a sort of macro effect, that it looks like you are playing with pixelated toy cars. However it should work on all platforms. Which in my head means the game should be able to run on Nintendo 3DS. So I am trying to come up with a good way of doing depth of field without requiring shader magic. And currently that seems to mean, just render the game a bunch of times from different point of views.

On my way back home I looked into stereoscopic rendering. It doesn’t really work yet and the main reason for it is the projection itself. The bitmaps are projected and then stored in the render commands buffer. However to make the renderer really able to do the things I want with stereoscopic rendering, I have to separate the camera from it. So instead I can store the unprojected position together with their depth value.

When I then process the render commands, I can project the bitmaps at that point. But that enables me to project them in multiple was. Once for the left eye and once for the right eye. Resulting in a stereoscopic image.

I think that is what I will be looking into tomorrow then. Though I do expect some difficulties, because I can’t tilt the camera currently. Which may be needed for depth of field and proper stereoscopic rendering. Because also the depth of field technique I want to try would be using multiple cameras.

Last modified: March 9, 2023