|||| 8 - 15 nov 2014 ||||
7DFPS ...
by whitingjp | submitted for 7dfps |



Tag line
(tech demo)

Download links (see about for more)
This is not a game (yet). This is a quick tech demo, started as some muddling for #7hfps and then advanced somewhat in the scant spare hours I could find during #7dfps. I have some plans on how I want to turn this into a real (small) game, and still intend to do so in the near future. I do think what I do have already is actually kinda interesting, hence sharing it in case anyone is curious. So, this is a real time ray-tracer; the ray-tracing code was written from scratch in straight C. Ray-tracing is super cpu expensive, which is why this runs at such a tiny (64x64 pixels) resolution. This is why real time ray-tracing is pretty uncommon! Ray-tracing does however make certain visual things really quite easy, like reflection, and infinitely smooth surfaces. So I'm using those things a fair bit. The coloring restrictions are purely aesthetic, I could use many more colors very easily, but I prefer this. There's not much to see, but what's there is shiny. WSAD or Arrow keys to move, mouse looks. If you're feeling particularly enthusiastic, have a play with the in-engine level editing. Shonky control scheme: Tab - Toggle Edit mode Q - Float up E - Float down Left Mouse - Move shape with mouse Right Mouse - Resize shape with mouse Middle Mouse - Select shape under cursor Shift - Move/resize vertically instead of horizontally R - Edit reflectivity (horizontal) and luminosity (vertical) of selected shape C - Create new shape 1 - Set shape to box 2 - Set shape to cylinder 3 - Set shape to sphere 4 - Set shape to 'start point' (only use one) V - Duplicate selected shape X - Delete selected shape F - Save level (will save to the same .lvl file in data that is loaded at startup) Anyway, hope that was worth it, follow me on twitter ( @whitingjp ) or check my website ( http://jonathanwhiting.com ) and I'm sure you'll find out when I release an actual game from this stuff. Cheers, Jonathan Whiting
liked by netgrind
netgrind says...
That was sick looking. Do you have any info about how you did this (by yourself or resources you came across in dev) Trying to wrap my head around infinitely smooth reflections and it is starting to hurt a little.
whitingjp says...
Well, technically the smoothness isn't really infinite, but it's limited only by the precision of the floating point numbers involved, rather than, say a limited number of surfaces. It's smoother than we could ever care about at a 64x64 resolution! So, typical rasterizing 3d is all about drawing triangles quickly, and using clever tricks/transformations to draw the right triangles in the right places/colors/order. This (and ray-tracing in general) is an entirely different way of doing 3d rendering. A 'ray' is fired from each point in the camera view, and collision detection style methods are used to detect if an object can be seen at that point or not. This is a similar technique to Wolfenstien style 3d, but the trace occurs in 3 dimensions instead of 2. Reflections are calculated by bouncing that ray when collision occurs, and performing another set of collision detections. I add these reflections together to get a single value for pixel strength. This process is computationally expensive because this means doing up to xRes*yRes*numShapes*numReflections intersection tests per frame, so roughly 64*64*256*3=3145728 which is quite a lot! The colouring is essentially a post processing step, I take the single strength value and map that into a more limited (but imho more exciting) colourspace. There is also some bloom-style post-processing going on, to give the brighter colours more emphasis. There are quite a lot of resources on ray-tracing as a technique online, I referenced a bunch of things to get my ray->cylinder and ray->sphere collision detection down, and also to figure out the correct direction to be firing rays etc. I've not found a good overall reference I can point you at. Nowadays ray-tracing is mostly used at higher resolutions, and much slower speeds to make nice expensive renders.
7DFPS brought to you by Sven Bergstrom & Sos Sosowski & Jan Willem Nijman | Logo by Cactus Follow news and info about 7DFPS on twitter Games hosted on itch.io