1- ![ ] ( docs/Images/Demo/default.png )
1+ # Simple ray tracer for pixel-themed scenes and animations
22
3- > More demo images can be found [ here] ( docs/Images/Demo/ )
3+ | ![ ] ( docs/Images/Demo/default.png ) |
4+ | :--:|
5+ | Static base scene|
6+
7+
8+ | ![ ] ( docs/Images/defaultGif.gif ) |
9+ | :--:|
10+ | Animation from base scene|
11+
12+ > More static demo images can be found [ here] ( docs/Images/Demo/ )
413
514## Table of contents
615
716- [ <u >How to use</u >] ( #how-to-use )
817- [ <u >Scene</u >] ( #scene )
18+ - [ <u >Scripting</u >] ( #scripting )
919- [ <u >Pixel-look</u >] ( #pixel-look )
1020- [ <u >Building from source</u >] ( #building-from-source )
1121- [ <u >Running tests</u >] ( #running-tests )
1424
1525## How to use
1626
27+ ** Executables for Windows** (and probably Linux-x64) will be added soon. Otherwise you need to
28+ [ build from source] ( #building-from-source ) .
29+
1730To produce an output image, paths for scene and output files are required:
1831
1932``` bash
@@ -27,6 +40,7 @@ call default image opener program via shell execution:
2740PixelRay -i scene.json -o output.png -p
2841```
2942
43+ To avoid file path issues, just keep scene (and script) file in the same directory with executable
3044
3145#### All commands
3246
@@ -36,11 +50,30 @@ PixelRay -i scene.json -o output.png -p
3650
3751- ` -o <path> ` or ` --output <path> `
3852
39- Output file path. Image format is either ** png** or ** ppm** -
53+ Output file path. Image format is either ** . png** or ** . ppm** .
4054- ` -p ` or ` --preview ` :
4155
4256 Attempts to open the output image after rendering by executing the image file, thus calling the default viewing
4357 tool in process. Only available for png images as basic editors seldom support ppm.
58+
59+ - ` -s <luaScript> <frameCount> {gif} ` or ` --script <luaScript> <frameCount> {gif} `
60+
61+ Uses the static scene from ` -i ` command as a baseline then runs Lua script to produce output frames into
62+ ` ./frames ` directory. Output format is always ** png** , frame count defaults to 60 if frameCount is not a valid integer value.
63+ - script file uses Lua language and must there end in .lua
64+ - cannot be used with output or preview flags
65+ - automatically flushes ` frames ` directory to remove old images
66+ - can optionally pass ` -g ` / ` --gif ` flag to produce a GIF file from saved frames.
67+
68+ Example:
69+
70+ ``` bash
71+ PixelRay -i scene.json -s script.lua 30 -g
72+ ```
73+
74+ produces files frame0.png to frame29.png in ` ./frames` and
75+ then combines these into a gif file as ` outputGif.gif`
76+
4477- ` --debug < mode> `
4578
4679 Renders image based on selected debug mode. These are:
@@ -54,11 +87,25 @@ PixelRay -i scene.json -o output.png -p
5487
5588## Scene
5689
90+ > Scene file and animation script templates can be found in [here](scene-template).
91+
5792Scenes use **json** format.
58- Default scene file can be found [ here] ( docs/scene.json ) .
5993
6094For all scene parameters and their explanations, see [Scene.md](docs/Scene.md)
6195
96+ ### Scripting
97+
98+ Scripts use [Lua programming language](https://www.lua.org/start.html) embedded into C#
99+ via [MoonSharp](https://github.com/moonsharp-devs/moonsharp).
100+
101+ Scripting can be applied to
102+
103+ - object transforms (translation/positioning, scaling, rotations)
104+ - camera (position, forward/upward direction, fov, aspect ratio)
105+
106+ For scripting API, see [Lua.md](docs/Lua.md)
107+
108+
62109## Pixel-look
63110
64111To enforce pixelated theme:
@@ -79,8 +126,11 @@ To enforce pixelated theme:
79126
80127# # Building from source
81128
82- ` SixLabors.ImageSharp ` is the only required third-party package
83- and happens to be well-supported on both Linux and macOS. It's used for producing output images in PNG format
129+ Both third-party packages
130+ - ` SixLabors.ImageSharp` for png and gif generation
131+ - ` MoonSharp` for Lua scripting support
132+
133+ are be well-supported on Windows, Linux and macOS.
84134
85135---
86136
@@ -93,9 +143,9 @@ Build command for .NET is
93143> dotnet publish -c Release -r \< rid\> \< args\>
94144
95145There are generally two ways to build into an executable:
96- 1 . Self-contained exe. This dll is SILK.NET native dependency and needs be included
97- - larger executable (~ 37 MB on Windows, ~ 39 MB on Ubuntu) but runs on its own, no .NET runtime installation
98- required for end user
146+ 1. Self-contained executable
147+ - larger size (~37 MB on Windows, ~ 39 MB on Ubuntu) but runs on its own, no .NET runtime installation
148+ required from end user
991492. minimal exe + DLLs
100150 - very small, but end user must have ** .NET 10.0 Runtime** installed
101151
@@ -161,18 +211,28 @@ copy-pasting all the colors)
161211- maybe depth of field/blur in some form
162212- materials/mediums: glass, matte, lambertian, fog/gas
163213 - maybe also simplistic emissive materials
164- - objects :
214+ - geometry :
165215 - simple meshes for custom shapes. Also some kind of preview tool could be useful
166216 - maybe some new primitives
167217 - maybe new transforms like shear
218+ - shared materials (and meshes): current system adds materials in each object, prevent reusing them
168219- performance
169220 - at least BHV when meshes get added
170221 - otherwise some smaller optimizations here and there
171- - scripting support via Lua language (complex scenes + animations )
172- - more unit tests + maybe a few integration tests
222+ - scipting: add lights (transforms and camera controls already there )
223+ - more tests
173224
174225# ### Priority
175- 1. Lua scripting support
226+ 1. light manipulation in scripts
1762272. meshes + BHV
1772283. new materials/mediums
178- 4. the rest
229+ 4. shared materials and meshes
230+ 4. the rest
231+
232+
233+ TODO:
234+
235+ - scripting: custom frame count
236+ - Lua: add light support
237+ - make a basic animation, add it into scene (along with scene.json)
238+ - update README: add Scripting section
0 commit comments