SkillAgentSearch skills...

Ray

Embeddable physically based renderer

Install / Use

/learn @sergcpp/Ray
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

Ray

CI

Embeddable cross-platform semi-realtime physically based renderer.

Features:

  • Unidirectional pathtracing with light tree NEE and skyportals
  • Diffuse, Glossy, Refractive and multi-layer Principled BSDFs
  • Filmic/AgX tonemapping
  • Built-in procedural sky model
  • Automatic texture compression
  • CPU backend accelerated using SSE/AVX/NEON extensions
  • GPU backends (Vulkan, DirectX 12) with optional HW raytracing
  • DNN denoising (native port of OpenImageDenoise), accelerated using VK_KHR_cooperative_matrix
  • Optional SHARC-like spatial radiance caching
  • Compatible with Windows (including ARM), Linux, and macOS
<details> <summary>Images</summary>
  • Rendered with time limit of 15 seconds on RTX 3080.
  • Links to the original scenes:
    Staircase, Coffee maker - https://benedikt-bitterli.me/resources/
    Italian flat - https://www.blender.org/download/demo-files/
    Sponza - https://www.intel.com/content/www/us/en/developer/topic-technology/graphics-research/samples.html
    Bistro - https://developer.nvidia.com/orca/amazon-lumberyard-bistro
    Ford mustang - https://wirewheelsclub.com/models/1965-ford-mustang-fastback
    Interrior - https://evermotion.org/shop/show_product/scene-6-ai43-archinteriors-for-blender/14569
    Kitchen - https://evermotion.org/shop/show_product/scene-1-ai43-archinteriors-for-blender/14564
    Villa - https://www.blendermarket.com/products/blender-eevee-modern-villa
    Transparent machines - https://www.beeple-crap.com/resources
<div> <div float="left" > <img src="images/scene18.jpg" width="53.6%" /> <img src="images/scene19.jpg" width="35.8%" /> </div> <div float="left" > <img src="images/scene11.jpg" width="44.7%" /> <img src="images/scene12.jpg" width="44.7%" /> </div> <div float="left" > <img src="images/scene6.jpg" width="47.0%" /> <img src="images/scene5.jpg" width="42.4%" /> </div> <div float="left" > <img src="images/scene9.jpg" width="44.7%" /> <img src="images/scene7.jpg" width="44.7%" /> </div> <div float="left" > <img src="images/scene10.jpg" width="46.95%" /> <img src="images/scene8.jpg" width="42.45%" /> </div> <div float="left" > <img src="images/scene13.jpg" width="44.7%" /> <img src="images/scene14.jpg" width="44.7%" /> </div> <div float="left" > <img src="images/scene3.jpg" width="26.55%" /> <img src="images/scene4.jpg" width="62.9%" /> </div> <div float="left" > <img src="images/scene16.jpg" width="60.0%" /> <img src="images/scene1.jpg" width="29.4%" /> </div> <div float="left" > <img src="images/scene2.jpg" width="29.9%" /> <img src="images/scene15.jpg" width="59.5%" /> </div> <div float="left" > <img src="images/scene17.jpg" width="89.8%" /> </div> </div> </details> <details> <summary>Usage</summary>

Installation

The intended use is to add it as a submodule to an existing project:

git submodule add https://github.com/sergcpp/Ray.git

Then in CMakeLists.txt file:

add_subdirectory(Ray)

But also standalone samples can be compiled and run:

Windows

git clone https://github.com/sergcpp/Ray.git
cd Ray
mkdir build && cd build/
cmake ..
msbuild ALL_BUILD.vcxproj /p:Configuration=Release

Linux/MacOS

git clone https://github.com/sergcpp/Ray.git
cd Ray
mkdir build && cd build/
cmake .. -DCMAKE_BUILD_TYPE=Release && make

Usage

Image rendering

#include <Ray/Ray.h>

int main() {
    const int IMG_W = 256, IMG_H = 256;
    const int SAMPLE_COUNT = 64;

    // Initial frame resolution, can be changed later
    Ray::settings_t s;
    s.w = IMG_W;
    s.h = IMG_H;

    // Additional Ray::eRendererType parameter can be passed (Vulkan GPU renderer created by default)
    Ray::RendererBase *renderer = Ray::CreateRenderer(s, &Ray::g_stdout_log);

    // Each renderer has its own storage implementation (RAM, GPU-RAM),
    // so renderer itself should create scene object
    Ray::SceneBase *scene = renderer->CreateScene();

    // Setup environment
    Ray::environment_desc_t env_desc;
    env_desc.env_col[0] = env_desc.env_col[1] = env_desc.env_col[2] = 0.0f;
    scene->SetEnvironment(env_desc);

    // Add diffuse materials
    Ray::shading_node_desc_t mat_desc1;
    mat_desc1.type = Ray::eShadingNode::Diffuse;
    mat_desc1.base_color[0] = 0.5f;
    mat_desc1.base_color[1] = 0.5f;
    mat_desc1.base_color[2] = 0.5f;
    const Ray::MaterialHandle mat1 = scene->AddMaterial(mat_desc1);

    mat_desc1.base_color[0] = 0.5f;
    mat_desc1.base_color[1] = 0.0f;
    mat_desc1.base_color[2] = 0.0f;
    const Ray::MaterialHandle mat2 = scene->AddMaterial(mat_desc1);

    mat_desc1.base_color[0] = 0.0f;
    mat_desc1.base_color[1] = 0.5f;
    mat_desc1.base_color[2] = 0.0f;
    const Ray::MaterialHandle mat3 = scene->AddMaterial(mat_desc1);

    // Add emissive material
    Ray::shading_node_desc_t mat_desc2;
    mat_desc2.type = Ray::eShadingNode::Emissive;
    mat_desc2.strength = 100.0f;
    mat_desc2.base_color[0] = 1.0f;
    mat_desc2.base_color[1] = 1.0f;
    mat_desc2.base_color[2] = 1.0f;
    mat_desc2.importance_sample = true; // Use NEE for this lightsource
    const Ray::MaterialHandle mat4 = scene->AddMaterial(mat_desc2);

    // Setup test mesh
    // position(3 floats), normal(3 floats), tex_coord(2 floats)
    // clang-format off
    const float attrs[] = { // floor
                            0.0f, 0.0f, -0.5592f,           0.0f, 1.0f, 0.0f,                   1.0f, 1.0f,
                            0.0f, 0.0f, 0.0f,               0.0f, 1.0f, 0.0f,                   1.0f, 0.0f,
                            -0.5528f, 0.0f, 0.0f,           0.0f, 1.0f, 0.0f,                   0.0f, 0.0f,
                            -0.5496f, 0.0f, -0.5592f,       0.0f, 1.0f, 0.0f,                   0.0f, 1.0f,
                            // back wall
                            0.0f, 0.0f, -0.5592f,           0.0f, 0.0f, 1.0f,                   0.0f, 0.0f,
                            -0.5496f, 0.0f, -0.5592f,       0.0f, 0.0f, 1.0f,                   0.0f, 0.0f,
                            -0.556f, 0.5488f, -0.5592f,     0.0f, 0.0f, 1.0f,                   0.0f, 0.0f,
                            0.0f, 0.5488f, -0.5592f,        0.0f, 0.0f, 1.0f,                   0.0f, 0.0f,
                            // ceiling
                            -0.556f, 0.5488f, -0.5592f,     0.0f, -1.0f, 0.0f,                  0.0f, 0.0f,
                            0.0f, 0.5488f, -0.5592f,        0.0f, -1.0f, 0.0f,                  0.0f, 0.0f,
                            0.0f, 0.5488f, 0.0f,            0.0f, -1.0f, 0.0f,                  0.0f, 0.0f,
                            -0.556f, 0.5488f, 0.0f,         0.0f, -1.0f, 0.0f,                  0.0f, 0.0f,
                            // left wall
                            -0.5528f, 0.0f, 0.0f,           1.0f, 0.0f, 0.0f,                   0.0f, 0.0f,
                            -0.5496f, 0.0f, -0.5592f,       1.0f, 0.0f, 0.0f,                   0.0f, 0.0f,
                            -0.556f, 0.5488f, 0.0f,         1.0f, 0.0f, 0.0f,                   0.0f, 0.0f,
                            -0.556f, 0.5488f, -0.5592f,     1.0f, 0.0f, 0.0f,                   0.0f, 0.0f,
                            // right wall
                            0.0f, 0.0f, -0.5592f,           -1.0f, 0.0f, 0.0f,                  0.0f, 0.0f,
                            0.0f, 0.0f, 0.0f,               -1.0f, 0.0f, 0.0f,                  0.0f, 0.0f,
                            0.0f, 0.5488f, -0.5592f,        -1.0f, 0.0f, 0.0f,                  0.0f, 0.0f,
                            0.0f, 0.5488f, 0.0f,            -1.0f, 0.0f, 0.0f,                  0.0f, 0.0f,
                            // light
                            -0.213f, 0.5478f, -0.227f,      0.0f, -1.0f, 0.0f,                  0.0f, 0.0f,
                            -0.343f, 0.5478f, -0.227f,      0.0f, -1.0f, 0.0f,                  0.0f, 0.0f,
                            -0.343f, 0.5478f, -0.332f,      0.0f, -1.0f, 0.0f,                  0.0f, 0.0f,
                            -0.213f, 0.5478f, -0.332f,      0.0f, -1.0f, 0.0f,                  0.0f, 0.0f,
                            // short block
                            -0.240464f, 0.0f, -0.271646f,   0.285951942f, 0.0f, -0.958243966,   0.0f, 0.0f,
                            -0.240464f, 0.165f, -0.271646f, 0.285951942f, 0.0f, -0.958243966,   0.0f, 0.0f,
                            -0.082354f, 0.165f, -0.224464f, 0.285951942f, 0.0f, -0.958243966,   0.0f, 0.0f,
                            -0.082354f, 0.0f, -0.224464f,   0.285951942f, 0.0f, -0.958243966,   0.0f, 0.0f,
                            -0.240464f, 0.0, -0.271646f,    -0.958243966f, 0.0f, -0.285951942f, 0.0f, 0.0f,
                            -0.240464f, 0.165f, -0.271646f, -0.958243966f, 0.0f, -0.285951942f, 0.0f, 0.0f,
                            -0.287646f, 0.165f, -0.113536f, -0.958243966f, 0.0f, -0.285951942f, 0.0f, 0.0f,
                            -0.287646f, 0.0f, -0.113536f,   -0.958243966f, 0.0f, -0.285951942f, 0.0f, 0.0f,
                            -0.082354f, 0.0f, -0.224464f,   0.958243966f, 0.0f, 0.285951942f,   0.0f, 0.0f,
                            -0.082354f, 0.165f, -0.224464f, 0.958243966f, 0.0f, 0.285951942f,   0.0f, 0.0f,
                            -0.129536f, 0.165f, -0.066354f, 0.958243966f, 0.0f, 0.285951942f,   0.0f, 0.0f,
                            -0.129536f, 0.0f, -0.066354f,   0.958243966f, 0.0f, 0.285951942f,   0.0f, 0.0f,
                            -0.287646f, 0.0f, -0.113536f,   -0.285951942f, 0.0f, 0.958243966,   0.0f, 0.0f,
                            -0.287646f, 0.165f, -0.113536f, -0.285951942f, 0.0f, 0.958243966,   0.0f

Related Skills

View on GitHub
GitHub Stars504
CategoryDevelopment
Updated2d ago
Forks16

Languages

C++

Security Score

100/100

Audited on Mar 28, 2026

No findings