Hi Jacky,
Look up above there is mat: TGLMatrix; and then
gl.GetFloatv(GL_MODELVIEW_MATRIX, @mat);
vx.X := mat.X.X;
...
but it's for ScaleVector to allocate data inside BoundingBox TGLCube, and before there is
InputTexture3D.LoadFromFile(TEX_FILENAME);
where
TEX_FILENAME = 'Head.tx3';
This is the binary file and I don't know where did it come from any tomography or ImageJ. Try to find out how to get it from grid/voxel data using asci csv txt instead. And in any succes please send messages to https://github.com/GLScene/GLScene/discussions
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
So happy when received u messages on the morning .
There are two question confused me
1. To Apply texture in openGL, there always two line:
glTexCoord(s,t,r);
glVertex3f(x,y,z);
But in your demo code, there only one line
gl.Vertex3f(x,y,z);
So whats the magic?
The demo seems can only show the volume in the range(-0.5,0,5) at each xyz. But in my scene, the world object is x(-5,5),y(-5,5),z(0,3). whatever i do scale, it doesnot work.
Bytheway, I have created volume 3-D texture by my data and show it in my GLScene as attachment q2-1. And now I just want put it into world object showed in attachement q2-2.
And about the matric mat u want me looked up, I just changed the code in other way:
TransposeMatrix(mat);
for I := 0 to tbProjectionN.Position - 1 do
begin
vt.X=1; vt.Y:=1; vt.Z:=Z;
vxl:=VectorTransform(vt,mat);
gl.Vertex3f(vxl.x, vxl.y, vxl.z);
{..vt:-1,1,z
...vt:-1,-1,z
...vt:1,-1,z
}
end;
Same result as u code.
That's test told me, each iteration just create an quard which four corners just mathec the 3-d texture x-y plane corners, range is (-1,1).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Jacky,
Well done. But I can't check your code pieces separately, attach the whole your program with your test data and you need to format the project sources (ctrl-d). There are three projects in the folder that need to be combined into one. In general. And yes, i have one project where such volumetric rendering is very necessary for the final visualization of our Galaxy. But before that comes the interpolation and marching cube for voxels. We have a TGLXYZGrid class and it could be used to create or load a 3d texture and then make volumetric rendering, then processing as is done for 2d, e.g. at https://sourceforge.net/p/glscene/code/HEAD/tree/trunk/Examples/Demos/specialsFX/warping/ . Also something can be taken from https://wallisc.github.io/rendering/2020/05/02/Volumetric-Rendering-Part-1.html .
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm so sorry for no respose during last weeks . I just trapped in my work, which is a typical geophysics project including data collection and signal processing and imaing, and all the software needed programed by my self. Thanks again for u help to created a greatful 3-D image.
My 3-D works are the typical imaging of data such as X-Y-Z-Value, not the usual geometrics imaging. If u have such kind of issuses, I will try even though my code does not looks beatiful.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
As title, the target effect like the attachment. I do not find the example in GLScene.
Jacky, what a method do you mean from https://en.wikipedia.org/wiki/Volume_rendering ?
Look at https://sourceforge.net/p/glscene/code/HEAD/tree/branches/Examples/Textures/Texture3D for example or if you have volumetric/distfunctions data then use raymatching shaders from https://www.shadertoy.com/results?query=tag%3Draymarching with GLScene's shader components. A demo using glsl shader will be added in examples later at https://github.com/GLScene/GLScene/tree/master/Examples/Demos/rendering .
vPv
Last edit: Pavel Vassiliev 2023-02-13
Thanks a lot , just occupied by work days.
Learned more from your demo code. Another question: where is the code to set the vertex texture coordinates ?
Hi Jacky,
Look up above there is mat: TGLMatrix; and then
gl.GetFloatv(GL_MODELVIEW_MATRIX, @mat);
vx.X := mat.X.X;
...
but it's for ScaleVector to allocate data inside BoundingBox TGLCube, and before there is
InputTexture3D.LoadFromFile(TEX_FILENAME);
where
TEX_FILENAME = 'Head.tx3';
This is the binary file and I don't know where did it come from any tomography or ImageJ. Try to find out how to get it from grid/voxel data using asci csv txt instead. And in any succes please send messages to https://github.com/GLScene/GLScene/discussions
JackyJhones,
And look also at https://github.com/rordenlab/MRIcroGL how to make volume rendering in Lazarus and FMX in https://github.com/LUXOPHIA/VolumeRender then make the same for GLScene, but in the latter case the hlsl shader needs to be converted to glsl shader.
Last edit: Pavel Vassiliev 2023-02-26
So happy when received u messages on the morning .
There are two question confused me
1. To Apply texture in openGL, there always two line:
glTexCoord(s,t,r);
glVertex3f(x,y,z);
But in your demo code, there only one line
gl.Vertex3f(x,y,z);
So whats the magic?
Bytheway, I have created volume 3-D texture by my data and show it in my GLScene as attachment q2-1. And now I just want put it into world object showed in attachement q2-2.
Execited and confusing.
Thans again.
And about the matric mat u want me looked up, I just changed the code in other way:
TransposeMatrix(mat);
for I := 0 to tbProjectionN.Position - 1 do
begin
vt.X=1; vt.Y:=1; vt.Z:=Z;
vxl:=VectorTransform(vt,mat);
gl.Vertex3f(vxl.x, vxl.y, vxl.z);
{..vt:-1,1,z
...vt:-1,-1,z
...vt:1,-1,z
}
end;
Same result as u code.
That's test told me, each iteration just create an quard which four corners just mathec the 3-d texture x-y plane corners, range is (-1,1).
Jacky,
Well done. But I can't check your code pieces separately, attach the whole your program with your test data and you need to format the project sources (ctrl-d). There are three projects in the folder that need to be combined into one. In general. And yes, i have one project where such volumetric rendering is very necessary for the final visualization of our Galaxy. But before that comes the interpolation and marching cube for voxels. We have a TGLXYZGrid class and it could be used to create or load a 3d texture and then make volumetric rendering, then processing as is done for 2d, e.g. at https://sourceforge.net/p/glscene/code/HEAD/tree/trunk/Examples/Demos/specialsFX/warping/ . Also something can be taken from https://wallisc.github.io/rendering/2020/05/02/Volumetric-Rendering-Part-1.html .
I'm so sorry for no respose during last weeks . I just trapped in my work, which is a typical geophysics project including data collection and signal processing and imaing, and all the software needed programed by my self. Thanks again for u help to created a greatful 3-D image.
My 3-D works are the typical imaging of data such as X-Y-Z-Value, not the usual geometrics imaging. If u have such kind of issuses, I will try even though my code does not looks beatiful.
Jacky Jhones,
Please, send your suggestions and wishes for the vulume renfering with further development of the GLScene to the discussion https://github.com/glscene/GLScene/discussions/25
PVV