Incorrect winding for voxel triangles

Bugs that have been resolved.

Moderator: Graf Zahl

Locked
User avatar
Arookas
Posts: 5
Joined: Sat Mar 19, 2011 5:47

Incorrect winding for voxel triangles

Post by Arookas »

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):

Image
User avatar
Graf Zahl
GZDoom Developer
GZDoom Developer
Posts: 7148
Joined: Wed Jul 20, 2005 9:48
Location: Germany
Contact:

Re: Incorrect winding for voxel triangles

Post by Graf Zahl »

fixed
User avatar
Arookas
Posts: 5
Joined: Sat Mar 19, 2011 5:47

Re: Incorrect winding for voxel triangles

Post by Arookas »

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.
User avatar
Graf Zahl
GZDoom Developer
GZDoom Developer
Posts: 7148
Joined: Wed Jul 20, 2005 9:48
Location: Germany
Contact:

Re: Incorrect winding for voxel triangles

Post by Graf Zahl »

I didn't see that when I tested it.
User avatar
Arookas
Posts: 5
Joined: Sat Mar 19, 2011 5:47

Re: Incorrect winding for voxel triangles

Post by Arookas »

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:

Image
(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
User avatar
Arookas
Posts: 5
Joined: Sat Mar 19, 2011 5:47

Re: Incorrect winding for voxel triangles

Post by Arookas »

I figured out the problem. The back and front faces are indeed swapped in MakeSlabPolys. Swapping them like this:

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);
}
makes the above test map voxels render as intended:
Image
Locked

Return to “Closed Bugs”