pouët.net

Voxelizer

category: code [glöplog]
At the moment we use CPU. I read that GPU is 1000 times faster than CPU. I will try to get some library to use GPU with C#. Thanks for suggestion.
added on the 2017-07-27 08:31:19 by Adok Adok
There's OpenTK if you're used to GL, SharpDX if you're used to DX. And yes, nowadays it's a bad decision to use a CPU, this task is clearly suited for GPUs.
added on the 2017-07-27 10:29:08 by xTr1m xTr1m
How about Cudafy? We use C# at our company.
added on the 2017-07-27 13:05:03 by Adok Adok
Sure, why not. In the end you have to try and evaluate. Voxelizing is one thing, but rendering graphics with an "GeneralPurposeGPU" API is, although doable in theory, a lot harder than with a graphics API like OpenGL or DirectX.
added on the 2017-07-27 13:58:34 by xTr1m xTr1m
...in the end you still have to draw the cubes.
added on the 2017-07-27 13:58:56 by xTr1m xTr1m
my volexizer uses a 2D grid of parallel lines that intersect the meshes by pairs of, that gives a binary length encoding of the volum, by sorting intersections. at the end I run a matrix based smooth surface rendering with marching cubes. ("lifemorph.ned" in -Dead Deer- adds a volum interpolation between meshes)
added on the 2017-07-27 15:55:04 by Barti Barti
Quote:
How about Cudafy? We use C# at our company.

oh and also:
BB Image
added on the 2017-07-27 17:10:04 by xTr1m xTr1m
I do not need a library to output graphics. I only need the GPU to perform some calculations and return me an array of type bool.
added on the 2017-07-27 19:15:18 by Adok Adok
sounds like you don't need to ask questions on pouet then either!
Quote:
...but my boss is still unhappy simply because it does not look perfect...

hmm...
Quote:
At the moment we use CPU.

I'm starting to see a pattern.
Quote:
she keeps insisting that I should spend my sparetime conducting further research and finding a "better" mesh voxelizer.

Sound reasonable
Quote:
...in the end you still have to draw the cubes.

Obviously!
Quote:
I do not need a library to output graphics.

*sigh* I'm out of here...
added on the 2017-07-27 21:56:25 by xTr1m xTr1m
Are calculating and displaying only the shell voxzels or everything including the insides? Adok
added on the 2017-07-28 00:08:11 by Navis Navis
xTr1m: Sorry, but have you understood what it is all about? It is a program that calculates things. So it needs the data (cuboids) in its own internal data structure. The drawing is done using Kitware VTK so I have no choice to use anything else. What I need is to make the calculation faster. And originally, I wanted to make sure that there is no way to achieve better looking results based on the premise that we must use cuboids.

Navis: My algorithm first calculates the shell voxels and then "fills" the resulting voxel model. The size of the cuboids is not constant, and my algorithm is clever enough to create large cuboids when there is a lot of space to be filled and smaller cuboids only if it is really necessary. I am not sure if my explanation is easy to understand but all in all, the filling routine seems to be efficient. The slow thing is the code that checks whether a voxel has been hit by a polygon face. As much as I understood Smash and xTr1m, this could be sped up by factor 1000 if I used the GPU.
added on the 2017-07-28 11:12:01 by Adok Adok
To express myself more clearly:

The point is not to optimize the code that displays the graphics. I can't modify this code.

The point is to optimize the code that generates the array element_set. This is a three-dimensional array of bool with default size 120x120x120. If an element is true, this means that the respective voxel is to be set, otherwise not.

(And originally, my question was not about speed but about the "visual quality" of the result, i.e. it should resemble the original polygon mesh as much as possible. IMHO what I have is already optimal in this aspect and I just have to find a way to explain to my boss that it cannot be done better.)
added on the 2017-07-28 11:24:33 by Adok Adok
using spheres can afford little by tessellating faces and decals about normals, instead of cubes, tessellation can be done two regardless to length of the faces, that is to populate among a unit. if it's necessary to put a cube in each plain of the subject to voxelize.
added on the 2017-07-28 14:09:49 by Barti Barti
-Dead Deer- : "Beethoven.ned"
added on the 2017-07-28 14:10:25 by Barti Barti
note that such a tessellation requieres splitting edges and remising by cases. a simple hash table of pairs.
added on the 2017-07-28 14:12:47 by Barti Barti
Adok: now it's clear. You didn't mention that the drawing code is separated and out of control.

In that respect, sure, use any GPGPU api that suits you.
added on the 2017-07-28 14:38:49 by xTr1m xTr1m
Also, an actual screenshot of a voxelized model would be good to have. You say your voxelizer is optimal but who knows, maybe there's some rounding or similar error left that makes the result look worse than it should.
added on the 2017-07-28 16:57:10 by kb_ kb_
my text corrector is not working properly (macOS safari).
added on the 2017-07-28 17:30:53 by Barti Barti
Adok:

"The size of the cuboids is not constant, and my algorithm is clever enough to create large cuboids when there is a lot of space to be filled and smaller cuboids only if it is really necessary" <- octree

"What I forgot to mention is that we also have a zooming function. So what appears to be one pixel in the preview can become something larger when you zoom in and so on." <- brick maps

Knowing what you're actually doing will help, because then you can go look at how other people are doing this already ;)
added on the 2017-07-29 10:47:50 by psonice psonice
he's probably trying to do this:
BB Image
all this coffee on my screen now... thank you maali! :D
added on the 2017-07-29 14:13:11 by dq dq
all this coffee on my wall now because i was about to drink it but then i had to hail ze fuhrer!

login