Skip to the content.

How to create a scene description

This is a guide to write a .TXT file with the instructions of the scene you want to render.

In the examples/render directory, there are some examples to look for inspirations. Here you can have a look to the corrispective results.

🔗 If you desire further information on the meaning of the scene elements and their parameters, look at full descriptions in the complete documentation.

Basic variable definition

Some basic elements are identified as follows:

Note: The reference system is the one depicted in the side image.

🔗 Practical advise: you can find here a quick way to determine the RGB combination for the desired color (credits to professor Maurizio Tomasi (University of Milan)).

How to create a scene

Define the parameters of the observer

Via camera(type, transformation, aspect_ratio, distance), where:

Add some elements to the scene

Note: the PointLight is an element rendered just by the pointlight tracer, other renderers will ignore it.

Define their materials

Before adding elements define their materials:

material material_name(BRDF(pigment), pigment), where:

Note: the image for the image pigment must be in PFM format

Define arbitrary parameters

You can also declare parameters variable_value to use them in the file itself:

Declare floating point parameters from the command line

You may wish to change some floating point parameters directly from the command line. This is possible!

You just need to:

  1. include an identifier variable where it was supposed a floating point number:

camera(perspective, rotation_z(ang) * translation([-1, 0, 1]), 1.333, 1.);

  1. use the right flag in the command line (as exaplained in details here):

./raytracer render <scene_file> --declare_var ang=10.

🤹🏻‍♀️ Now there nothing else to say than.. have fun!