Lately I've been experimenting with using voxel models as a mapping element and actually making the models themselves proved to be easy enough thanks to MagicaVoxel and a tutorial on how to use it. But now that the actual actor is ready, I'm running into a new problem: the model appears offset when the player is anyhow higher or lower relative to its z position.
See the attached testcase: a voxelized BRNSMAL1 is placed onto a ledge. You can use the lift to adjust your z height. When the player is lower than the voxel, it appears to be off the ground:
When the player is high enough, it appears to sink into the cement texture:
I guess a 3d floor plus midtextures might do instead of the voxel in this particular case though... and yes you may use the model attached. Just give credit please.
[2.8pre-944-g372f7e7] Voxel models don't align correctly
Moderator: GZDoom Developers
Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
[2.8pre-944-g372f7e7] Voxel models don't align correctly
- Attachments
-
voxeltestcase.wad- (32.48 KiB) Downloaded 86 times
- Graf Zahl
- Lead GZDoom+Raze Developer

- Posts: 49252
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: [2.8pre-944-g372f7e7] Voxel models don't align correctly
I don't think this can be fixed. After all the voxel is projected into the world as a 2D object and that's bound to show some glitches with objects that have a clear 3D structure like this one. You can see the same effect even in the voxel test map, although it's not this pronounced there because everything stands on a single surface. But if you fly around and look at objects from different positions, you'll notice even there that they appear to shift around and distort quite a bit.
- GFD
- Posts: 347
- Joined: Mon May 31, 2010 7:42 pm
- Preferred Pronouns: He/Him
- Location: Canada
- Contact:
Re: [2.8pre-944-g372f7e7] Voxel models don't align correctly
I've noticed this before too. I always thought voxels just rendered at the wrong "height" relative to the viewpoint. Like, a voxel on flat ground in front of you will always appear to be rendered slightly below the ground. Or maybe they just render slightly larger than they should be? I was curious, so I took some comparison screenshots between GL and software, and it just looks bigger in software. I've attached some test voxels I threw together, just in case anyone can come to any conclusions by messing around with them.
- Attachments
-
VC_voxelexamples.pk3- (6.02 KiB) Downloaded 52 times
- Graf Zahl
- Lead GZDoom+Raze Developer

- Posts: 49252
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: [2.8pre-944-g372f7e7] Voxel models don't align correctly
No, it's just like I said. The voxel gets projected into a 2D-plane. And that plane is - obviously - at the center of the voxel so the protruding parts appear to be below the origin point - just like sprites that 'sink' into the floor. There's really nothing that can be done with a 2.5D engine.
Re: [2.8pre-944-g372f7e7] Voxel models don't align correctly
2.5D plane or not, it seems to me the real issue is the voxel's stretch from center is getting miscalculated. It appears that being too far above and below the voxel causes it to shift around on the screen at more of an extreme than the level's geometry does.
An example would be - if the voxel is supposed to appear near the top of the screen at a given viewpoint, then it shifts too far up. If the voxel is supposed to be at the bottom of the screen, it shifts too far down.
The whole "sprite" thing with voxels is to be expected - where it sinks into the floor, gets clipped by walls and other sprites, etc, I am just saying I think the plane being used for voxels seems to be a bit too far stretched. It's like it's running a lower FOV than the geometry.
So yeah, they can bleed into the floor for all anyone cares - no one is even concerned about that. The point is - they wouldn't even do it, if they were properly aligned with the screen.
An example would be - if the voxel is supposed to appear near the top of the screen at a given viewpoint, then it shifts too far up. If the voxel is supposed to be at the bottom of the screen, it shifts too far down.
The whole "sprite" thing with voxels is to be expected - where it sinks into the floor, gets clipped by walls and other sprites, etc, I am just saying I think the plane being used for voxels seems to be a bit too far stretched. It's like it's running a lower FOV than the geometry.
So yeah, they can bleed into the floor for all anyone cares - no one is even concerned about that. The point is - they wouldn't even do it, if they were properly aligned with the screen.
- Graf Zahl
- Lead GZDoom+Raze Developer

- Posts: 49252
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: [2.8pre-944-g372f7e7] Voxel models don't align correctly
I rather think this is caused by the view position affecting how the voxel is projected, i.e. if it's looked at from below, there's no parts that get projected 'in the ground', but the higher the view gets, the larger that part becomes - and for the top and ceiling it's the same. Since sprites are simply 2D images that effect cannot be observed there.
At least that's how that object in the demo map appears to me. It never seems to shift position, only projection,
At least that's how that object in the demo map appears to me. It never seems to shift position, only projection,
Re: [2.8pre-944-g372f7e7] Voxel models don't align correctly
So I started playing ZDoom in different resolutions, and that's when things got really wonky. At 320x200, the projection is drastically different than at 320x240 - and stays true to their own glitches even if forced with vid_aspect.
In other words, at 320x200 and 640x400, no matter what vid_aspect is used, the projection appears to be too small for the screen (the voxel is too zoomed out), but at 320x240 or 640x480, the projection appears too big for the screen (the voxel is too zoomed in). I played with this at other resolutions, even with other aspect ratios, and it seems that it is unique to 320x200 and 640x400, where by default the video aspect is forced to 4:3. All resolutions besides the old DOS non-square ones seem to behave the same way as each other. Notice how the level geometry scales correctly to the new screen geometry, but the voxels do not.
Note these are pretty small, so I am not going to bother spoiler-tagging them.
In other words, at 320x200 and 640x400, no matter what vid_aspect is used, the projection appears to be too small for the screen (the voxel is too zoomed out), but at 320x240 or 640x480, the projection appears too big for the screen (the voxel is too zoomed in). I played with this at other resolutions, even with other aspect ratios, and it seems that it is unique to 320x200 and 640x400, where by default the video aspect is forced to 4:3. All resolutions besides the old DOS non-square ones seem to behave the same way as each other. Notice how the level geometry scales correctly to the new screen geometry, but the voxels do not.
Note these are pretty small, so I am not going to bother spoiler-tagging them.
