Sandbox for graphics paper implementation

Overview

Graphics Experiments

適当にグラフィックス関連の論文などを読んで実装・検証したものを置きます。

I'll randomly put something for implementing/validating graphics papers here.

実装 / Implementations

ReSTIR

Spatiotemporal reservoir resampling for real-time ray tracing with dynamic direct lighting
https://research.nvidia.com/publication/2020-07_Spatiotemporal-reservoir-resampling

example

その他 / Miscellaneous

OptiX/CUDAのラッパーとしてOptiX Utilityを使用しています。

Programs here use OptiX Utility as OptiX/CUDA wrapper.

動作環境 / Confirmed Environment

現状以下の環境で動作を確認しています。
I've confirmed that the program runs correctly in the following environment.

  • Windows 10 (21H1) & Visual Studio Community 2019 (16.10.4)
  • Core i9-9900K, 32GB, RTX 3080 10GB
  • NVIDIA Driver 471.41

動作させるにあたっては以下のライブラリが必要です。
It requires the following libraries.

  • CUDA 11.3 Update 1
    OptiX Utilityは少し古いバージョンでも動作するとは思います。単にサンプルコードがこのバージョンに依存しているだけです。
    ※CUDA 11.3.0にはバグがあり、OptiX Utilityと一緒に使用することができません。Update 1以降が必要です。
    OptiX Utility may work with a bit older versions. The sample code just assumes this version.
    * CUDA 11.3.0 has a bug which prevents to use it with OptiX Utility. You need to use Update 1 or later.
  • OptiX 7.3.0 (requires Maxwell or later generation NVIDIA GPU)

2021 @Shocker_0x15

Issues
  • Question about Neural Radiance Cache

    Question about Neural Radiance Cache

    Thanks for your implementation of this algorithm!

    Beginner's question: I am trying to understand the training part of the NRC algorithm. I have read the paper several times and it's still not clear to me.

    Say, you have a path x0 x1 x2 (x0 - camera, x1 - surface, x2 - surface). How do you train the cache?

    1. Do you explicitly sample lights at each intermediate vertex, to get paths x0 x1 l2 (where l2 is now vertex on a light source) and x0 x1 x2 l3 and then put end vertices (in this case x1, and x2) and direction (x2 -> x1, and x1 -> x0) into cache?
    2. How does the "path extension" work?
    3. There was an issue with "flickering" that was solved by temporal smoothing. How do you solve this problem?
    opened by ib00 8
  • bug in createGeometryInstance()

    bug in createGeometryInstance()

    Howdy,

    Thanks for making these interesting experiments available! Will you be making a license file for this project?

    I think I found a bug in createGeometryInstance() starting on line 1599 of common_host.cpp where the aabb is being created.

    for (int triIdx = 0; triIdx < triangles.size(); ++triIdx) {
            const shared::Triangle &tri = triangles[triIdx];
            const shared::Vertex (&vs)[3] = {
                vertices[tri.index0],
                vertices[tri.index1],
                vertices[tri.index2],
            };
            geomInst->aabb
                .unify(vertices[0].position)
                .unify(vertices[1].position)
                .unify(vertices[2].position);
        }
    

    I think the correct code should be:

    geomInst->aabb
                .unify(vs[0].position)
                .unify(vs[1].position)
                .unify(vs[2].position)
    
    opened by Hurleyworks 3
  • Materials do not re-use textures leading to duplicate textures in memory.

    Materials do not re-use textures leading to duplicate textures in memory.

    Hi,

    When using a scene such as lost-empire I get the following error : Error: CUDA call (cuArray3DCreate(&m_array, &arrayDesc) ) failed with error: 'out of memory' (C:\Users\X\Documents\Shocker\GfxExp\utils\cuda_util.cpp:693). I think what is happening is that for every material in the mtl file the map_Ka and map_Kd attributes are loaded into memory even if those same textures have been loaded into memory already for another material. This is confirmed by the console output:

    
    [ 4][  DISK CACHE]: Opened database: "C:\Users\X\AppData\Local\NVIDIA\OptixCache\optix7cache.db"
    [ 4][  DISK CACHE]:     Cache data size: "1.8 MiB"
    [ 4][   DISKCACHE]: Cache hit for key: ptx-538030-keyf4770f7ee17acca7955c0792d6c5b076-sm_61-rtc0-drv496.76
    [ 4][COMPILE FEEDBACK]:
    [ 4][   DISKCACHE]: Cache hit for key: ptx-40534-keyf6edc5a05105d08ef92e4c8cff25c7c6-sm_61-rtc0-drv496.76
    [ 4][COMPILE FEEDBACK]:
    [ 4][COMPILE FEEDBACK]: Info: Pipeline has 1 module(s), 35 entry function(s), 32 trace call(s), 0 continuation callable call(s), 54 direct callable call(s), 707 basic block(s) in entry functions, 19309 instruction(s) in entry functions, 0 non-entry function(s), 0 basic block(s) in non-entry functions, 0 instruction(s) in non-entry functions
    
    Reading: ../scenes/lost-empire/lost_empire.obj ... done.
    DefaultMaterial:
    Stone:
      Reading: ../scenes/lost-empire/lost_empire-RGB.png ... done.
    Grass_Block:
      Reading: ../scenes/lost-empire/lost_empire-RGB.png ... done.
    Dirt:
      Reading: ../scenes/lost-empire/lost_empire-RGB.png ... done.
    Cobblestone:
      Reading: ../scenes/lost-empire/lost_empire-RGB.png ... done.
    Oak_Planks:
      Reading: ../scenes/lost-empire/lost_empire-RGB.png ... done.
    Stationary_Water:
      Reading: ../scenes/lost-empire/lost_empire-RGBA.png ... done.
    Stationary_Lava:
      Reading: ../scenes/lost-empire/lost_empire-RGB.png ... done.
      Reading: ../scenes/lost-empire/lost_empire-RGB.png ... done.
    Sand:
      Reading: ../scenes/lost-empire/lost_empire-RGB.png ... done.
    Gravel:
      Reading: ../scenes/lost-empire/lost_empire-RGB.png ... done.
    Iron_Ore:
      Reading: ../scenes/lost-empire/lost_empire-RGB.png ... done.
    Coal_Ore:
      Reading: ../scenes/lost-empire/lost_empire-RGB.png ... done.
    Oak_Log:
      Reading: ../scenes/lost-empire/lost_empire-RGB.png ... done.
    Oak_Leaves:
      Reading: ../scenes/lost-empire/lost_empire-RGBA.png ... done.
    Bed:
      Reading: ../scenes/lost-empire/lost_empire-RGBA.png ... done.
    Powered_Rail:
      Reading: ../scenes/lost-empire/lost_empire-RGBA.png ... done.
    Detector_Rail:
      Reading: ../scenes/lost-empire/lost_empire-RGBA.png ... done.
    Sticky_Piston:
      Reading: ../scenes/lost-empire/lost_empire-RGB.png ... done.
    Wool:
      Reading: ../scenes/lost-empire/lost_empire-RGB.png ... done.
    Dandelion:
      Reading: ../scenes/lost-empire/lost_empire-RGBA.png ... done.
    Poppy:
      Reading: ../scenes/lost-empire/lost_empire-RGBA.png ... done.
    Brown_Mushroom:
      Reading: ../scenes/lost-empire/lost_empire-RGBA.png ... done.
    Double_Stone_Slab:
      Reading: ../scenes/lost-empire/lost_empire-RGB.png ... done.
    Stone_Slab:
      Reading: ../scenes/lost-empire/lost_empire-RGB.png ... done.
    Obsidian:
      Reading: ../scenes/lost-empire/lost_empire-RGB.png ... done.
    Torch:
      Reading: ../scenes/lost-empire/lost_empire-RGBA.png ... done.
      Reading: ../scenes/lost-empire/lost_empire-RGBA.png ... done.
    Oak_Stairs:
      Reading: ../scenes/lost-empire/lost_empire-RGB.png ... done.
    Chest:
      Reading: ../scenes/lost-empire/lost_empire-RGB.png ... done.
    Redstone_Wire:
      Reading: ../scenes/lost-empire/lost_empire-RGBA.png ... Error: CUDA call (cuArray3DCreate(&m_array, &arrayDesc) ) failed with error: 'out of memory' (C:\Users\X\Documents\Shocker\GfxExp\utils\cuda_util.cpp:693)
    

    As you can see the same textures are loaded over and over.

    opened by l2- 3
  • DynamicFunction

    DynamicFunction

    What does DynamicFunction class do? Is it an equivalent to a function pointer on a device?

    I am interested in using this abstraction (function pointer) for one of my projects. Is there a simple example of how it's used in a kernel?

    Thanks!

    opened by ib00 1
  • Question about light contribution calculation

    Question about light contribution calculation

    Hi,

    https://github.com/shocker-0x15/GfxExp/blob/ec95e561121812b7224579e3190d05db77ff19a4/restir/optix_kernels.cu#L868 https://github.com/shocker-0x15/GfxExp/blob/ec95e561121812b7224579e3190d05db77ff19a4/restir/optix_kernels.cu#L1403 I noticed that emittance is divided by PI even when the primary hit of the ray was an emitter. I was wondering what the reason is for this? For example if a primary ray hits an emitter with emittance (1.0, 1.0, 1.0) the shading will result in (1/pi, 1/pi, 1/pi) resulting in a visually dimmed primitive on the screen. Naturally this is only noticeable with emitters with emitting strength lower than pi.

    image Here I am hovering a pixel for which the primary hit is an emitter with values (1.0, 1.0, 1.0) as you can see in the debug info. I think the pixel in that case should also have value (1.0, 1.0 ,1.0) unless I understand wrong.

    This is the result when using contribution += emittance; image

    opened by l2- 1
  • Crash in path_tracing project in debug mode only

    Crash in path_tracing project in debug mode only

    Hi,

    I'm getting a consistent crash in all scenes I try using the path_tracing project in Debug mode only. Release mode works fine. The error message that appears using Nsight->CUDA Debugging is [Error 700: Illegal address during kernel execution].

    And the debugger usually stops at this line

    CUDA_DEVICE_KERNEL void RT_CH_NAME(pathTraceBaseline)() {
        pathTrace_closestHit_generic();
    }
    

    OptiX 7.40 / CUDA 11.7 Driver: 516.59 Visual Studio 2022 17.2.4 Windows 10 RTX 2070 SUPER

    Can you confirm this using your environment? I wonder if it has anything to do with this thread. https://forums.developer.nvidia.com/t/illegal-address-error-when-using-both-geometrytriangles-and-geometry-nodes/218956/18

    opened by Hurleyworks 2
Owner
shocker-0x15
shocker-0x15
Voxelight is a simple voxel engine/sandbox

Voxelight is a learning project, I have no prior experience with OpenGL or any other graphics API for that matter.

null 0 Jul 14, 2022
Low Level Graphics Library (LLGL) is a thin abstraction layer for the modern graphics APIs OpenGL, Direct3D, Vulkan, and Metal

Low Level Graphics Library (LLGL) Documentation NOTE: This repository receives bug fixes only, but no major updates. Pull requests may still be accept

Lukas Hermanns 1.4k Aug 1, 2022
A terminal-based graphics library for both 2D and 3D graphics.

TermGL A terminal-based graphics library for both 2D and 3D graphics. Written in C, created for terminals supporting ANSI escape codes. Table of Conte

null 203 Jul 15, 2022
kaun is a replacement for löve's built-in love.graphics module intended for 3D graphics

kaun kaun is a replacement for löve's built-in love.graphics module intended for 3D graphics. It is a Lua module you can require from a shared library

Joel Schumacher 4 Apr 5, 2021
This repo contains the DirectX Graphics samples that demonstrate how to build graphics intensive applications on Windows.

DirectX-Graphics-Samples This repo contains the DirectX 12 Graphics samples that demonstrate how to build graphics intensive applications for Windows

Microsoft 4.6k Jul 28, 2022
Cross-platform, graphics API agnostic, "Bring Your Own Engine/Framework" style rendering library.

bgfx - Cross-platform rendering library GitHub Discussions Discord Chat What is it? Cross-platform, graphics API agnostic, "Bring Your Own Engine/Fram

Бранимир Караџић 11.9k Aug 3, 2022
2D Vector Graphics Engine Powered by a JIT Compiler

Blend2D 2D Vector Graphics Powered by a JIT Compiler. Official Home Page (blend2d.com) Official Repository (blend2d/blend2d) Public Chat Channel Zlib

Blend2D 1.1k Jul 28, 2022
A modern cross-platform low-level graphics library and rendering framework

Diligent Engine A Modern Cross-Platform Low-Level 3D Graphics Library Diligent Engine is a lightweight cross-platform graphics API abstraction library

Diligent Graphics 2.4k Aug 1, 2022
Lightweight and modular C++11 graphics middleware for games and data visualization

Magnum — Lightweight and modular C++11/C++14 graphics middleware for games and data visualization Looking for an open-source library that gives you gr

Vladimír Vondruš 4.1k Aug 4, 2022
Yocto/GL: Tiny C++ Libraries for Data-Driven Physically-based Graphics

Yocto/GL: Tiny C++ Libraries for Data-Oriented Physically-based Graphics Yocto/GL is a collection of small C++17 libraries for building physically-bas

Fabio Pellacini 2.3k Jul 29, 2022
📽 Highly Optimized Graphics Math (glm) for C

?? OpenGL Mathematics (glm) for C Documentation Almost all functions (inline versions) and parameters are documented inside the corresponding headers.

Recep Aslantas 1.4k Aug 1, 2022
A library for high-performance, modern 2D graphics with SDL written in C.

SDL_gpu, a library for making hardware-accelerated 2D graphics easy. by Jonathan Dearborn SDL_gpu is licensed under the terms of the MIT License. See

Jonathan Dearborn 1k Aug 3, 2022
3D engine from scratch (without OpenGL or any other 3D graphics library)

Simple 3d engine based on SFML library. I tried to make this engine powerful and easy to understand.

Vectozavr 53 Aug 7, 2022
Dear PyGui 3D Engine (early development) and Graphics API demos.

Marvel This repo is the working location of the eventual Dear PyGui 3D Engine. It also contains several single file examples of creating a triangle wi

Jonathan Hoffstadt 81 Aug 5, 2022
4K Executable Graphics framework

Blossom ?? Blossom is a small framework for creating 4K Executable Graphics artworks for the demoscene. You are free to use this as the basis for your

Luna 163 Aug 9, 2022
This repository is used for storing sourcecode related to final project of Computer Graphics and Computer Vision

Computer Graphics and Computer Vision Description: This repository is used for storing sourcecode related to final project of Computer Graphics and Co

null 10 Jul 8, 2022
A small cross-platform graphics library made in C

minigfx Small graphics library made in C Intended to be: Simple to understand Intuitive Fun to use Features Cross platform: Windows and Linux. To see

Laurentino Luna 27 Jul 18, 2021
My computer graphics playground. Currently has a raytracer implemented with D3D11 compute shader.

Graphics Playground I use this project as my "toy" engine. I'll be implementing various graphics projects in this repository. The code here is not sui

Berk Emre Sarıbaş 4 Aug 26, 2021
CS-GY 6533 A – Interactive Computer Graphics - Fall 2021

CS-GY 6533 A – Interactive Computer Graphics - Fall 2021 Course Instructors Cláudio Silva (instructor) 370 Jay Street, room 1153 [email protected] Offic

null 2 Nov 9, 2021