Giter Site home page Giter Site logo

sxyu / svox Goto Github PK

View Code? Open in Web Editor NEW
75.0 75.0 26.0 7.16 MB

PlenOctrees construction + rendering PyTorch CUDA extension

Home Page: https://svox.readthedocs.io

License: BSD 2-Clause "Simplified" License

Python 51.62% C++ 8.70% Cuda 37.86% CMake 1.82%

svox's Introduction

svox's People

Contributors

liruilong940607 avatar sxyu 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

svox's Issues

How to transform the sampling point?

Hi,
At first, thanks for the great packages!

I'd like to render a image following curved rays (not straight rays)
It seems I should handle the .cu file to implement this.

svox/svox/csrc/rt_kernel.cu

Lines 799 to 819 in 0f300d7

template <typename scalar_t>
__global__ void render_image_kernel(
PackedTreeSpec<scalar_t> tree,
PackedCameraSpec<scalar_t> cam,
RenderOptions opt,
torch::PackedTensorAccessor32<scalar_t, 3, torch::RestrictPtrTraits>
out) {
CUDA_GET_THREAD_ID(tid, cam.width * cam.height);
int iy = tid / cam.width, ix = tid % cam.width;
scalar_t dir[3], origin[3];
cam2world_ray(ix, iy, dir, origin, cam);
scalar_t vdir[3] = {dir[0], dir[1], dir[2]};
maybe_world2ndc(opt, dir, origin);
transform_coord<scalar_t>(origin, tree.offset, tree.scaling);
trace_ray<scalar_t>(
tree,
SingleRaySpec<scalar_t>{origin, dir, vdir},
opt,
out[iy][ix]);
}

svox/svox/csrc/rt_kernel.cu

Lines 775 to 796 in 0f300d7

template <typename scalar_t>
__host__ __device__ __inline__ static void maybe_world2ndc(
RenderOptions& __restrict__ opt,
scalar_t* __restrict__ dir,
scalar_t* __restrict__ cen, scalar_t near = 1.f) {
if (opt.ndc_width < 0)
return;
scalar_t t = -(near + cen[2]) / dir[2];
for (int i = 0; i < 3; ++i) {
cen[i] = cen[i] + t * dir[i];
}
dir[0] = -((2 * opt.ndc_focal) / opt.ndc_width) * (dir[0] / dir[2] - cen[0] / cen[2]);
dir[1] = -((2 * opt.ndc_focal) / opt.ndc_height) * (dir[1] / dir[2] - cen[1] / cen[2]);
dir[2] = -2 * near / cen[2];
cen[0] = -((2 * opt.ndc_focal) / opt.ndc_width) * (cen[0] / cen[2]);
cen[1] = -((2 * opt.ndc_focal) / opt.ndc_height) * (cen[1] / cen[2]);
cen[2] = 1 + 2 * near / cen[2];
_normalize(dir);
}

Unfortunately, I barely handle the CUDA.
Is there any way to manipulate the ray (or sampling points)?
Any glitch or niche is also fine. :)

Thank you for your time!

How to use cpu to render?

Hello, may I ask how to use svox to render an image on a cpu? It seems that svox does not support cpu rendering at this moment.

Inconsistent Querying Results of 'cpu' and 'cuda' in N3Tree

K = 16
tree = svox.N3Tree(data_dim=4,
                   radius=K,
                   center=[K, K, K],
                   data_format='RGBA',
                   device='cpu') # or with 'cuda'
print(tree[20,20,20].corners)

In 'cpu' mode it outputs [16., 16., 16.] as expected, however in 'cuda' mode, it outputs [16., 0., 0.]

svox.csrc

CUDA extension svox.csrc could not be loaded! Operations will be slow.
Please do not import svox in the SVOX source directory.
"Operations will be slow.\n"

I installed svox with "pip install svox", but there will be such an error. Is there any solution? thank you very much!

The low volume rendering seems not to work.

发生异常: RuntimeError (note: full exception trace is shown but execution is paused at: _run_module_as_main)
The size of tensor a (3) must match the size of tensor b (640000) at non-singleton dimension 1

UserWarning: Using slow volume rendering, should only be used for debugging
warn("Using slow volume rendering, should only be used for debugging")

out_rgb += light_intensity. * self.background_brightness

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.