Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/pedryx/ray-tracer

Simple ray tracer which has been done as term project for NPGR004 course of MFF UK.
https://github.com/pedryx/ray-tracer

raytracer

Last synced: 16 days ago
JSON representation

Simple ray tracer which has been done as term project for NPGR004 course of MFF UK.

Awesome Lists containing this project

README

        

# Ray Tracer
Simple command line ray tracer.

Creates view into the scene.

## non-mandatory names arguments:
- config - specify path to non-default config file
- graph - specify path to non-default file with graph scene hierarchy

## config file
Default config file is config.xml. It is XML file where you can specify
how output file should look like.

All settings has to be contained in Config node:


...

You can specify name of the output file:

demo.pfm

You can configure various settings:

true
true
true
5
16

You can specify camera settings:



600
450


0.6
0.0
-5.6


0.0
-0.03
1.0


40

You can specify scene settings which will be specified in following block:


...

### Scene settings

You can set color of the background:


0.1
0.2
0.3

You can enable/disable clouds:

true

You can specify light sources, they can be either ambient or point:





1
1
1





1
1
1


-10
8
-6


...

You can specify materials:




yellow

0.1

0.8

0.2
10

1.0
1.0
0.2


0.0

0.5
1.47

...

## graph file
Default graph file is scene.xml. It is XML file where you can specify
composition of scene elements.

It uses tree structure. Whole tree has to be wrapper in root node called
InnerNode:


...

There are two types of nodes inner and leaf. Root inner node is called InnerNode
other inner nodes are caled just Node. In (Inner)Node you can specify following
settings:



...

Red

...

In Transformation section you can specify transformations which will be applied
to whole subtree. Transformation are applied in direction to the root, and from
last to first. Following transformations are supported:


Translate 2 0 10
Scale 0.55
RotateX -0.3
RotateY -0.7
RotateZ -0.4

The Nodes section can contains any number of nodes (either Leaf or Node). In
Leaf node you can specify following settings:



...

In the Shapes section, you can specify shapes, only spheres and planes are
currently supported:




yellow

0
0
0

1


red

0
-1.5
0


0
1
0


...

## example usage:

./RayTracer.exe --config: my_config.xml --graph: my_scene.xml