Skip to content

Commit 397b361

Browse files
committed
initial commit of a GPU ray tracer
0 parents  commit 397b361

11 files changed

+1308
-0
lines changed

.gitignore

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.settings/
2+
build/
3+
classes/
4+
output*.png
5+
video*.yuv
6+
video*.webm
7+
raytrace-opencl.jar

LICENSE

+621
Large diffs are not rendered by default.

README.md

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
raytrace-opencl
2+
=========
3+
4+
Ray traces incredibly fast using your GPU (opencl)
5+
6+
7+
Future development
8+
=========
9+
10+
Right now the scene (animated and still) is hard-coded.
11+
Right now it only supports one opencl device.
12+
Right now it defaults to using your first opencl device.
13+
14+
Building
15+
=========
16+
17+
Make sure ant is installed.
18+
19+
Run: ant
20+
21+
Running
22+
=========
23+
24+
./raytrace-opencl
25+
26+
Takes three seconds to run on my computer: NVIDIA desktop graphics card.
27+
28+
Animations
29+
=========
30+
31+
./raytrace-animation
32+
./video
33+
34+
License
35+
=========
36+
37+
See LICENSE
38+
39+
Depends on JOCL (see jocl-license.txt).
40+
41+
August 2013
42+
Adrian Porter
43+

build.xml

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<project name="raytrace-opencl" default="build" basedir=".">
4+
5+
<path id="cp">
6+
<fileset dir="libs">
7+
<include name="*.jar"/>
8+
</fileset>
9+
</path>
10+
11+
<property name="classes.dir" value="classes"/>
12+
<property name="src.dir" value="src"/>
13+
<property name="jar" value="${ant.project.name}.jar"/>
14+
15+
<target name="init">
16+
</target>
17+
18+
<target name="build" depends="init">
19+
<mkdir dir="${classes.dir}"/>
20+
<javac srcdir="${src.dir}" destdir="${classes.dir}" classpathref="cp" />
21+
<jar jarfile="${jar}" compress="true">
22+
<fileset dir="${classes.dir}"/>
23+
<manifest>
24+
<attribute name="Main-Class" value="org.raytrace.RaytraceOpencl" />
25+
<attribute name="Class-Path" value="libs/JOCL-0.1.9.jar" />
26+
</manifest>
27+
</jar>
28+
</target>
29+
30+
<target name="clean">
31+
<delete dir="${classes.dir}"/>
32+
<delete file="${jar}"/>
33+
</target>
34+
35+
</project>
36+

jocl-license.txt

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
JOCL - Java bindings for OpenCL
2+
3+
Copyright (c) 2009-2013 Marco Hutter - http://www.jocl.org
4+
5+
Permission is hereby granted, free of charge, to any person
6+
obtaining a copy of this software and associated documentation
7+
files (the "Software"), to deal in the Software without
8+
restriction, including without limitation the rights to use,
9+
copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
copies of the Software, and to permit persons to whom the
11+
Software is furnished to do so, subject to the following
12+
conditions:
13+
14+
The above copyright notice and this permission notice shall be
15+
included in all copies or substantial portions of the Software.
16+
17+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
19+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
21+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
22+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24+
OTHER DEALINGS IN THE SOFTWARE.

libs/JOCL-0.1.9.jar

776 KB
Binary file not shown.

raytrace-animation

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
3+
renice +20 -p $$ >/dev/null
4+
5+
for((i=0;i<1000;i++)); do
6+
echo $fname
7+
fname=$(printf output%04d.png $i)
8+
if [[ ! -e $fname ]]; then
9+
./raytrace-opencl $fname $i $@
10+
fi
11+
done

raytrace-opencl

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
3+
java='java -Xms1G -Xmx2G -jar raytrace-opencl.jar'
4+
5+
$java $@

0 commit comments

Comments
 (0)