Ray tracing in Nim on WSL
Created|Updated

https://nim-lang.org/blog/2020/06/30/ray-tracing-in-nim.html
WSL 上のNim 言語でレイトレースしてみました。
環境
- Windows 10 Insider Preview Build 20161
構築
WSL 側
- nim のインストール
$ curl https://nim-lang.org/choosenim/init.sh -sSf | sh
|
$HOME/.profileexport PATH=$HOME/.nimble/bin:$PATH
|
- clang のインストール
利用
Trace of Radiance
https://github.com/mratsim/trace-of-radiance
$ git clone https://github.com/mratsim/trace-of-radiance $ cd trace-of-radiance $ git checkout v0.1.0 $ nim c -d:danger --outdir:build trace_of_radiance.nim $ ./build/trace_of_radiance > image.ppm
|

SmallPT
https://github.com/mratsim/weave/tree/master/demos/raytracing
$ git clone https://github.com/mratsim/weave $ cd weave $ nimble install -y $ nim -v $ nim c -d:danger --threads:on -o:build/ray_threaded demos/raytracing/smallpt.nim $ nim c -d:danger --threads:off -o:build/ray_single demos/raytracing/smallpt.nim $ g++ -O3 -o build/ray_gcc_single demos/raytracing/smallpt.cpp $ g++ -O3 -fopenmp -o build/ray_gcc_omp demos/raytracing/smallpt.cpp $ clang++ -O3 -o build/ray_clang_single demos/raytracing/smallpt.cpp $ clang++ -O3 -fopenmp -o build/ray_clang_omp demos/raytracing/smallpt.cpp $ Then run for 300 samples with: $ build/ray_single 300
|
