Page 1 of 1

API newVolumeImage parameter layers

Posted: Wed Aug 04, 2021 2:53 pm
by Rigachupe
Hi, does somebody understand what the layers parameter for function newVolumeImage is? And if this can be constructed from a single image exported as slices from MagicaVoxel?

Re: API newVolumeImage parameter layers

Posted: Wed Aug 04, 2021 7:34 pm
by pgimeno
Löve can only load from PNG or JPG, and both of these are 2D image formats. In order to have the pixels defined for all 3 dimensions, you need one 2D image per every Z coordinate. These images are the layers, and you pass them as a table of images. The docs are not clear on the mapping, but most likely Z=0 corresponds to the image at index 1 and so on (so, Z = index - 1).

Re: API newVolumeImage parameter layers

Posted: Wed Aug 04, 2021 8:42 pm
by ReFreezed
pgimeno wrote: Wed Aug 04, 2021 7:34 pm Löve can only load from PNG or JPG(...)
Not only. LÖVE supports many formats. See Image_Formats and PixelFormat.

Re: API newVolumeImage parameter layers

Posted: Thu Aug 05, 2021 12:28 am
by pgimeno
Oh right, thanks for the correction. I don't know where I got that from. The point still stands, though, that none of the file types is 3D and the layers are the different 2D images used for different Z coordinates.

Re: API newVolumeImage parameter layers

Posted: Tue Aug 10, 2021 7:46 am
by Rigachupe
Hmm, correct me if i am understanding this wrong. But the volume image is a voxel like 3D texture accelerated by GPU?

Re: API newVolumeImage parameter layers

Posted: Tue Aug 10, 2021 10:29 am
by grump
Rigachupe wrote: Tue Aug 10, 2021 7:46 am Hmm, correct me if i am understanding this wrong. But the volume image is a voxel like 3D texture accelerated by GPU?
A VolumeImage is a 3D texture. All that means is that the texture not only has width and height, but also depth - basically a stack of 2D images. It doesn't by itself provide 3D/voxel rendering, it's merely a data structure.