生成量出来的3D矩阵中的CPP [英] Generate volume out of 3d-matrix in cpp

查看:207
本文介绍了生成量出来的3D矩阵中的CPP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个功能用于产生三维矩阵具有灰度值(char值从0到255)。现在我想生成一个3D对象了这个矩阵,如中我想显示这些值作为一个3D对象(CPP)。什么是做的最好的方式,与平台无关的,并尽可能快?
我已经读了一些关于使用OGL,但后来我在以下问题上运行:矩阵最多可以包含$ 4个\ cdot10 ^ 9 $值。当我要加载的完整矩阵到RAM,它就会崩溃。因此,从矩阵直接平局是不可能的。此外,我只发现功能绘制二维图像OGL。有没有一种方法来绘制3D像素的OGL?或者我应该还是用另一种方法?
我不需要移动功能(至少不是现在),我只是想显示的数据。

I have a function for generating a 3d-matrix with grey values (char values from 0 to 255). Now I want to generate a 3d-object out of this matrix, e.g. I want to display these values as a 3d-object (in cpp). What is the best way to do that platform-independent and as fast as possible?
I have already read a bit about using OGL, but then I run in the following problem: The matrix can contain up to $4\cdot10^9$ values. When I want to load the complete matrix into the RAM, it will collapse. So a direct draw from the matrix is impossible. Furthermore I only found functions for drawing 2d-images in OGL. Is there a way to draw 3d-pixels in OGL? Or should I rather use another approach?
I do not need a moving functionality (at least not at the moment), I just want to display the data.

编辑2:对于缩小的问题是:有没有一种方法来绘制与OGL三维空间的像素从3D矩阵拍摄?我没有找到一个合适的功能,我只发现了2D-功能。

Edit 2: For narrowing the question in: Is there a way to draw pixels in 3d-space with OGL taken from a 3d-matrix? I did not find a suitable function, I only found 2d-functions.

推荐答案

你想做些什么叫做立体渲染。有很多种方法来实现它,最终它取决于你希望它是什么样子。

What you're looking to do is called volume rendering. There are various techniques to achieve it, and ultimately it depends on what you want it to look like.

有没有简单的方法要么做到这一点。你不能只是绘制3D像素。您可以绘制使用GL_POINTS,让每个变换点栅格为1个像素,但是这可能是完全不能满足你,因为它只能绘制一些像素到屏幕(你不会看到大分辨率任何东西)。

There is no simple way to do this either. You can't just draw 3d pixels. You can draw using GL_POINTS and have each transformed point raster to 1 pixel, but this is probably completely unsatisfactory for you because it will only draw a some pixels to the screen (you wont see anything on big resolutions).

一个通用的解决办法是只呈现正常使用三角形的立方体,每个点。排序后到前,如果你需要alpha混合。如果你想更具体的答案,你需要缩小你的要求。光线跟踪也有体绘制的优点。了解更多关于体绘制

A general solution would be to just render a cube using normal triangles, for each point. Sort it back to front if you need alpha blending. If you want a more specific answer you will need to narrow your request. Ray tracing also has merits in volume rendering. Learn more on volume rendering.

这篇关于生成量出来的3D矩阵中的CPP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆