Turning 2D image into 3D
Because the links posted to my contributions on the José Roca's forum have gone,
here is a GDImage 7.00 updated version of the pix3D project.
This project computes a grayed intensity for each pixel color, and it turns them into 3D visualization.
This could be used to perform surface analysis, ground topography or any other mathematical computation, or just for fun.
The default representation is using raster point (gl_dPoint) , but it could also use line (gl_dLine) or any other 3D primitive.
To switch between point and line, you have to edit the code shown below:
glPushMatrix()
glRotatef(90, 1, 0, 0) '// ROTATION
glTranslatef(0, 0, -rH) '// TRANSLATION
if (nAnimate) then rPenSize = 2 else rPenSize = 1
glPointSize(rPenSize)
nPixStep = 2
for y = 0 to nH - 1 step nPixStep
for x = 0 to nW -1 step nPixStep
zSplitColorARGB(PixColor(x, y), A, R, G, B)
if (A) then
rSize = rAlpha(x, y) * nMove
'gl_dLine(rX1 - rW + x, rY1, rX1 - rW + x, rY1 - rSize, PixColor(x, y), rPenSize)
gl_dPoint(rX1 - rW + x, rY1 - rSize, PixColor(x, y))
end if
next
glTranslatef(0, 0, nPixStep) '// TRANSLATION
next
glPopMatrix()
Note: You can use drag & drop from the Explorer to render a specific image.
Turn the image to see the 3D side.

Post questions or comments there:
https://forum.powerbasic.com/forum/u...-image-into-3d
Because the links posted to my contributions on the José Roca's forum have gone,
here is a GDImage 7.00 updated version of the pix3D project.
This project computes a grayed intensity for each pixel color, and it turns them into 3D visualization.
This could be used to perform surface analysis, ground topography or any other mathematical computation, or just for fun.
The default representation is using raster point (gl_dPoint) , but it could also use line (gl_dLine) or any other 3D primitive.
To switch between point and line, you have to edit the code shown below:
glPushMatrix()
glRotatef(90, 1, 0, 0) '// ROTATION
glTranslatef(0, 0, -rH) '// TRANSLATION
if (nAnimate) then rPenSize = 2 else rPenSize = 1
glPointSize(rPenSize)
nPixStep = 2
for y = 0 to nH - 1 step nPixStep
for x = 0 to nW -1 step nPixStep
zSplitColorARGB(PixColor(x, y), A, R, G, B)
if (A) then
rSize = rAlpha(x, y) * nMove
'gl_dLine(rX1 - rW + x, rY1, rX1 - rW + x, rY1 - rSize, PixColor(x, y), rPenSize)
gl_dPoint(rX1 - rW + x, rY1 - rSize, PixColor(x, y))
end if
next
glTranslatef(0, 0, nPixStep) '// TRANSLATION
next
glPopMatrix()
Note: You can use drag & drop from the Explorer to render a specific image.
Turn the image to see the 3D side.
Post questions or comments there:
https://forum.powerbasic.com/forum/u...-image-into-3d