Coder Social home page Coder Social logo

jbikker / lighthouse2 Goto Github PK

View Code? Open in Web Editor NEW
805.0 44.0 80.0 622.8 MB

Lighthouse 2 framework for real-time ray tracing

License: Other

C++ 63.94% C 34.30% GLSL 0.36% Batchfile 0.04% Cuda 0.64% Objective-C 0.11% Lua 0.27% Python 0.28% CMake 0.04% HTML 0.02%
opengl optix rtx raytracer gpu cuda cuda-opengl real-time rendering rendersystem

lighthouse2's Introduction

lighthouse2

Lighthouse 2 framework for real-time ray tracing

This is the public repo for Lighthouse 2, a rendering framework for real-time ray tracing / path tracing experiments. Lighthouse 2 uses a state-of-the-art wavefront / streaming ray tracing implementation to reach high ray througput on RTX hardware (using Optix 7.2) and pre-RTX hardware (using Optix 5 Prime) and soon on AMD hardware (using RadeonRays / OpenCL) and CPUs (using Embree). A software rasterizer is also included, mostly as an example of a minimal API implementation.

ScreenShot

Quick pointers / Important advice:

Lighthouse 2 uses a highly modular approach to ease the development of renderers.

The main layers are:

  1. The application layer, which implements application logic and handles user input;
  2. The RenderSystem, which handles scene I/O and host-side scene storage;
  3. The render cores, which implement low-level rendering functionality.

Render cores have a common interface and are supplied to the RenderSystem as dlls. The RenderSystem supplies the cores with scene data (meshes, instances, triangles, textures, materials, lights) and sparse updates to this data.

The Lighthouse 2 project has the following target audience:

Researchers

Lighthouse 2 is designed to be a high-performance starting point for novel algorithms involving real-time ray tracing. This may include new work on filtering, sampling, materials and lights. The provided ray tracers easily reach hundreds of millions of rays per second on NVidia and AMD GPUs. Combined with a generic GPGPU implementation, this enables a high level of freedom in the implementation of new code.

Educators

The Lighthouse 2 system implements all the boring things such as scene I/O, window management, user interfaces and access to ray tracing APIs such as Optix, RadeonRays and Embree; your students can get straight to the interesting bits. The architecture of Lighthouse 2 is carefully designed to be easily accessible. Very fast scene loading and carefully tuned project files ensure quick development cycles.

Industry

Lighthouse 2 is an R&D platform. It is however distributed with the Apache 2.0 license, which allows you to use the code in your own products. Experimental cores can be shared with the community in binary / closed form, and application development is separated from core development.

What it is not

The ray tracing infrastructure (with related scene management acceleration structure maintenance) should be close to optimal. The implemented estimators however (unidirectional path tracers without filtering and blue noise) are not, and neither is the shading model (Lambert + speculars). This may or may not change depending on the use cases encountered. This video shows what can be achieved with the platform: https://youtu.be/uEDTtu2ky3o .

Lighthouse 2 should compile out-of-the-box on Windows using Visual Studio 2019. For the CUDA/Optix based cores CUDA 11.6 is required:

https://developer.nvidia.com/cuda-downloads

Make sure to chose the correct version (11.7).

Optix 5.x, 6.0 and 7.2 libraries are included in the Lighthouse 2 download and do not have to be downloaded separately.

For more information on Lighthouse 2 please visit: http://jacco.ompf2.com.

Credits

Lighthouse 2 was developed at the Utrecht University, The Netherlands.

Lighthouse 2 uses the following libraries:
Dear ImGui https://github.com/ocornut/imgui
FreeImage http://freeimage.sourceforge.net
Glad https://glad.dav1d.de
GLFW https://www.glfw.org
half 1.12 http://half.sourceforge.net
tinygltf https://github.com/syoyo/tinygltf
tinyobj https://github.com/syoyo/tinyobjloader
tinyxml2 https://github.com/leethomason/tinyxml2
zlib https://www.zlib.net

Contributions

Previous Work

Lighthouse 2 implements research by (very incomplete):

  • Marsaglia: random numbers
  • Van Antwerpen, Laine, Karras, Aila: streaming path tracing
  • Aila, Laine: persistent kernels
  • Schied et al.: Spatiotemporal Variance-Guided Filtering (SVGF)
  • Victor Voorhuis: improved SVGF for specular and glossy reprojection
  • Eric Heitz: Blue noise distributions

lighthouse2's People

Contributors

hugopeters1024 avatar jbikker avatar kequach avatar nezix avatar vincevannoort avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lighthouse2's Issues

OpenGL Error Invalid Operation

I am just starting out with lighthouse2 trying to compile it on my laptop.
glGetError() in CheckGL() seems to be giving me INVALID_OPERATION

Could you please have a look at lines 118 - 120 in platform.cpp
glBindVertexArray( 0 );
glDisableVertexAttribArray( 0 );
glDisableVertexAttribArray( 1 );

I think there is something wrong.

OpenGL reference says:
"GL_INVALID_OPERATION is generated by glEnableVertexAttribArray and glDisableVertexAttribArray if no vertex array object is bound."
But we are unbinding the vertex array object in glBindVertexArray(0) with the argument zero so there is no vao bound. Or did I get something wrong here?

freetype.dll was not found

Running any app results in:
"freetype.ddl was not found"

Apps seems to have the required ddls committed in their respective directories, but freetype.dll is not included it seems?

Thanks

Create DOI for the repository

I wanted to ask if you considered to create a DOI for the lighthouse2 framework. This allows researchers to reference a version of the framework with ease and can be done with Zenodo for example. There is also great integration between Zenodo, which creates a new DOI and a persistent copy of the repository for each release, and Github. You can find instructions on how to create a DOI here from official Github docs: https://docs.github.com/en/repositories/archiving-a-github-repository/referencing-and-citing-content

On a similar note, it also helps researchers to know how to correctly cite the software. Github utilizes the citation file format which was designed for software specifically. You can find more information about it here: https://citation-file-format.github.io/
I would be happy to help with this if you have any questions.

Error when running on Maxwell card

Hello,

I get the following error when trying to run the imguiapp application on a 750Ti

RenderCore_OptixPrime_B core:
image

RenderCore_Optix7 Core:
image

The last commit that is working for me is: c5e0ab5

Broken RenderCore_Minimal

The render function in RenderCore_Minimal contains an incorrect call to glTexSubImage2D:

glTexSubImage2D( GL_TEXTURE_2D, 0, GL_RGBA, screen->width, screen->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, screen->pixels );

Based on the docs, the call signature is

void glTexSubImage2D(GLenum target,
                     GLint level,
                     GLint xoffset,
                     GLint yoffset,
                     GLsizei width,
                     GLsizei height,
                     GLenum format,
                     GLenum type,
                     const void * pixels);

and as such the call itself should be:

glTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, screen->width, screen->height, GL_RGBA, GL_UNSIGNED_BYTE, screen->pixels );

normal maps, mdl materials

i am leaving my comments here since its not possible to register new users to ompf2 forums

  • i have been using lighthouse2 with simple models gltf with normals maps, can you let us know if this is functional in lighthouse2 ?
  • would it be possible to implement MDL nvidia materials, are you planning this on your roadmap ?
    thx

Project not building Debug x64

If I try to build the project for the Debug x64 target I get error C2855: command-line option '/Z7' inconsistent with precompiled header.
In Release x64 mode I don't get this error and it builds fine.

The issue seems to be caused by the latest commit (e0ed8c3). If I go back to any previous commit it does build.

Optix error unsupported ABI version

Hi Jacco,

I followed the instructions to compile Lighthouse with VS2017, however when running the application it shows a fatal error:

running on GPU: GeForce RTX 2060 (30 SMs, 6GB VRAM)

Error at line 124 of c:\users\sam\downloads\lighthouse2-master\lighthouse2-master\lib\rendercore_optix7\rendercore.cpp:
optixInit()
OPTIX_ERROR_UNSUPPORTED_ABI_VERSION (7801)

Googling this error seems to point to an issue with Optix 7. Any help on how to resolve it is appreciated.

help shadows optix7

Hi!
i have imported a gltf file, but i am not able to cast the inner shadows, i have spend 2 days trying to figure out why, the renderer i use is "RenderCore_Optix7"
here is the screenshot:
optix7
my graphis card is a nvidia quadro p4000, with latest drivers and cuda 10.2

on the other hand i can cast inner shadows with renderer "RenderCore_OptixPrime_BDPT"
notoptix

the gltf source file is here:
scene.zip

and it shows correctly with online gtlf view from
https://pissang.github.io/clay-viewer/editor/
wood1

any idea what i am doing wrong there ? thx

vulkan compile error

Hi, using visual studio 2017 and compiling the vulkan rendercore i got this error:

Severity Code Description Project File Line Suppression State
Error C2280 'lh2core::VulkanShader::VulkanShader(const lh2core::VulkanShader &)': attempting to reference a deleted function rendercore_vulkan_rt lighthouse2-master\lib\rendercore_vulkan_rt\rendercore.cpp 234

and breaks at line 234:
auto rgenShader = VulkanShader( m_Device, "rt_shaders.rgen" );

any info on this ? thx

Which CUDA?

Hello,

I am researching real-time ray tracing for a project that I am working on to update an older SDL2/OpenGL 3D game to a modern renderer and would definitely like to see if I could rework the project to have a real-time ray tracer instead along with some other modern rendering features.

In as much, I came across your lighthouse2 project and it says to use CUDA 11.7 but I was wondering if it would build and run with the latest CUDA 12.0 as well?

Sorry, but I am a bit new to CUDA and have also been investigating Vulkan to learn more about it as well.

Any help would be greatly appreciated.
Thanks

NaN in PackNormal compression

Hi Jacco,

The function

// from: https://aras-p.info/texts/CompactNormalStorage.html
LH2_DEVFUNC uint PackNormal( float3 N )
{
#if 1
	// more efficient
	const float f = 65535.0f / sqrtf( 8.0f * N.z + 8.0f );
	return (uint)(N.x * f + 32767.0f) + ((uint)(N.y * f + 32767.0f) << 16);
#else
	float2 enc = normalize( make_float2( N ) ) * (sqrtf( -N.z * 0.5f + 0.5f ));
	enc = enc * 0.5f + 0.5f;
	return (uint)(enc.x * 65535.0f) + ((uint)(enc.y * 65535.0f) << 16);
#endif
}

Produces a NaN for input normal (0, 0, -1) which leads to a return value of 0.
Unpacking the 0 value leads to a NaN normal.

I solved the problem I had by adding a max check with an Epsilon of 0.0001f:

const float f = 65535.0f / fmaxf(sqrtf(8.0f * normal.z + 8.0f), 0.0001f);

I was running this code on CPU, so I'm unsure if this is handled differently on the GPU.

Error building the pbrtdemoapp

Camera has no position or direction members...

5>D:\lighthouse2\apps\pbrtdemoapp\main.cpp(189,51): error C2039: 'position': is not a member of 'lighthouse2::Camera'
5>D:\lighthouse2\lib\RenderSystem\camera.h(25): message : see declaration of 'lighthouse2::Camera'
5>D:\lighthouse2\apps\pbrtdemoapp\main.cpp(190,52): error C2039: 'direction': is not a member of 'lighthouse2::Camera'
5>D:\lighthouse2\lib\RenderSystem\camera.h(25): message : see declaration of 'lighthouse2::Camera'
5>Done building project "pbrtdemoapp.vcxproj" -- FAILED.

Correct CUDA Version?

Readme says 10.1 is required but the troubleshooting page says 10.2. Not sure if it works on both but just wanted to mention this.

Optix Prime renders incorrectly (black) on Titan V (Volta)..

Some things I found trying to fix:
*Included Optix prime DLL&lib version is 5.1 so I updated to 6.0:

//#pragma comment(lib, "../OptiX/lib64/optix_prime.1.lib" )
#pragma comment(lib, "../OptiX/lib64/optix_prime.6.0.0.lib" )

now shows correctly:

running on GPU: TITAN V (80 SMs, 12GB VRAM)
OptiX Version:[6.0.0] Branch:[rel6.0] Build Number:[25650775] CUDA Version:[10.1] 64-bit 2019-01-29

*changed .cuda.cu files device support from :
compute_50,sm_50;compute_75,sm_75
to:
compute_70,sm_70;compute_75,sm_75
*I found some :

#if __CUDA_ARCH__ > 700
#define THREADMASK	__activemask() // volta, turing
#else
#define THREADMASK	0xffffffff // pascal, kepler, fermi
#endif

and changed:
#if __CUDA_ARCH__ > 700
to:
#if __CUDA_ARCH__ >= 700
to include Volta..
still black screen..

Note I also cleaned .cu.ptx file in case..
I'm using NV VK dev driver from 418 branch and CUDA 10.1 Update 1 SDK..
maybe fixed with original CUDA 10.1 SDK and/or NV 430.xx driver?
thanks..

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.