♦ Software multithread raycast realtime renderer of 3D cubic world (demo) ♦
This is basically a Minecraft-esque demo, with source included for you to expand it upto something more interesting.
Imagine a huge empty cube in space, divided into small equal-sized cubes. Each small block may be empty as well, but some are solid, filled with opaque matter (metal, wood, stone, whatever). And you are teleported into the structure, being also the only source of light there. What will you see? When you move, or spin...
Among techniques which may be implemented to render that environment in realtime, raycasting is a prominent one. Raycasting, by the way, is the approach you evidently recall from the forefather of modern 3D games — Wolfenstein 3D, released in 1992 by id Software. You've heard about John Carmack, haven't you?
Since then, the most widely used technique of visualizing 3D worlds is to build them from polygonal models and perform hardware-accelerated rendering. The previous sentence is a banality, such that other approaches like voxels or raycasting/raytracing have fallen into oblivion (we don't mention things like shaders here). But in the cubic world (and in some other regular structures) the raycasting becomes effective enough, especially when parallel calculations are used, meaning we process several rays simultaneously on different CPUs/cores; this follows from the possibility to precalculate some values needed to find the intersection of ray path with the nearest solid block, and the independency of paths for different rays.
And then Minecraft appeared...
Watch this demo to be convinced of a statement... to a degree. Comparing this featureless proof-of-concept to the average industrial-class game of nowadays gives you nothing but disappointment. There are no lights, no shadows, no moving objects... no heartbreaking dramatic story... only dull coloured blocks disappearing into the blackness. Well again, it is up to you to develop this thing further or forget it entirely. Maybe the single reason to publish this is to give you a start point higher than 0.
Curiosity haven't gone yet? Download and unpack. The binary should run fine in Win32; skim Rayder.txt to learn controls. To build the thing from source, you'll need Code::Blocks and Simple DirectMedia Layer (SDL) v2 development files (migrating to other IDE of your choice is not a problem due to the simplicity of the «project»).
Good Luck then...
Copyright © 2014–2018 Sunkware
This site gathers statistics with StatCounter