SQL dilində həyata keçirilmiş şüa izləmə sistemi

Aleksey Milovidov, co-founder of the ClickHouse database, with the assistance of the AI assistant Claude, has published a ray tracing system fully implemented in SQL. The rendering with light simulation based on path tracing is realized as a single SQL query without user-defined functions (UDF) and without connecting external code. The ClickHouse database's capability to store query results in PNG format is used for graphics output. The project works properly when run in the ClickHouse database but can operate in CedarDB at a speed 33 times slower, with some errors. The project is distributed under the Creative Commons BY-NC-SA license.

Each pixel is a row in a table, which has columns with coordinates (X, Y) and color representation (R, G, B). The necessary mathematical operations for 3D calculations are built on tuples — a vector is encoded as Tuple(Float64, Float64, Float64).
A loop to model multiple light reflections from surfaces is implemented through the SQL function arrayFold and runs within each row to parallelize rendering. Geometric primitives supported include cylinders, tori, spheres, and oriented parallelepipeds, over which union and difference (intersection removal) operations are performed. The landscape is generated mathematically.

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

Mənbə: opennet.ru

DDoS qoruması olan saytlara etibarlı hosting satın alın, VPS VDS serverlər 🔥 DDoS qoruması olan saytlara etibarlı hosting satın alın, VPS VDS serverlər | ProHoster