Menu

How to do Volume Render in GLScene.

Help
2023-02-13
2023-04-20
  • JackyJhones

    JackyJhones - 2023-02-13

    As title, the target effect like the attachment. I do not find the example in GLScene.

     
  • JackyJhones

    JackyJhones - 2023-02-20

    Thanks a lot , just occupied by work days.

     
  • JackyJhones

    JackyJhones - 2023-02-26

    Learned more from your demo code. Another question: where is the code to set the vertex texture coordinates ?

     
  • Pavel Vassiliev

    Pavel Vassiliev - 2023-02-26

    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

    JackyJhones - 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?

    1. 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.

    Execited and confusing.
    Thans again.

     
  • JackyJhones

    JackyJhones - 2023-02-26

    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).

     
    • Pavel Vassiliev

      Pavel Vassiliev - 2023-02-27

      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 .

       
  • JackyJhones

    JackyJhones - 2023-03-12

    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.

     
  • Pavel Vassiliev

    Pavel Vassiliev - 2023-04-20

    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

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.