PDA

View Full Version : 2D Texture Mapping



Zed Xie
12-09-2010, 06:42 AM
I want to do the 2D texture based volume rendering of some bridge data using opengl. But I am not familiar with the volume rendering process using 2d texture mapping. Is there any example code?

Thanks.

strattonbrazil
12-09-2010, 09:10 AM
What type of volume rendering are you planning on doing with 2D textures?

Zed Xie
12-09-2010, 02:38 PM
Thank you for your reply. I just want to do the 3D visualization of my data. And I think 2D texture mapping is an easy way to do that. But I am not familiar with the process.

strattonbrazil
12-10-2010, 09:27 AM
I'm kind of having a hard time understanding what you're trying to do. Volume rendering is not the same thing as 3D visualization. Most of the time in OpenGL one is only concerned with surfaces. For example with a person, I don't need to worry about his/her internal organs--just the outer shell. Volume rendering, on the other hand, takes the internals into account and is a fundamentally different process that requires 3D data. You can volume render a bridge, but it means you have data inside the bridge to render. Is that true or do you just have the structure?

Zed Xie
12-10-2010, 10:41 AM
Sorry for the ambiguous words. Actually I am not going to visualize the bridge. I want to visualize the bridge examination data. I used the ultrasonics to test the bridge and got some three dimension data. I want to see the internal flaws such as crack and concrete corrosion and need to volume render such data. Right now I don't know how to do the volume rendering. General Opengl reference books do not have much description of this part. I feel grateful of your help, if you can provide some examples for me to understand the process.

Thanks again for your kind reply.

strattonbrazil
12-10-2010, 04:17 PM
First question, what format is your data in? Is it a rectilinear grid? Tetrahedrals?

Also, do you just need to visualize it in any program like VTK or do you need to write your own code?

Zed Xie
12-11-2010, 06:11 PM
Hey Strattonbrazil,

Thank you very much for your patient reply. The data format is as following:
X Y Z A
0.3 0.3 0 0
0.3 0.3 0.005 0
0.3 0.3 0.01 0
0.3 0.3 0.015 0
0.3 0.3 0.02 0.05
0.3 0.3 0.025 0.07
0.3 0.3 0.03 0.28
0.3 0.3 0.035 0.84
0.3 0.3 0.04 0.39
0.3 0.3 0.045 0.82

0.9 0.3 0.675 0.14
0.9 0.3 0.680 0.14
0.9 0.3 0.685 0.15
0.9 0.3 0.690 0.14


Range of X is 0.3~16.5, with interval 0.6
Range of Y is 0.3~3.3, with interval 0.6
Range of Z is 0~1, with interval 0.005
A is the amplitude value, I want to use it to control the color value.

I need to write my own code. I have tried Matlab before for comparison. But it is only the scatter plot. I need the continuous performance.

Right now I have another question. In order to have a continuous performance, do I need to do the interpolation first and apply the interpolation result to opengl? Or opengl already have interpolation commands and can do the internal interpolation for me?

Thanks again for your kind reply all the time.

strattonbrazil
12-13-2010, 09:28 AM
Do you also have the 3D mesh of the bridge? If you need more than a scatterplot, you might want to consider using VTK. It most certainly can do what you need.

Zed Xie
12-13-2010, 12:44 PM
Thanks for the reply. I do not have 3D mesh of the bridge. I only have the sample data from the instrument. If I need more than the scatterplot, do I need to do the interpolation before applied to the Opengl?

I am requested to finish in Opengl. Do you have some suggestions?

Thanks again.

ZbuffeR
12-13-2010, 01:26 PM
Just draw a bunch of points.
How many points do you have ?

Zed Xie
12-13-2010, 01:51 PM
Thanks for your kind reply.
X axis have 30 different values
Y axis have 6 different values,
Z axis have 150 different values.
Total number of points 30*6*150.

I can use the amplitude value to set the color to related points.
But after that, I can only have a scatterplot. But what I need is a continuous performance, how to combine all these points together? If it is 2D image, I can draw triangles. But right now it is 3D volume. If I only draw a bunch of points, I don't know how to connect them together.

ZbuffeR
12-13-2010, 03:41 PM
AH OK NOW I UNDERSTAND !!!
For low number of points like you seem to have, search for Delaunay triangulation, it is doable in 3D.
For high number of points, see rolling ball algorithm.
Try to load your data into Meshlab, lots of techniques already implemented you can play with.
http://meshlab.sourceforge.net/

EDIT: byt the way this has absolutely nothing to do with either 2D or texture mapping ...

Zed Xie
12-15-2010, 05:18 PM
Thanks for your information. I want a continuous performance and not a point cloud figure.Also I need to set the transparency to see inside. Does Meshlab can do that? If possible, how can I do it in Opengl?