Home
Admin | Edit

Computer graphics tricks

This page is a memo of programming / rendering tricks mostly focused on early computer graphics tricks / algorithms and effects used in demos.

The intensive is not to produce a list of existing methods but mostly act as a memo so it is a bit unorganized and contains a mix of ideas and actual verified tricks. The goal is to produce a prototype or an intro one day... and maybe a blog article.

Ray-casting

3D "polys" rasterizer ?

Ray-casting was a popular technique in early 90s to provide 3D looking environments on not so fast hardware without going with a polygons rasterizer, it is a specialized form of ray-tracing so you constrain freedom to make it fast to render, the first games were doing it horizontal so you had an environment made of walls (textured vertical strips), further games combined it with a bit more advanced ray-casting ("floor casting") which provided textured floors.

An idea i have since some times now is to provide more freedom than usual by combining horizontal ray-casting with standard ray-casting and adding rotation to both to produce rich 3D environments which would looks like 3D as seen with conventional polygons rasterizer + texture mapping but using ray-caster tricks, the example i think off is a cube with sides made of portions of ray-casted planes so the idea is really to compose floors or walls as seen in these old ray-casting games to build 3D objects, it would probably be a bit trickier to compose 3D worlds with this compared to polygon rasterizer and a bit more limited in type of objects, it would perhaps be 5-DOF instead of 6.

Note : Implemented the idea and it works for a simple cube although right now it is more like a forward mapper / equiangular quads renderer (constrained "floor casting" if you will), i have a 5-DOF and a 6-DOF version, i don't know about the efficiency as it iterate on texture space so quite dependent on texture size and there may be a lot of overdraw, a renderer likes this may be perhaps advantageous sometimes (e.g. 2x less polygons vs a triangles rasterizer for some situations, linear texture fetch), the 5-DOF version can be made quite fast even with overdraw, it is also very simple implementation wise so perhaps suitable for code-golfing.

This sort of rendering was used on Panasonic 3DO and Sega Saturn with slightly different approach, an advanced implementation supporting curved geometry was also used by the Nvidia NV1.

equiangular quads rasterizer; texture from Wolfenstein 3D

note the slight texture distortion on the right face (curved diagonals) due to bi-linear interpolation

Platform games

Ok so another idea is doing platform games or mode 7 effects with the above method (or floor casting), immediate game i am thinking is Arcturus, a tiled floor casting is actually quite fast when a fixed pitch is implemented, just standard arithmetic and fetch / copy operations. A platform game could be implemented by skipping rendering on some tiles or some pixels which would also makes the whole algorithm quite fast since many pixels would be skipped.

Another game that i thought was doing that at first was The Adventure of Jimmy Neutron Boy Genius vs Jimmy Negatron on Game Boy Advance but then i remembered that GBA had mode 7 (affine transform + perspective done with line interrupts) for doing things like this so it is probably mode 7 but again could be doable with a quads renderer such as one mentioned above.

Feedback / Recursion

Cheap impressive 3D effects for 80s hardware ?

Take a look at this impressive 256 bytes intro for the Atari ST computer, this looks like an effect of the 90s era pulled off on 1985 home hardware (it is real-time and fast), the trick is actually easy if you remember video feedback and has tiny technical cost, generating a checkered texture and then doing fast copy operations multiple times (and mixing it with whatever is on screen) to pull off the feedback effect.

Palette

Pre-computed 3D looping images

Iridion 3D (Game Boy Advance game) always impressed me for its pre-computed looping 3D background animations, it was not unusual in early 90s to do pre-computed 3D elements in 2D games but this game push it a little further with impressive uses of 3D background environments, a great idea since it has very little technical cost, mostly just a case of doing fast memory copy operations and maybe compression / stream issues to hold the animations in RAM, an easy task if the CPU support fast blocks copy operations (or hardware blitter) which is the case of ARM CPU.

There is some games on old school hardware that also use this trick, such as the tunnel level of Stardust. (1995, Atari STE)

Now i can think off many ideas to improve that at little cost on hardware supporting colors palette or features such as scrolling :
  • encoding details in colors for animations or showing different texture as the background animate so it would looks like a dynamic environment instead of a static one (add richness), maybe one could push smooth transition between levels etc. or modifying the geometry of the background by completely showing off different details (and usage of scrolling could also help to pull off this) so it would really looks like a 3D game at first sight instead of a bunch of looping 3D backgrounds. An impressive advanced example of palette colors cycling and amazing pixels art is Mark Ferrari colors cycling animations, he encode a lot of information that makes the art animated.
  • i wonder what could be done if you combine this method with tiles and raster distortions (HBL trick), perhaps whole levels looking like 3D environments could be done that way.

back to topLicence Creative Commons