# Procedural Mesh, Strange Clipping

 0 So I've generated a mesh from code ala Minecraft and have this strange clipping problem that I can't figure out. I've checked and re-checked the vertices, the winding order of the triangles, the UVs, and the normals (whether manually or via RecalculateNormals()), and everything looks correct, however, I feel like I've missed an obvious step. Any advice on where to look? Here's a video: http://player.vimeo.com/video/42946293Here's some example code for one face of a cube: `````` # check to the right of a spot and see if it needs squares built upwards (i.e. the spot to the right is higher) if (x+1 < len(chunkHeights, 0)): if (chunkHeights[x,y] < chunkHeights[x+1, y]): # if the block to the right is higher... total_blocks_up = chunkHeights[x+1,y] - chunkHeights[x,y] for b in range(total_blocks_up): # block to the right could be several spots higher # vertices for square vertex_list.Push(Vector3(x+1, h+1*b, y+1)) vertex_list.Push(Vector3(x+1, h+1*b, y)) vertex_list.Push(Vector3(x+1, h+1+1*b, y)) vertex_list.Push(Vector3(x+1, h+1+1*b, y+1)) # uvs. (16 textures per side in the texture sheet) uv_list.Push(Vector2(0/16.0, 15/16.0)) uv_list.Push(Vector2(1/16.0, 15/16.0)) uv_list.Push(Vector2(1/16.0, 1)) uv_list.Push(Vector2(0/16.0, 1)) # normals point due left. this is also what's generated by RecalculateNormals() normal_list.Push(Vector3(1,0,0)) normal_list.Push(Vector3(1,0,0)) normal_list.Push(Vector3(1,0,0)) normal_list.Push(Vector3(1,0,0)) # triangle list in proper order triangle_list.Push(1+i*4) triangle_list.Push(0+i*4) triangle_list.Push(3+i*4) triangle_list.Push(3+i*4) triangle_list.Push(2+i*4) triangle_list.Push(1+i*4) i += 1 # keep track of triangle order in a big list `````` more ▼ asked May 28 '12 at 03:50 AM squirlhntr 29 ● 3 ● 6 ● 8 add new comment (comments are locked) 10|3000 characters needed characters left ▼ Viewable by all users

 0 Looks to me like your shader is the problem; it seems to not be writing to the ZBuffer. Try using a different shader and see if that helps. Also, +1 for using a video to demonstrate the problem! more ▼ answered May 28 '12 at 05:29 AM Datael 555 ● 2 ● 5 Thank you, that was spot on. I didn't even notice that I had the shader set to Diffuse/Transparent. Whoops! May 28 '12 at 03:03 PM squirlhntr Great. I'm glad that was it. If it wasn't I wouldn't have known where to go next :D May 29 '12 at 07:23 AM Datael Today's "psychic answer" great work! :) May 29 '12 at 09:00 AM Fattie add new comment (comments are locked) 10|3000 characters needed characters left ▼ Viewable by all users

By Email:

Topics:

x1403
x307
x124
x82

asked: May 28 '12 at 03:50 AM

Seen: 427 times

Last Updated: May 29 '12 at 09:00 AM