smallpt global illumination renderer

The place to share and discuss your Ultibo projects.
NoshBar
Posts: 20
Joined: Thu Mar 23, 2017 8:58 pm
Location: Stockholm
Contact:

smallpt global illumination renderer

Postby NoshBar » Wed Nov 08, 2017 8:30 pm

A while ago I felt like learning about global illumination and thought that porting smallpt to pure Pascal would be fun.

The full story is here.
The single-threaded Ultibo source is here.

It really made my RPi2 quite warm, so I ended up using a ghetto fan and heatsink solution on it.

For a while I wasn't clearing the framebuffer cache and was getting the strangest drawing behaviour (the whole image was being drawn correctly, but as if it was doing random segments of the image, even parts it hadn't got to yet - seemingly), it was interesting but not really worthwhile getting into unless you're truly curious.

There's a multi-threaded hack version of this I've made, but needs a bit more work.

Anyway, it's a silly toy, but might be useful for testing... something? Temperature management, power draw, I dunno.

smallpt_25000_big.jpg
smallpt_25000_big.jpg (51.01 KiB) Viewed 824 times
Gavinmc42
Posts: 1508
Joined: Sun Jun 05, 2016 12:38 pm
Location: Brisbane, Australia

Re: smallpt global illumination renderer

Postby Gavinmc42 » Thu Nov 09, 2017 5:39 am

Very cool.
Not sure why but Pi3 version is not working, working on a Zero and Pi2.
Probably SDcard issue?

Anyway, it's a silly toy, but might be useful for testing... something?

Benchtesting, Arm, Arm+SIMD, QPU, NEON etc.

I used Povray to make a 64x64 pixel blimp.
viewtopic.php?f=15&t=631&start=20
This could do it on Ultibo plus various methods for acceleration could be tried.
I have no chance of understanding Povray source, but your's is very clear and small enough I might grasp the concepts and learn the method.

So, thanks you for posting it, I look forward to one day understanding it :oops:
Gavinmc42
Posts: 1508
Joined: Sun Jun 05, 2016 12:38 pm
Location: Brisbane, Australia

Re: smallpt global illumination renderer

Postby Gavinmc42 » Thu Nov 09, 2017 10:55 am

Pi3 works, had a config.txt file set to expect a kernel8.img, simple beginner mistake.
Much faster on a Pi3 :D

Will be interesting to try this in Aarch64/ARMv8 when it is working.
pik33
Posts: 840
Joined: Fri Sep 30, 2016 6:30 pm
Location: Poland
Contact:

Re: smallpt global illumination renderer

Postby pik33 » Thu Nov 09, 2017 12:28 pm

This is a good starting point to have an understandable :) raytracer on RPi/Ultibo. I looked at original C++ source. Most of the C++ code can be moved to fpc with only syntax change to Object Pascal as we have all needed features (operators, overloaded functions etc) used in the original code. Only the multithreading part needs rewriting as we have no such tools as used in the original.
mark
Posts: 1324
Joined: Mon Oct 03, 2016 2:12 am
Location: Indianapolis, US

Re: smallpt global illumination renderer

Postby mark » Fri Jan 11, 2019 8:21 pm

NoshBar wrote:A while ago I felt like learning about global illumination and thought that porting smallpt to pure Pascal would be fun.

The full story is here.
The single-threaded Ultibo source is here.

It really made my RPi2 quite warm, so I ended up using a ghetto fan and heatsink solution on it.

For a while I wasn't clearing the framebuffer cache and was getting the strangest drawing behaviour (the whole image was being drawn correctly, but as if it was doing random segments of the image, even parts it hadn't got to yet - seemingly), it was interesting but not really worthwhile getting into unless you're truly curious.

There's a multi-threaded hack version of this I've made, but needs a bit more work.

Anyway, it's a silly toy, but might be useful for testing... something? Temperature management, power draw, I dunno.

smallpt_25000_big.jpg


https://github.com/noshbar/smallpt-ultibo-single
is now included in https://github.com/markfirmware/ultibo- ... /v20190111

as the kernel named "smallpt"

I changed it from an rpi2 program to an rpi3 program.

Mark

Return to “Projects”

Who is online

Users browsing this forum: No registered users and 1 guest