3D scanner software - new hardware question

Everything related to 3D programming
marc_256
Enthusiast
Enthusiast
Posts: 742
Joined: Thu May 06, 2010 10:16 am
Location: Belgium
Contact:

3D scanner software - new hardware question

Post by marc_256 »

Hi,

After some time of developing my CT 3D VIEWER software.
http://www.marc-systems.be/new_2010/Vie ... amples.htm
I invested my last money in a new computer and new screen.
I was thinking (i 'm not a PC guru) with a good gaming video card, that ogre will be faster to make zoom and rotations.
But I was wrong, can someone tell me why the speed is almost the same as my old slower PC ?

OS: WIN 8.1 x64
PB 5.41 LTS Final - x64
LAPTOP: MSI Leopard Pro
CPU: INTEL i7
GRAPHIC CARD: NVIDIA GTX950M
RESOLUTION: HD (1920x1080)

What do I need to speed up this zoom and rotations ?

thanks,
Marc
- every professional was once an amateur - greetings from Pajottenland - Belgium -
PS: sorry for my english I speak flemish ...
User avatar
Samuel
Enthusiast
Enthusiast
Posts: 755
Joined: Sun Jul 29, 2012 10:33 pm
Location: United States

Re: 3D scanner software - new hardware question

Post by Samuel »

@marc_256
If you can give some example code of your slowdowns then someone might be able to give you some ideas to help speed up your code.
marc_256 wrote: I was thinking (i 'm not a PC guru) with a good gaming video card, that ogre will be faster to make zoom and rotations.
To a point this is true. A better card will give you better performance in areas, but the main boost comes from being able to access the newer versions of rendering API.
The problem you're finding is that PB/Ogre is still using the old DirectX and OpenGL fixed rendering pipelines.
Alexi wrote: I noticed a huge performance improvement by switching vsync off, you can do by passing the #PB_Screen_NoSynchronization flag. That was pretty unecpected as the test scene itself was almost empty, and running on a Titan X, without vsync it was about 100 times faster, no glitches at all, so nothing what vsync justifies so far.
If you're not getting artifacts or tearing then Vsync isn't needed. Which is why most games give you the option to turn Vsync on or off.
User avatar
Samuel
Enthusiast
Enthusiast
Posts: 755
Joined: Sun Jul 29, 2012 10:33 pm
Location: United States

Re: 3D scanner software - new hardware question

Post by Samuel »

Quick question how are you rendering those images? It almost looks like planes and if so how many planes are generated and what image resolution are you using?

If you're using planes then you could try static geometries if you haven't already.
You could also look into 3D textures with a shader (similar to how minecraft worlds are generated).
marc_256
Enthusiast
Enthusiast
Posts: 742
Joined: Thu May 06, 2010 10:16 am
Location: Belgium
Contact:

Re: 3D scanner software - new hardware question

Post by marc_256 »

Alexi wrote:What do you mean by zoom and rotations, Sprites, Images? It depends on your special case i guess. Specs of your previous system?

Don't know what you actually mean, but i noticed a huge performance improvement by switching vsync off, you can do by passing the #PB_Screen_NoSynchronization flag. That was pretty unecpected as the test scene itself was almost empty, and running on a Titan X, without vsync it was about 100 times faster, no glitches at all, so nothing what vsync justifies so far.
- No sprites, images but cloud mesh.
- I did this, and yes it works a little faster.
Samuel wrote:Quick question how are you rendering those images? It almost looks like planes and if so how many planes are generated and what image resolution are you using?

If you're using planes then you could try static geometries if you haven't already.
You could also look into 3D textures with a shader (similar to how minecraft worlds are generated).
What I do is,
1) I convert the CT scanner 2D images to gray scale images (256 grays)
2) I store them in the data memory (+-500 images of 512x512 bits)
3) then I make a transparent 3D cloud mesh of it.
so the user can change the transparency of the pixels to see inside the body or organs.
4) the software rebuilds a 3D cloud mesh (even with i7 x64, takes some minutes to (re)build the mesh).
5) build/make a 3D mesh for OGRE
6) so we can zoom in and rotate the camera/mesh

I made some tests:
1) stable camera and move and rotate the mesh
2) stable mesh and move and rotate the camera

looks there is no difference for now ...

Maybe I 'm a dreamer, if i calculate the mesh volume ...
500 (images) x 512 (pixels in Xaxis) x 512 (pixels in Yaxis) = 131 072 000 (3D pixels)


thanks for helping me here,
marc
- every professional was once an amateur - greetings from Pajottenland - Belgium -
PS: sorry for my english I speak flemish ...
User avatar
Samuel
Enthusiast
Enthusiast
Posts: 755
Joined: Sun Jul 29, 2012 10:33 pm
Location: United States

Re: 3D scanner software - new hardware question

Post by Samuel »

@marc_256
Instancing and geometry shaders would be a major help with what you're trying to do. Problem is they are not available in the current PB/Ogre package.

Do you notice any speed improvements if you don't use alpha? If Ogre is doing alpha sorting then I could see that being a major bottleneck for the rendering pipeline.
DarkDragon
Addict
Addict
Posts: 2218
Joined: Mon Jun 02, 2003 9:16 am
Location: Germany
Contact:

Re: 3D scanner software - new hardware question

Post by DarkDragon »

then I make a transparent 3D cloud mesh of it.
The question here is also: how? You could triangulate the point cloud, e.g. with (dual) marching cubes. That way the amount of fragments processed is far less. Also you could try uploading the layers themselves and just display planes with each layer as texture.
bye,
Daniel
marc_256
Enthusiast
Enthusiast
Posts: 742
Joined: Thu May 06, 2010 10:16 am
Location: Belgium
Contact:

Re: 3D scanner software - new hardware question

Post by marc_256 »

hello,

For my 2D to 3D image converter, (cancer research)
I convert 2D bmp images to a 3D pixels cloud.
To do that I use a self made algorithm, written in PB.
It work very well but it need about 3...4 minutes to do the conversion. (see below)
So, will there be a significant difference in time when I rewrite my program in ASM ?
thanks,

marco


Image



Image
- every professional was once an amateur - greetings from Pajottenland - Belgium -
PS: sorry for my english I speak flemish ...
User avatar
djes
Addict
Addict
Posts: 1806
Joined: Sat Feb 19, 2005 2:46 pm
Location: Pas-de-Calais, France

Re: 3D scanner software - new hardware question

Post by djes »

For my latest experiments in huge clouds of 3d scan (topography), I've tested some tools to convert to meshes. Best ones are Autodesk Recap and CloudCompare(CC). They're pretty good for this task, having needed work force for this kind of job, pretty difficult for only one person !

Anyway, to answer about ASM optimisation, the best optimisation is always in the algorithm, the second one in reducing memory access (few variables leading to CPU using only internal registers), third in reducing global number of sequential operations (allowing parallelism, with tricks like unlooping-thinking in a way of reducing little imbricated loops-), fourth in reducing slow instructions, and so on.
All could be done in any language, ASM being useful at the core of the algorithm. Good asm coders could, by working intensively on a specific problem, find tricks going further, but it takes time and a lot of concentration.

Now, consider also that CPUs are evolving, and some well knowns slow instructions in the past are now fast, so it's better to concentrate on algorithm and the points I've given before thinking to optimisation, especially in ASM, which is harder to debug.
IdeasVacuum
Always Here
Always Here
Posts: 6425
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: 3D scanner software - new hardware question

Post by IdeasVacuum »

Hi Marc

The Film Industry use the GPU, either OpenCL or nVidia Cuda. I think a bit of research could find you a good, much faster solution.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
marc_256
Enthusiast
Enthusiast
Posts: 742
Joined: Thu May 06, 2010 10:16 am
Location: Belgium
Contact:

Re: 3D scanner software - new hardware question

Post by marc_256 »

djes,

You are right, I need to check all calculate time loops in the algorithm (who is huge) one by one,
to convert the (512x512 px) x >500 images.
It is there that I want to use ASM to win some time ...

IdeasVacuum,

It is not specially the visualisation, but the algorithm calculations,
for contrast, and transparency image after image.

thanks,
marc
- every professional was once an amateur - greetings from Pajottenland - Belgium -
PS: sorry for my english I speak flemish ...
User avatar
blueb
Addict
Addict
Posts: 1041
Joined: Sat Apr 26, 2003 2:15 pm
Location: Cuernavaca, Mexico

Re: 3D scanner software - new hardware question

Post by blueb »

IdeasVacuum hinted that you may be able to use the GPU to assist you...

Quote from Superuser.com:
Modern GPUs are capable of performing vector operations and floating-point arithmetic, with the latest cards capable of manipulating double-precision floating-point numbers. Frameworks such as CUDA and OpenCL enable programs to be written for GPUs, and the nature of GPUs make them most suited to highly parallelizable operations, such as in scientific computing, where a series of specialized GPU compute cards can be a viable replacement for a small compute cluster as in NVIDIA Tesla Personal Supercomputers. Consumers with modern GPUs who are experienced with Folding@home can use them to contribute with GPU clients, which can perform protein folding simulations at very high speeds and contribute more work to the project (be sure to read the FAQs first, especially those related to GPUs). GPUs can also enable better physics simulation in video games using PhysX, accelerate video encoding and decoding, and perform other compute-intensive tasks. It is these types of tasks that GPUs are most suited to performing.
- It was too lonely at the top.

System : PB 6.10 Beta 9 (x64) and Win Pro 11 (x64)
Hardware: AMD Ryzen 9 5900X w/64 gigs Ram, AMD RX 6950 XT Graphics w/16gigs Mem
User avatar
djes
Addict
Addict
Posts: 1806
Joined: Sat Feb 19, 2005 2:46 pm
Location: Pas-de-Calais, France

Re: 3D scanner software - new hardware question

Post by djes »

PB's ogre implementation is able to handle a lot of polygons with their own mapping and allows use of realtime shaders to alter their rendering (faster than doing it in software). G-Rom and Comtois could help you for this kind of problem. To have greatest speed everything should be in graphic memory, and you should avoid swapping between main memory and graphic memory, so you have to think in terms of what is needed by the graphic card. Shaders are like billions of processors working in parallel, sure you can do miracles with all this power, if you're able to convert your algorithms to a pixel based engine.
Post Reply