Raytracer implemented via sql statement

Tips, trick's, and links about computer graphics world

Moderator: joepal

Raytracer implemented via sql statement

Postby joepal » Sat Oct 12, 2019 9:54 am

http://www.pouet.net/prod.php?which=83222

Some people have too much time on their hands...

...

"This is a raytracing engine contained in a single Mysql SELECT statement. In the beginning of the code there are a few parameters that can be modified. The scene can be specified using the @triangles and @squares parameters, but everything is explained in the comments. The whole query returns a bitmap file which can be written to the filesystem using the "INTO DUMPFILE" syntax at the end of the query, if mysql has filesystem write permissions.

The raytracer supports shadows and reflections, which makes it, to my knowledge, the most advanced MySQL raytracer on the market right now. However, it is not really polished and kinda slow. Since I didn't really know how to present this work in a demoparty friendly way, I just included two finished renderings.

Contained files:

sqlray.sql - Contains the code and a standard box scene with a few spheres

sqlray-bunny.sql - Contains the code and a scene with the stanford bunny model, about 950 polygons.

sqlray.bmp - Contains the output of the query in sqlray.txt. With a resolution of 1920x1080, this image took about 10 minutes to render on a Xeon E3-1246.

sqlray-bunny.bmp - Contains the output of the query in sqlray-bunny.txt. With a resolution of 200x200, this image only took about 2 hours to render on a Xeon E3-1246.

Requirements:

To run this code, you need a running mysql-server to execute the query. The code is only tested on mysql version 5.7.22 running on Ubuntu 16.04. MySQL also needs file write permissions to write the bmp file to the filesystem.

If you want to render more than a few pixels worth you usually also have to increase mysql's memory and execution time limit settings.

Released under the do whatever the fuck you want license. If you use it for commercial purposes, like rendering your Hollywood studio's new big animated A-Movie, please let me know at holtsetio@gmail.com."
Joel Palmius (LinkedIn)
MakeHuman Infrastructure Manager
http://www.palmius.com/joel
joepal
 
Posts: 4465
Joined: Wed Jun 04, 2008 11:20 am

Return to Off topic

Who is online

Users browsing this forum: No registered users and 1 guest