API newVolumeImage parameter layers

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
Rigachupe
Citizen
Posts: 83
Joined: Fri Jun 18, 2021 11:21 am

API newVolumeImage parameter layers

Post 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?
User avatar
pgimeno
Party member
Posts: 3544
Joined: Sun Oct 18, 2015 2:58 pm

Re: API newVolumeImage parameter layers

Post 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).
User avatar
ReFreezed
Party member
Posts: 612
Joined: Sun Oct 25, 2015 11:32 pm
Location: Sweden
Contact:

Re: API newVolumeImage parameter layers

Post 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.
Tools: Hot Particles, LuaPreprocess, InputField, (more) Games: Momento Temporis
"If each mistake being made is a new one, then progress is being made."
User avatar
pgimeno
Party member
Posts: 3544
Joined: Sun Oct 18, 2015 2:58 pm

Re: API newVolumeImage parameter layers

Post 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.
Rigachupe
Citizen
Posts: 83
Joined: Fri Jun 18, 2021 11:21 am

Re: API newVolumeImage parameter layers

Post by Rigachupe »

Hmm, correct me if i am understanding this wrong. But the volume image is a voxel like 3D texture accelerated by GPU?
grump
Party member
Posts: 947
Joined: Sat Jul 22, 2017 7:43 pm

Re: API newVolumeImage parameter layers

Post 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.
Post Reply

Who is online

Users browsing this forum: No registered users and 50 guests