A SQL nyelvben megvalósított sugárkövetési rendszer

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

Each pixel represents a row in a table, which has columns for coordinates (X, Y) and color representation (R, G, B). The mathematical operations needed for 3D calculations are built on tuples — a vector is encoded as Tuple(Float64, Float64, Float64).
The loop for simulating multiple reflections of light from surfaces is implemented through the SQL function arrayFold and is executed within each row for parallel rendering. Supported geometric primitives include cylinders, tori, spheres, and oriented parallelepipeds, on which union and difference (intersection removal) operations are performed. The landscape is generated mathematically.

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

Forrás: opennet.ru

Megbízható hosting vásárlása weboldalak számára, DDoS védelemmel, VPS VDS szerverek. 🔥 Megbízható webtárhely vásárlása DDoS védelemmel, VPS VDS szerverek | ProHoster