System śledzenia promieni, zaimplementowany w języku SQL

Aleksey Milovidov, co-founder of the ClickHouse DBMS, with the help of the AI assistant Claude, published a ray tracing system entirely implemented in SQL. The rendering with light simulation based on ray tracing is executed as a single SQL query without user-defined functions (UDF) and external code connections. ClickHouse's ability to save query results in PNG format is used for graphic output. The project works well when run in ClickHouse but may encounter some errors and operates 33 times slower in CedarDB. The project is distributed under the Creative Commons BY-NC-SA license.

Each pixel corresponds to a row in a table that contains columns for coordinates (X, Y) and color representation (R, G, B). The mathematical operations necessary for 3D calculations are based on tuples — a vector is encoded as Tuple(Float64, Float64, Float64).
The cycle for simulating multiple light reflections from surfaces is implemented through the SQL function arrayFold and runs within each row to parallelize rendering. Supported geometric primitives include cylinders, tori, spheres, and oriented parallelepipeds, on which union and difference (removal of intersections) operations are performed. The landscape is generated mathematically.

Previously, the developers of the ClickHouse DBMS prepared a SQL-based Doom-like game, a RISC-V emulator, and a music synthesizer.

Źródło: opennet.ru

Kup solidny hosting stron z ochroną przed DDoS, serwery VPS VDS 🔥 Kup solidny hosting stron z ochroną przed DDoS, serwery VPS VDS | ProHoster