Skip to content

kebekus/srt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

srt - SIMD Ray Tracing
Written in 2013 by <Ahmet Inan> <xdsopl@googlemail.com>
To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This software is distributed without any warranty.
You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.

uploaded unfinished srt by popular demand.
here some pictures from srt in action:
https://sites.google.com/site/xdsopl/

srt is only meant to be a toy to play around with some ideas and see if it works.

At the moment the "master" branch will give you an realtime SSE SIMD raytracer for algebraic surfaces.
srt uses llvm to JIT compile the entered polynomial to machine code to accelerate the finding of zero crossings for the raytracing process.
It tries to find the zero crossings entirely non-algebraic so it could even work for non-polynomial curves in theory.
The used method is not perfect but gives astonishing results.
More details in "value.c" :)

"voxel" branch is a little and now old experiment on rendering volumetric CT Images and needs some love and caring.

Dependencies:

SDL frontend:
http://www.libsdl.org/
Qt frontend:
https://qt-project.org/

LLVM
http://llvm.org/
CLANG:
http://clang.llvm.org/

Usage:

Keybindings:
"1" - heart curve
"2" - mnm
"3" - torus
"4" - cross
"5" - paraboloid
"6" - cylinder
"7" - cone
"8" - barth sextic
"+" - increment "a" until 1
"-" - decrement "a" until 0
"e" - edit polynomial
	ESC - abort edit
	RETURN - apply polynomial
	LEFT - move cursor left
	RIGHT - move cursor right
	HOME - jump to first char
	END - jump to last char
	DELETE - delete char under cursor
	BACKSPACE - delete char before cursor
	LEFT MOUSE BUTTON - jump to char under mouse pointer
"wsadc" and SPACE - quake like movement of camera
"r" - reset camera view
"b" - toggle between sphere and aabb volume
"q" or ESC - exit srt
"p" - write image to screenshot.ppm
LEFT MOUSE BUTTON - move mouse to rotate camera view
RIGHT MOUSE BUTTON - move mouse to rotate around curve
MIDDLE MOUSE BUTTON - dump curve under mouse pointer to plot.dat for gnuplot

Invoking examples:
# ./srt
# ./srt "x^2 + y^2 - z^2"

Looking at plot.dat using gnuplot:
# gnuplot
gnuplot> plot "plot.dat" u 1:2 w p, "plot.dat" u 1:3 w l

Example curves:

cone:
x^2 + y^2 - z^2

cross:
x*y*z

cylinder:
x^2 + y^2 - 1

heart:
(2*x^2 + y^2 + z^2 - 1)^3 - x^2*z^3/10 - y^2*z^3

mnm:
x^2 + 4 * y^2 + z^2 - 8

paraboloid:
x^2 + y^2 + z - 1

torus:
(x^2 + y^2 + z^2 + 2)^2 - 12*(x^2 + y^2)

sextic:
4*((a*(1+sqrt(5))/2)^2*x^2-1*y^2)*((a*(1+sqrt(5))/2)^2*y^2-1*z^2)*((a*(1+sqrt(5))/2)^2*z^2-1*x^2)-1*(1+2*(a*(1+sqrt(5))/2))*(x^2+y^2+z^2-1*1)^2

Releases

No releases published

Packages

No packages published

Languages