π A small ray tracing engine written in C from scratch... even I can't believe it!!
First of all you must compile the project:
make #basic functionalities
make bonus #advance features such as texture handling and more!For basic operation you must execute: ./miniRT "path_scene" --[options] when compiling with make.
When compiling with make bonus you must execute ./miniRT_bonus "path_scene" --[options].
You can move inside a scene with the following controls:
| Zoom | Translation | Change camera | Rotation |
|---|---|---|---|
| Q : Zoom in | W : Move up | Arrow left : Previous camera | Mouse : Click on the desire direction you want the camera to look at. |
| E : Zoom out | S : Move down | Arrow right : Next camera | |
| A : Move left | |||
| D : Move right |
β οΈ Warning: Since no bounding box or other performance algorithms are implemented movement isn't smooth in most cases since the program ray trace over and over again each frame. The purpose of this implementation was to allow the user to get the desired view quickly
When executing the program you can add some extra flags which will add more value to your scenes such as color filtering, lighting effects or drawing a reference set of axis.
For the standard compilation you can output rendered scenes in a .bmp file. (You can also do this with bonus option)
--save #save rendered scene in a .bmp file. Scene will be output in ./output_bmp folderWhen compiling with the bonusrule you will get a lot more options
--help #invoke help menu inside terminal
--sepia-filter #add a sepia filter to rendered image
--antialiasing #apply aliased effect to rendered image
--no-specular #removes specular light effect which comes from default
--reference-axis #draws a set of global reference axisA scene is the file where all information is readen from. Ambience, light sources, geometries, textures etc. will be defined here and readen by the program. The extension of this file is custom: .rt. This is an example of a scene with a few geomtries. As you can see you will define parameters such as screen resolution, RGB colors, positions and normal vectors:
R 500 500
A 0.3 255,255,255
c -80,0,5 1,0,0 45
c 80,0,5 -1.0,0,0 45
l -40,0,30 0.3 255,0,255
sp 0,0,10 30 255,255,0
cy 0,0,-15 0,0,1 20 17 255,255,255
pl 0,0,-20 0,0,1 255,255,255
tr 0,20,-10 -20,0,-10 10,0,-10 100,255,255
Aside from the standard configuration you can add some extra features which are listed, depending on the element.
Add parallel light following a precise direction:
#Example:
l -20,0,5 0.7 255,255,255 parallel:1,0,0Color disruptions:
All texture/bump images must have
.xpmextension to work.
Handle planar textures:
#Example:
pl 0,0,-30 0,0,1 255,255,255 skybox:textures/skybox.xpmAdd a checkered pattern:
#Example:
pl 0,0,-30 0,0,1 255,255,255 checkeredNormal disruptions
Add a normal disruption damped wave effect:
#Example:
pl 0,0,-30 0,0,1 255,255,255 normal-disruptionHandle bumpmap textures:
#Example:
pl 0,0,-30 0,0,1 255,255,255 bumpmap:texture/example.xpmColor disruptions:
Add a color disruption rainbow effect depending on surface normal:
#Example:
sp 0,0,0 20 255,255,255 rainbowHandle sphere textures:
#Example:
sp 0,0,0 20 255,255,255 uv-map:texture/earth.xpmNormal disruptions:
Add a normal disruption damped wave effect:
#Example:
sp 0,0,-30 0,0,1 255,255,255 normal-disruptionHandle bumpmap textures:
#handle bumpmap textures. Example:
sp 0,0,-30 0,0,1 255,255,255 bumpmap:texture/example.xpmColor disruptions:
Add a color disruption rainbow effect depending on surface normal:
#Example:
cy 0,0,0 20 255,255,255 rainbow-
In order to include these options/effects, you should add one or more of the following flags to the scene config file.
-
Each vector is presented as an example, you can substitute with your own.
-
Each texture/image file is presented as an example, you can substitute with your own. Path must be taken from the root of this proyect.
-
Each geometry can combine one option from each category: color or normal disruption. These options should be written one after oother with one space between each.