The indices for the face triangles appear to be incorrect for voxel meshes. This is visible when the backfaces are culled (e.g. translucent renderstyle, alpha):
Incorrect winding for voxel triangles
Moderator: Graf Zahl
- Graf Zahl
- GZDoom Developer
- Posts: 7148
- Joined: Wed Jul 20, 2005 9:48
- Location: Germany
- Contact:
- Arookas
- Posts: 5
- Joined: Sat Mar 19, 2011 5:47
Re: Incorrect winding for voxel triangles
Thanks! Just checked out the latest svn build. It appears that fixed it for all but the side faces, which now have both triangles reversed. I can't tell exactly which sides those are, however.
- Graf Zahl
- GZDoom Developer
- Posts: 7148
- Joined: Wed Jul 20, 2005 9:48
- Location: Germany
- Contact:
Re: Incorrect winding for voxel triangles
I didn't see that when I tested it.
- Arookas
- Posts: 5
- Joined: Sat Mar 19, 2011 5:47
Re: Incorrect winding for voxel triangles
It only shows up when the actor's renderstyle is set to translucent. I also found that it is the front and back sides that are facing the wrong way:
(On the left, renderstyle is normal. On the right, renderstyle is translucent.)
I think the problem for this resides in MakeSlabPolys. I don't know which culling bits correspond to which side (Ken's docs don't specify this), but I've attached the demo map seen above if it helps.
(On the left, renderstyle is normal. On the right, renderstyle is translucent.)
I think the problem for this resides in MakeSlabPolys. I don't know which culling bits correspond to which side (Ken's docs don't specify this), but I've attached the demo map seen above if it helps.
- Attachments
-
- voxeltest.zip
- (16.33 KiB) Downloaded 43 times
- Arookas
- Posts: 5
- Joined: Sat Mar 19, 2011 5:47
Re: Incorrect winding for voxel triangles
I figured out the problem. The back and front faces are indeed swapped in MakeSlabPolys. Swapping them like this:
makes the above test map voxels render as intended:
Code: Select all
if (cull & 4)
{
AddFace(x+1, y, z, x, y, z, x+1, y, z+c, x, y, z+c, *col, check);
}
if (cull & 8)
{
AddFace(x, y+1, z, x+1, y+1, z, x, y+1, z+c, x+1, y+1, z+c, *col, check);
}