Giter Club home page Giter Club logo

sparsevoxeloctree's Introduction

Sparse Voxel Octree (Vulkan Version)

Linux Windows Mac OS
A GPU SVO Builder using the rasterization pipeline, an efficient SVO ray marcher and a simple SVO path tracer.
If you want an OpenGL version, check OpenGL branch.

Compilation

mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make

Built With

Usage

  • Camera
    • W A S D - move around (horizontally)
    • SPACE - go up
    • LSHIFT - go down
    • Drag - change perspective
  • X - toggle ui display

Improvements

The new Vulkan version is much faster than the old OpenGL version, given the comparison below:

GTX 1660 Ti

SVO build time Crytek Sponza (2^10) San Miguel (2^11) Living Room (2^12)
Vulkan (new) 19 ms 203 ms 108 ms
OpenGL (old) 470 ms -- --

Quadro M1200

SVO build time Crytek Sponza (2^10) San Miguel (2^11) Living Room (2^12)
Vulkan (new) 80 ms 356 ms 658 ms
OpenGL (old) 421 ms 1799 ms 3861 ms

In addition, the new Vulkan version has some advanced features such as asynchronous model loading and asynchronous path tracing.

TODOs

v1.0

  • Allow window resizing
  • Test queue ownership transfer
  • Environment map

v2.0

  • Voxel editor ?
  • Gradient-domain path tracing ?
  • Build SVO contours ?

Reference

Screenshots

sparsevoxeloctree's People

Contributors

adamyuan 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

sparsevoxeloctree's Issues

How to rotate and draw multiple octtrees?

Hello, Adam.
Please help transform octtrees correctly and render multiple octrees (GL version).

To rotate/transform octtree with "model" matrix uniform, i try multiple matrix like this -
return normalize(mat3(inverse(uView)) * inverse(mat3(uModel)) * (inverse(uProjection) * vec4(coord, 1, 1) ).xyz);
in vec3 GenRay() function;

But i think, it rotate camera, instest of model; Also - try to render second octtree, with some translation.
if my multiply wrong, and i move the camera instead of the object, then I will not be able to see the 2nd object.

here is code to render two objects:
glm::mat4 model = glm::mat4(1.0);
model = glm::rotate(model, (float)glfwGetTime(), glm::vec3(0,0,1));
m_shader.SetMat4(m_shader.GetUniform("uModel"), (GLfloat*)(&model));
m_shader.SetInt(m_unif_view_type, (GLint)m_view_type);
m_shader.SetInt(m_unif_beam_enable, (GLint)m_beam_enable);
quad.Render();

model = glm::translate(model, glm::vec3(0.5, 0.75, 0)); // 1.0 - 2.0 space?
m_shader.SetMat4(m_shader.GetUniform("uModel"), (GLfloat*)(&model));
m_shader.SetInt(m_unif_view_type, (GLint)m_view_type);
m_shader.SetInt(m_unif_beam_enable, (GLint)m_beam_enable);
quad.Render();

beam opt. is disabled ofcourse;

Also disable black color if !hit:
main() {
...
if(uViewType == 2)
oFragColor = vec4( vec3(iter / 64.0f), 1 );
else
//if (!hit) discard; // no effect
//oFragColor = vec4( hit ? ( uViewType == 0 ? color : normal * 0.5f + 0.5f ) : vec3(0), 1 );
if (hit)
oFragColor = vec4( uViewType == 0 ? color : normal * 0.5f + 0.5f, 1 );
...
}

VK_ERROR_INITIALIZATION_FAILED: Shader library compile failed

When running on macOS Monterey we get this error.
program_source:38:174: error: cannot reserve 'texture' resource locations at index 0
fragment void main0(main0_in in [[stage_in]], device _66& _68 [[buffer(2)]], device _101& _103 [[buffer(3)]], constant _20& _22 [[buffer(4)]], array<texture2d, 1024> _19 [[texture(0)]], array<sampler, 1024> _19Smplr [[sampler(0)]])
^
program_source:38:215: error: cannot reserve 'sampler' resource locations at index 0
fragment void main0(main0_in in [[stage_in]], device _66& _68 [[buffer(2)]], device _101& _103 [[buffer(3)]], constant _20& _22 [[buffer(4)]], array<texture2d, 1024> _19 [[texture(0)]], array<sampler, 1024> _19Smplr [[sampler(0)]])

macbook pro m1.

Signed Distance Fields

Hi Adam

Really cool project - works out of the box on Debian 12 using both integrated and dedicated GPU. I am looking for inspiration for a fast SVO for updating a TSDF and raycasting afterwards - very different from the rasterization pipeline.

Do you have any good references for such a challenge?

Thanks in advance
Jens

Error when building in VS2019

Severity Code Description Project File Line Suppression State
Error C1091 compiler limit: string exceeds 65535 bytes in length SparseVoxelOctree C:\Projects\vox\SparseVoxelOctree\dep\imgui\imgui_draw.cpp 3777

Scenes

Can I use any obj file I have with SparseVoxelOctree? Do you have any of the scenes shown in the README available to download?

Meshoptimizer use

Hello.
Why do you use meshoptimizer?
What pros and cons for use it?

Moving around while it is raytracing?

The raytracing gets a decent image basically instantly, would it be possible to navigate the scene in the raytraced mode? Also, I figured out that you can use Shift to go down, but how do you go up?

Trouble building on MacOS

Hi! I can't build on MacOS (M1 Pro Ventura 13.3.1), though I do have Vulkan installed and working properly. I'm really new to Vulkan though so sorry if my question is silly.

Error is in dep/myVK/src/glfw/Instance.cpp when calling vkCreateInstance(&create_info, nullptr, &ret->m_instance) it get -9 which translate to VK_ERROR_INCOMPATIBLE_DRIVER

Do you have any idea on how to overcome this?

I tried to do this :

std::vector<const char*> extNames;
const char* extName1 = "VK_KHR_portability_enumeration";
const char* extName2 = VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME;
const char* extName3 = "VK_KHR_portability_subset";


extNames.push_back(extName1);
extNames.push_back(extName2);
extNames.push_back(extName3);

VkInstanceCreateInfo create_info = {};

create_info.flags = VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR;
create_info.enabledExtensionCount = static_cast<uint32_t>(extNames.size());
create_info.ppEnabledExtensionNames = extNames.data();

create_info.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
create_info.pApplicationInfo = &app_info;

in dep/myVK/src/glfw/Instance.cpp as stated in Vulkan docs, but it does not change anything.

Thanks!

Is project still active?

Hello,

I am wondering if this project is still active and if v2.0 is in the works?

Would like to discuss it in more details if you are interested.

Thanks

Where to get the obj files?

Hello,

I just came across this you Sparse Voxel Octree and wanted to replicate the output.

I downloaded the Windows_MSVC in the release section but it seems that it is missing the OBJ files for Crytek Sponza, San Miguel, and Living Room.

Where can I download these and others to test out?
Thanks

Any benchmarks?

Hey just wondering if you can tell me how fast the can build an svo on a couple datasets. Thanks

License?

Hi there, what's the license for this code?

If you don't care about its usage and are unsure, might I suggest the MIT license?

Problems building

-- Building for: Visual Studio 16 2019
-- The C compiler identification is MSVC 19.24.28314.0
-- The CXX compiler identification is MSVC 19.24.28314.0
-- Check for working C compiler: D:/Software/VS/VC/Tools/MSVC/14.24.28314/bin/Hostx64/x64/cl.exe
-- Check for working C compiler: D:/Software/VS/VC/Tools/MSVC/14.24.28314/bin/Hostx64/x64/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: D:/Software/VS/VC/Tools/MSVC/14.24.28314/bin/Hostx64/x64/cl.exe
-- Check for working CXX compiler: D:/Software/VS/VC/Tools/MSVC/14.24.28314/bin/Hostx64/x64/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found OpenGL: opengl32
CMake Error at CMakeLists.txt:18 (find_package):
  By not providing "Findglfw3.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "glfw3", but
  CMake did not find one.

  Could not find a package configuration file provided by "glfw3" with any of
  the following names:

    glfw3Config.cmake
    glfw3-config.cmake

  Add the installation prefix of "glfw3" to CMAKE_PREFIX_PATH or set
  "glfw3_DIR" to a directory containing one of the above files.  If "glfw3"
  provides a separate development package or SDK, be sure it has been
  installed.


-- Configuring incomplete, errors occurred!
See also "C:/Projects/vox/SparseVoxelOctree/CMakeFiles/CMakeOutput.log".

Compiling errors when using the command

HI dear author,
It's truly a honor to write a letter to you, I'm build your project nowadays and found the error when building as following, I wonder if there is a chance that you know the reason? :)

image

thank you
best regards to you
William

Sample OBJs?

Where can I download the OBJs used in the screenshots? I want to test this amazing project out!

Failed to build on MSYS2 MINGW64

[114/114] Linking CXX executable SparseVoxelOctree.exe
make: [C:\msys64\tmp\ccDCIn3m.mk:60: C:\msys64\tmp\cccgCHMz.ltrans19.ltrans.o] Error 1 (ignored)
make: [C:\msys64\tmp\ccDCIn3m.mk:48: C:\msys64\tmp\cccgCHMz.ltrans15.ltrans.o] Error 1 (ignored)
make: [C:\msys64\tmp\ccDCIn3m.mk:33: C:\msys64\tmp\cccgCHMz.ltrans10.ltrans.o] Error 1 (ignored)
make: [C:\msys64\tmp\ccDCIn3m.mk:24: C:\msys64\tmp\cccgCHMz.ltrans7.ltrans.o] Error 1 (ignored)
make: [C:\msys64\tmp\ccDCIn3m.mk:36: C:\msys64\tmp\cccgCHMz.ltrans11.ltrans.o] Error 1 (ignored)
make: [C:\msys64\tmp\ccDCIn3m.mk:39: C:\msys64\tmp\cccgCHMz.ltrans12.ltrans.o] Error 1 (ignored)
make: [C:\msys64\tmp\ccDCIn3m.mk:69: C:\msys64\tmp\cccgCHMz.ltrans22.ltrans.o] Error 1 (ignored)
make: [C:\msys64\tmp\ccDCIn3m.mk:51: C:\msys64\tmp\cccgCHMz.ltrans16.ltrans.o] Error 1 (ignored)
make: [C:\msys64\tmp\ccDCIn3m.mk:63: C:\msys64\tmp\cccgCHMz.ltrans20.ltrans.o] Error 1 (ignored)
make: [C:\msys64\tmp\ccDCIn3m.mk:66: C:\msys64\tmp\cccgCHMz.ltrans21.ltrans.o] Error 1 (ignored)
make: [C:\msys64\tmp\ccDCIn3m.mk:15: C:\msys64\tmp\cccgCHMz.ltrans4.ltrans.o] Error 1 (ignored)
make: [C:\msys64\tmp\ccDCIn3m.mk:3: C:\msys64\tmp\cccgCHMz.ltrans0.ltrans.o] Error 1 (ignored)
make: [C:\msys64\tmp\ccDCIn3m.mk:78: C:\msys64\tmp\cccgCHMz.ltrans25.ltrans.o] Error 1 (ignored)
make: [C:\msys64\tmp\ccDCIn3m.mk:54: C:\msys64\tmp\cccgCHMz.ltrans17.ltrans.o] Error 1 (ignored)
make: [C:\msys64\tmp\ccDCIn3m.mk:27: C:\msys64\tmp\cccgCHMz.ltrans8.ltrans.o] Error 1 (ignored)
make: [C:\msys64\tmp\ccDCIn3m.mk:45: C:\msys64\tmp\cccgCHMz.ltrans14.ltrans.o] Error 1 (ignored)
C:/msys64/home/Administrator/SparseVoxelOctree/dep/tinyfiledialogs.c: In function 'tinyfd_openFileDialog.constprop':
C:/msys64/home/Administrator/SparseVoxelOctree/dep/tinyfiledialogs.c:3095:1: warning: function may return address of local variable [-Wreturn-local-addr]
 3095 | }
      | ^
C:/msys64/home/Administrator/SparseVoxelOctree/dep/tinyfiledialogs.c:3043:14: note: declared here
 3043 |         char lBuff[MAX_PATH_OR_CMD];
      |              ^
C:/msys64/home/Administrator/SparseVoxelOctree/dep/tinyfiledialogs.c:3043:14: note: declared here
make: [C:\msys64\tmp\ccDCIn3m.mk:81: C:\msys64\tmp\cccgCHMz.ltrans26.ltrans.o] Error 1 (ignored)
make: [C:\msys64\tmp\ccDCIn3m.mk:57: C:\msys64\tmp\cccgCHMz.ltrans18.ltrans.o] Error 1 (ignored)
make: [C:\msys64\tmp\ccDCIn3m.mk:42: C:\msys64\tmp\cccgCHMz.ltrans13.ltrans.o] Error 1 (ignored)
make: [C:\msys64\tmp\ccDCIn3m.mk:75: C:\msys64\tmp\cccgCHMz.ltrans24.ltrans.o] Error 1 (ignored)
make: [C:\msys64\tmp\ccDCIn3m.mk:84: C:\msys64\tmp\cccgCHMz.ltrans27.ltrans.o] Error 1 (ignored)
make: [C:\msys64\tmp\ccDCIn3m.mk:30: C:\msys64\tmp\cccgCHMz.ltrans9.ltrans.o] Error 1 (ignored)
make: [C:\msys64\tmp\ccDCIn3m.mk:12: C:\msys64\tmp\cccgCHMz.ltrans3.ltrans.o] Error 1 (ignored)
make: [C:\msys64\tmp\ccDCIn3m.mk:72: C:\msys64\tmp\cccgCHMz.ltrans23.ltrans.o] Error 1 (ignored)
make: [C:\msys64\tmp\ccDCIn3m.mk:6: C:\msys64\tmp\cccgCHMz.ltrans1.ltrans.o] Error 1 (ignored)
make: [C:\msys64\tmp\ccDCIn3m.mk:18: C:\msys64\tmp\cccgCHMz.ltrans5.ltrans.o] Error 1 (ignored)
make: [C:\msys64\tmp\ccDCIn3m.mk:9: C:\msys64\tmp\cccgCHMz.ltrans2.ltrans.o] Error 1 (ignored)
make: [C:\msys64\tmp\ccDCIn3m.mk:21: C:\msys64\tmp\cccgCHMz.ltrans6.ltrans.o] Error 1 (ignored)

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.