Saturday, March 29, 2014

Not that I'm working on the old schedule, you understand...


However, I've been itching to do something with a "pseudo 3d road renderer", as described at CodeIncomplete and Lou's Pseudo 3d Page. I played a certain amount of Pole Position, Out Run, and Road Blasters as a youth, and even though I know a photorealistic rendering pipeline pretty well, I kind of like the compromises and hacks that went into making early driving games.

The above is a fairly quick prototype of the sort of thing I have in mind, with trigonometry worked out pretty much by hand, with a little bit of peeking at CodeIncomplete's page, above. My method is to start at the bottom of the screen, and each horizontal pixel ("scanline"), I compute the "world y" position that corresponds to this scanline, and then project the road width into cameraspace, and use that to scale a line of a sprite. I also stretch out a single pixel of that sprite for the grass on the edges of the road. Based on the world y, I choose the light or dark assets, giving that characteristic strobing effect that you see in Out Run. (Also, Buck Rogers: Planet of Zoom.)

I think I want to decrease the contrast between stripes, I want to make the solid yellow and white lines narrower, and I may consider reorganizing my code to be based on "segments", as described in the CodeIncomplete article, rather than scanlines. I may also break the lanes up so that I can have a 3 lane highway, and then a lane disappears, smoothly turning into a 2 lane highway.

There's quite a bit more that I aspire to put into this (hint), but I'll keep most of those cards close to my chest for now.




No comments:

Post a Comment