Comments (3)
Hi,
Glad to hear you are finding the framework useful. I think I know what you want, but not quite sure what you want the API to look like. If you could provide more context and a code sample that would be helpful.
In the mean time, I think the following may be helpful:
def subdivide(points_in):
#create level 1 (2x2x2) grid
mort = torch.arange(8, dtype=torch.long, device='cuda')
pts0 = kaolin.ops.spc.morton_to_points(mort).reshape(-1)
#double input grid, add level 1 grid
pts1 = (2*points_in).repeat(1, 8)
return (pts1 + pts0).reshape(-1,3)
This takes as input a morton ordered tensor of points (voxels) of shape (3xN int16) and returns the corresponding tensor of 8 to 1 subdivided voxels of shape (3x(8*n)). For a given Spc, you would need to input the points from some level of the point hierarchy
subdiv_points = subdivide(point_hierarchies[pyramids[0,1,level]:pyramids[0,1,level+1]])
You could then create the octree for this by
subdiv_octree = kaolin.ops.spc.unbatched_points_octree(subdiv_points)
Admittedly, this is somewhat low level but I think close to what you want. LMK if you have thoughts for a higher level API, or if I'm way off the mark.
Good luck!
from kaolin.
Thanks a lot for this code snippet, this is exactly what I was trying to achieve for the subdivision part. Regarding a higher-level API, I was thinking something like this:
kaolin.ops.spc.subdivide(spc: SPC, mode:str = "random_zeros", subdiv_indices:Optional[Tensor]= None) -> SPC
Where, the SPC can have a batch > 1
and the subdivision routine will loop over all the points in the SPC batchwise to perform the subdivision. The mode
can be one of three:
"random_zeros"
puts the feature randomly in one of the 8 cells in the next hierarchy."zeros"
puts the features at thesubdiv_indices
for the next level of hierarchy (rest locations being zeros). Thesubdiv_indices
can be provided by the aggregator op similar to pooling and unpooling operations in 2D."nearest"
copies the feature for all cells 8 times in the next hierarchy.
Nevertheless, thanks a lot for your help.
Cheers!
@akanimax
from kaolin.
Thanks again for your help with this.
Cheers!
from kaolin.
Related Issues (20)
- Nvdiffrast not installed automatically? HOT 2
- RuntimeError: "packed_rasterize_forward_cuda" not implemented for 'Half'
- Cannot render a mesh which only contains vertices and faces. no uvmap. HOT 1
- conflict with bpy
- Runtime with flexicubes
- Request for CPU-Only Wheels for Non-GPU Dependent Modules HOT 3
- use DMTeT on UDF field?
- Invitation to Your First Open Source Project Organization HOT 1
- About orthographic projection matrix HOT 2
- KNN Operation
- How to calculate spc dual point coordinates. HOT 2
- Any suggestion about rendering transparent part? HOT 3
- Python3.11 builds HOT 2
- How to render shadow on the ground?
- Asking support for linear layer in spc features.
- Asking support for multiple-gpu training of structed point cloud class HOT 1
- No module named 'dmtet_network'
- [F glutil.cpp:338] eglInitialize() failed Aborted (core dumped) when render with kaolin and nvdiffrast
- ERROR: Failed building wheel for kaolin
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kaolin.