I couldn't apply the texture to the TGLPolygon object, for every object other than Polygon I can do it, so texture is enabled but still nothing shows up, do I have to assign the texture to the face group.
Your guidance will be appreciated,
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I sent a question via email to this board, but it seems it got lost and never posted. Let me just post my question following this thread.
I am trying to visualize a 3D medical image, which is a 3D array of floating-point values. I would like to create a thin slice, and map the image data as texture to the slice (at the begining, just the x/y, y/z or z/x plane, in the future, may go for oblique slices).
I am wondering if anyone can share a few lines of code to show how to converts a 2D/3D array into a textured glscene object? do I need to convert the array to a TBitmap first? what object should I use? polygon or a thin cube?
if you can point me to a simple example of 3D array rendering using glscene that would be even better. volumetric rendering (instead of 2D slice rendering) is fine too.
thanks a lot!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Dear SBlade,
By default for TGLPolygon in Material property the Texture has Disabled as False, so make it True and then download a texture file like persistant image or picfile. In attachment there is a screenshot for TriangleBox demo from collisions dir with the texture overlayed to polygon. So you don't need to use a face group.
PW
Interestingly that doesn't work in my case, I followed the instructions as you instructed. Does it matter the orientation of nodes whether they are CW or CCW, and also I try to load png image so could t be problem it doesn't hasve channel or not. At the attachment there is snapshot taken from design mode,
If you provide any sample I'll really appreciate it.
Regards,
Hi FangQ,
I've added some Textures demos in branches\examples, look at Texture3D medical volume rendering demo and UVMapping, that may help for your purposes
thank you so much! both Texture3D and UVMapping examples are extremely helpful. I will likely to adapt the Texture3D example since it deals with 3D volumes directly, and is really fast.
yes, I am also aware of mricrogl but currently I don't need a full-featured 3D rendering program. The features in the Texture3D example is just about everything I need, and the code is very short and easy to understand/adapt. thank you for pointing me to this code!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
hi Pavel and Jerome, can one of you point me to the unit that defines the texture data types? I see a Longword is used in the Texture3D example, but don't know what data types are supported (and their values)
Oops FangQ,
If you work in Lazarus then for 3d medical object's rendering ready application you better look at MRIcroGL by Chris Rordan at https://github.com/neurolabusc That's worth of it.
Sincerely
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
hi Pavel and Jerome, can one of you point me to the unit that defines the texture data types? I see a Longword is used in the Texture3D example, but don't know what data types are supported (and their values)
I am particularly curious if I can load 32bit floating-point data into a texture.
thanks
GL_RGBA, GL ... are define in OpenGLTokens unit.
For using float color it's GL_RGBA32F if i'm remember.
Or just make conversion multiply each float color channel by 255 and ensure result value to range of [0..255]
hi Jerome, to compile either examples on LInux, I need to make a few minor changes:
for the Texture3D example, I need to change
Texture3D.lpr: change unit1 to Unit1,
Unit.pas line#107: Head.tx3 to head.tx3 (alternatively, rename the file)
for the UvMapping example,
Unit1.pas line#362: change "cube.3ds" to "Cube.3DS" (alternatively, rename the file)
Thanks, grrrr BORING sensible case between Windows and Linux. I'll check others demos and do the changes.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
hi Jerome, thanks again for the previous points on the 3D texture sample code, and I was able to adapt it for rendering my data.
One follow up question on this - I know this is related to my lack of understanding to OpenGL rendering pipeline in general, but hopefully there is a simple change you can suggest:
The 3D texture example renders a 3D texture array in a 1x1x1 dummy cube. I am currently working on adding axis labels for an Nx x Ny x Nz array as texture. To do that, I need to render the texture in an Nx x Ny x Nz box, and add the labels using this example you provided in this post: https://sourceforge.net/p/glscene/discussion/93606/thread/f379b20a/#25c6
can you point me to the lines in the 3D texture example where I can expand from a 1x1x1 cube to box that matches the data shape/dimensions?
thanks
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Dear All,
I couldn't apply the texture to the TGLPolygon object, for every object other than Polygon I can do it, so texture is enabled but still nothing shows up, do I have to assign the texture to the face group.
Your guidance will be appreciated,
I sent a question via email to this board, but it seems it got lost and never posted. Let me just post my question following this thread.
I am trying to visualize a 3D medical image, which is a 3D array of floating-point values. I would like to create a thin slice, and map the image data as texture to the slice (at the begining, just the x/y, y/z or z/x plane, in the future, may go for oblique slices).
I am wondering if anyone can share a few lines of code to show how to converts a 2D/3D array into a textured glscene object? do I need to convert the array to a TBitmap first? what object should I use? polygon or a thin cube?
if you can point me to a simple example of 3D array rendering using glscene that would be even better. volumetric rendering (instead of 2D slice rendering) is fine too.
thanks a lot!
Dear SBlade,
By default for TGLPolygon in Material property the Texture has Disabled as False, so make it True and then download a texture file like persistant image or picfile. In attachment there is a screenshot for TriangleBox demo from collisions dir with the texture overlayed to polygon. So you don't need to use a face group.
PW
Hi Pavel,
Interestingly that doesn't work in my case, I followed the instructions as you instructed. Does it matter the orientation of nodes whether they are CW or CCW, and also I try to load png image so could t be problem it doesn't hasve channel or not. At the attachment there is snapshot taken from design mode,
If you provide any sample I'll really appreciate it.
Regards,
Last edit: SBlade 2015-11-11
Hi FangQ,
I've added some Textures demos in branches\examples, look at Texture3D medical volume rendering demo and UVMapping, that may help for your purposes
thank you so much! both Texture3D and UVMapping examples are extremely helpful. I will likely to adapt the Texture3D example since it deals with 3D volumes directly, and is really fast.
yes, I am also aware of mricrogl but currently I don't need a full-featured 3D rendering program. The features in the Texture3D example is just about everything I need, and the code is very short and easy to understand/adapt. thank you for pointing me to this code!
hi Pavel and Jerome, can one of you point me to the unit that defines the texture data types? I see a Longword is used in the Texture3D example, but don't know what data types are supported (and their values)
https://sourceforge.net/p/glscene/code/HEAD/tree/branches/GLSceneLCL/Examples/Textures/Texture3D/Texture_3D_Unit.pas#l42
I am particularly curious if I can load 32bit floating-point data into a texture.
thanks
Hi FanQ i've updated SVN see: https://sourceforge.net/p/glscene/discussion/lazarus/thread/c4845e29/
hi Jerome, to compile either examples on LInux, I need to make a few minor changes:
for the Texture3D example, I need to change
Texture3D.lpr: change unit1 to Unit1,
Unit.pas line#107: Head.tx3 to head.tx3 (alternatively, rename the file)
for the UvMapping example,
Unit1.pas line#362: change "cube.3ds" to "Cube.3DS" (alternatively, rename the file)
For Lazarus you'll can find UVMapping demo in Examples\Editors\uvMapping folder :)
Oops FangQ,
If you work in Lazarus then for 3d medical object's rendering ready application you better look at MRIcroGL by Chris Rordan at https://github.com/neurolabusc That's worth of it.
Sincerely
Hi FangQ
GL_RGBA, GL ... are define in OpenGLTokens unit.
For using float color it's GL_RGBA32F if i'm remember.
Or just make conversion multiply each float color channel by 255 and ensure result value to range of [0..255]
Thanks, grrrr BORING sensible case between Windows and Linux. I'll check others demos and do the changes.
hi Jerome, thanks again for the previous points on the 3D texture sample code, and I was able to adapt it for rendering my data.
One follow up question on this - I know this is related to my lack of understanding to OpenGL rendering pipeline in general, but hopefully there is a simple change you can suggest:
The 3D texture example renders a 3D texture array in a 1x1x1 dummy cube. I am currently working on adding axis labels for an Nx x Ny x Nz array as texture. To do that, I need to render the texture in an Nx x Ny x Nz box, and add the labels using this example you provided in this post: https://sourceforge.net/p/glscene/discussion/93606/thread/f379b20a/#25c6
can you point me to the lines in the 3D texture example where I can expand from a 1x1x1 cube to box that matches the data shape/dimensions?
thanks